Initial commit,修正
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace tests\codeception\unit;
|
||||
|
||||
use tests\codeception\fixtures\AdminFixture;
|
||||
|
||||
/**
|
||||
* Description of TestCase
|
||||
*
|
||||
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
|
||||
* @since 1.0
|
||||
*/
|
||||
class TestCase extends \yii\codeception\TestCase
|
||||
{
|
||||
public $appConfig = '@tests/codeception/config/unit.php';
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->loadFixtures();
|
||||
}
|
||||
|
||||
public function fixtures()
|
||||
{
|
||||
return[
|
||||
AdminFixture::className(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
// add unit testing specific bootstrap code here
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace tests\codeception\unit\components;
|
||||
|
||||
/**
|
||||
* Description of HelperTest
|
||||
*
|
||||
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
|
||||
* @since 1.0
|
||||
*/
|
||||
class HelperTest extends \tests\codeception\unit\TestCase
|
||||
{
|
||||
public function testFilter()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace tests\codeception\unit\models;
|
||||
|
||||
use Yii;
|
||||
use tests\codeception\unit\TestCase;
|
||||
use Codeception\Specify;
|
||||
use mdm\admin\models\AuthItem;
|
||||
|
||||
class ItemTest extends TestCase
|
||||
{
|
||||
|
||||
use Specify;
|
||||
|
||||
public function testAddNew()
|
||||
{
|
||||
$model = new AuthItem();
|
||||
$model->attributes = [
|
||||
'type' => 1,
|
||||
];
|
||||
// required
|
||||
$this->assertFalse($model->validate());
|
||||
|
||||
|
||||
$model = new AuthItem();
|
||||
$model->attributes = [
|
||||
'name' => 'Tester',
|
||||
'type' => 1,
|
||||
];
|
||||
$this->assertTrue($model->validate());
|
||||
$model->save();
|
||||
|
||||
|
||||
$model = new AuthItem();
|
||||
$model->attributes = [
|
||||
'name' => 'Tester',
|
||||
'type' => 1,
|
||||
];
|
||||
// not unique
|
||||
$this->assertFalse($model->validate());
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace tests\codeception\unit\models;
|
||||
|
||||
use tests\codeception\unit\TestCase;
|
||||
|
||||
/**
|
||||
* Description of RouteTest
|
||||
*
|
||||
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
|
||||
* @since 2.5
|
||||
*/
|
||||
class RouteTest extends TestCase
|
||||
{
|
||||
public function testGetRouteList()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user