1. Go to this page and download the library: Download sebastianknott/test-utils library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sebastianknott / test-utils example snippets
class SomeClass
{
public function __construct(Dependency $myDependency)
{
// ...
}
}
class Dependency{
public function someMethod()
{
// ...
}
}
$facade = new BundleFacade();
$bundle = $facade->build(SomeClass::class);
// Get the SUT
$sut = $bundle->sut;
// Access the mocked dependencies by parameter name
$bundle['myDependency']->expects()->someMethod()->once();