Exemplo n.º 1
0
 /**
  * testDeleteArticleBLinks method
  *
  * @return void
  */
 public function testDeleteArticleBLinks()
 {
     $this->loadFixtures('Article', 'ArticlesTag', 'Tag', 'User');
     $TestModel = new ArticleB();
     $result = $TestModel->ArticlesTag->find('all');
     $expected = array(array('ArticlesTag' => array('article_id' => '1', 'tag_id' => '1')), array('ArticlesTag' => array('article_id' => '1', 'tag_id' => '2')), array('ArticlesTag' => array('article_id' => '2', 'tag_id' => '1')), array('ArticlesTag' => array('article_id' => '2', 'tag_id' => '3')));
     $this->assertEquals($expected, $result);
     $TestModel->delete(1);
     $result = $TestModel->ArticlesTag->find('all');
     $expected = array(array('ArticlesTag' => array('article_id' => '2', 'tag_id' => '1')), array('ArticlesTag' => array('article_id' => '2', 'tag_id' => '3')));
     $this->assertEquals($expected, $result);
 }
Exemplo n.º 2
0
 /**
  * Tests that creating a model with no existent database table associated will throw an exception
  *
  * @expectedException MissingTableException
  * @return void
  */
 public function testMissingTable()
 {
     $Article = new ArticleB(false, uniqid());
     $Article->schema();
 }