1. Go to this page and download the library: Download illusiard/yii2-testkit 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/ */
illusiard / yii2-testkit example snippets
use Illusiard\Yii2Testkit\Testing\YiiTestCase;
final class MyServiceTest extends YiiTestCase
{
protected function appConfig(): array
{
return [
'id' => 'test-app',
'basePath' => __DIR__,
];
}
public function testSomething(): void
{
$this->assertNotNull(\Yii::$app);
}
}
use Illusiard\Yii2Testkit\TestStand\StandConfig;
use Illusiard\Yii2Testkit\TestStand\StandManager;
$config = StandConfig::load(__DIR__ . '/tests/_config/stand.php');
$stand = new StandManager();
$stand->up($config, true);
$stand->logs($config);
$stand->down($config, true);