Example #1
0
 /**
  * Testing the delete method also removes Tags related to the deleted record.
  *
  * @since 2.0.1
  * @dataProvider getActiveRecordProviders
  */
 public function testDeleteRelatedTags($provider)
 {
     $article = new Article();
     $tag = new Tag();
     $this->assertEquals(0, $tag->getCount(), 'Testing the delete method also removes Tags related to the deleted record.');
     $article->set('title', 'Unit test');
     $article->set('description', 'Unit test');
     $article->set('author', 'Unit test');
     $article->set('content', 'jupiter neptune venus');
     $article->save();
     $this->assertEquals(3, $tag->getCount(), 'Testing the delete method also removes Tags related to the deleted record.');
     $article->delete();
     $this->assertEquals(0, $article->getCount(), 'Testing the delete method also removes Tags related to the deleted record.');
     $this->assertEquals(0, $tag->getCount(), 'Testing the delete method also removes Tags related to the deleted record.');
 }