コード例 #1
0
 public function testCreate()
 {
     $post = new Post(['title' => 'New post title', 'body' => 'New post body', 'title_en' => 'New post title en', 'body_en' => 'New post body en', 'title_ru' => 'New post title ru', 'body_ru' => 'New post body ru']);
     $this->assertTrue($post->save());
     $dataSet = $this->getConnection()->createDataSet(['post', 'postLang']);
     $expectedDataSet = $this->createFlatXMLDataSet(__DIR__ . '/data/test-create-post-set-translations-dublication.xml');
     $this->assertDataSetsEqual($expectedDataSet, $dataSet);
     $post = new Post(['title' => 'New post title', 'body' => 'New post body']);
     $this->assertTrue($post->save());
     $post = Post::findOne($post->id);
     $this->assertNotNull($post->title);
 }
 public function testDeletePost()
 {
     $post = Post::findOne(2);
     $this->assertEquals(1, $post->delete());
     $dataSet = $this->getConnection()->createDataSet(['post', 'postLang']);
     $expectedDataSet = $this->createFlatXMLDataSet(__DIR__ . '/data/test-delete-post.xml');
     $this->assertDataSetsEqual($expectedDataSet, $dataSet);
 }