コード例 #1
0
 public function testGetChildObject()
 {
     ConcreteArticleQuery::create()->deleteAll();
     ConcreteQuizzQuery::create()->deleteAll();
     ConcreteContentQuery::create()->deleteAll();
     $content = new ConcreteContent();
     $content->save();
     $this->assertNull($content->getChildObject());
     $article = new ConcreteArticle();
     $article->save();
     $content = $article->getConcreteContent();
     $this->assertEquals($article, $content->getChildObject());
 }
コード例 #2
0
 public function testPostDeleteCopyData()
 {
     ConcreteArticleQuery::create()->deleteAll();
     ConcreteQuizzQuery::create()->deleteAll();
     ConcreteContentQuery::create()->deleteAll();
     ConcreteCategoryQuery::create()->deleteAll();
     $category = new ConcreteCategory();
     $category->setName('main');
     $article = new ConcreteArticle();
     $article->setConcreteCategory($category);
     $article->save();
     $id = $article->getId();
     $article->delete();
     $this->assertNull(ConcreteContentQuery::create()->findPk($id), 'delete() removes the parent record as well');
 }