Unable to mock Aerospike class - declared as "final"

Hi. I’m trying to build unit tests for some new stuff we’re building using Aerospike, and if I try and mock Aerospike, I get the following:

PHPUnit_Framework_Exception: Class "Aerospike" is declared "final" and cannot be mocked.

Ideally I want to be able to mock Aerospike in order to return specific results / not interface with Aerospike itself etc the same as I would do with PDO for example.

Any thoughts?

It’s not a bad idea. Let me do some research on it. Just as a note, there will be a different API for PHP7 and future HHVM releases.

Was hoping I’d be able to do it sooner rather than later lol. I’m looking at PHP7 now, so support would be great - the benefits of PHP7 are amazing over 5.6.x

Anything you’d need in order to be able to look into it? If you need examples of PDO etc, let me know so I can explain the kind of thing I’m looking to achieve.

Thanks Ronen

Check out the 3.4.7 release of the PHP client. The ‘final’ has been removed.

Great! Thanks Ronen - any support for PHP7 yet? :wink:

The gears of progress are grinding. It’ll be yuuuuge

Adding a note that the API documentation is now hosted on our site at https://www.aerospike.com/apidocs/php/

Within the client repo itself there is a PHP stub under docs/phpdoc. You can import the stub into your IDE for auto-completion, or build the API documentation using phpDocumentor

phpdoc run -v -d phpdoc/ -t html/
© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.