public function testHooksCall() { AuthorQuery::create()->deleteAll(); BookQuery::create()->deleteAll(); $author = new CountableAuthor(); $author->setFirstName('Foo'); $author->setLastName('Bar'); $book = new Book(); $book->setTitle('A title'); $book->setIsbn('13456'); $author->addBook($book); $author->save(); $this->assertEquals(1, AuthorQuery::create()->count()); $this->assertEquals(1, BookQuery::create()->count()); $this->assertEquals(1, $author->nbCallPreSave); }
public function testHooksCall() { AuthorQuery::create()->deleteAll(); BookQuery::create()->deleteAll(); $author = new CountableAuthor(); $book = new Book(); $author->addBook($book); $author->save(); $this->assertEquals(1, AuthorQuery::create()->count()); $this->assertEquals(1, BookQuery::create()->count()); $this->assertEquals(1, $author->nbCallPreSave); }