Last active
August 29, 2015 14:23
-
-
Save cornernote/bd90316cd7e259c5c377 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace bedezign\yii2\audit\tests; | |
use app\models\Post; | |
use Codeception\Specify; | |
use yii\codeception\TestCase; | |
/** | |
* AuditTrailBehaviorTest | |
*/ | |
class AuditTrailBehaviorTest extends TestCase | |
{ | |
use Specify; | |
/** | |
* @var UnitTester | |
*/ | |
protected $tester; | |
/** | |
* Create Post | |
*/ | |
public function testCreatePost() | |
{ | |
$post = new Post(); | |
$post->title = 'New post title'; | |
$post->body = 'New post body'; | |
$this->assertTrue($post->save()); | |
$this->tester->seeRecord('post', [ | |
'title' => 'New post title', | |
'body' => 'New post body', | |
]); | |
// //$dataSet = $this->getConnection()->createDataSet(['post', 'audit_entry', 'audit_trail']); | |
// $dataSet = new PHPUnit_Extensions_Database_DataSet_QueryDataSet($this->getConnection()); | |
// $dataSet->addTable('post'); | |
// //$dataSet->addTable('audit_entry', 'SELECT id FROM audit_entry'); | |
// $dataSet->addTable('audit_trail', 'SELECT entry_id, action, model, model_id, field, old_value, new_value FROM audit_trail ORDER BY field'); | |
// $expectedDataSet = $this->createFlatXMLDataSet(__DIR__ . '/data/test-create-post.xml'); | |
// $this->assertDataSetsEqual($expectedDataSet, $dataSet); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class_name: UnitTester | |
modules: | |
enabled: [Asserts, Yii2, UnitHelper] | |
config: | |
Yii2: | |
configFile: 'codeception/_config/unit.php' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment