Download the PHP package hermeslin/mockery-overload-properties without Composer
On this page you can find all versions of the php package hermeslin/mockery-overload-properties. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hermeslin/mockery-overload-properties
More information about hermeslin/mockery-overload-properties
Files in hermeslin/mockery-overload-properties
Package mockery-overload-properties
Short Description mock instance's properties via Mockery's overload keyword
License BSD-3-Clause
Homepage https://github.com/hermeslin/mockery-overload-properties
Informations about the package mockery-overload-properties
mockery overload properties
mock instance's properties via Mockery's overload keyword
installation
use composer to install mockery-overload-properties
test legacy sample code
under the example folder, you can see the sample code taht we want to test:
- User.php
- Vip.php
and you'll find the hard dependencies in Vip.php.
hard dependencies are not a big deal, you can use Mockery's overload keyword to mock User instance easily, but it difficult to mock User instance properties when User set the properties on its __construct phase.
test case
under the tests folder, there are two test cases here:
- LegacyCodeFailTest.php
- LegacyCodeSuccessTest.php
see tests\LegacyCodeSuccessTest.php will show you how to use mockery-overload-properties to mock User
when mock instance whith properties, you still can use Expectation Declarations from Mockery to test you code.