1. Go to this page and download the library: Download alexrili/lumen-test-booster 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/ */
alexrili / lumen-test-booster example snippets
// ...
abstract class TestCase extends Base
{
use \LumenTestBooster;
// ...
}
// ...
public function setUp(): void
{
$this->stubClasses([ClassYourWantToMock::class]);
parent::setUp();
}
// ...
// ...
public function setUp(): void
{
$this->stubClasses([NotificationService::class]);
parent::setUp();
}
// ...
// ...
/** @test */
public function should_return_erro_when_consumer_doesnt_have_an_email()
{
$this->doubleMethod(NotificationService::class, 'sendEmailNotification')
->setReturn(NotificationServiceStub::class, "sendEmailNotificationError");
}
// ...
// ...
/** @test */
public function should_return_error()
{
$this->withoutShowingExceptions();
// ...
}
// ...
// ...
/**
* setup before class function
*
* @return void
*/
public static function setUpBeforeClass(): void
{
self::initAspectMock(
[
'appDir' => '/', // root directory of your aplication.
'debug' => true, // to get debug details
'
tests\
Stubs\
NotificationServiceStub.php
tests\
Stubs\
NotificationServiceStub.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.