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()
{
// ...
}
}
$factory = new BundleFactory();
$bundel = $factory->build(SomeClass::class);
// Get the SUT
$sut = $bundle->getSut();
// Access the mocked dependencies
$sut['myDependency']->expects()->someMethod()->once();