/**
  * Test counting bookmarks with an Url condition
  *
  * @return void
  */
 public function testCountWhereUrl()
 {
     // No bookmark with sample URL
     $nb = WpHerissonBookmarksTable::countWhere("url=?", array($this->sampleUrl));
     $this->assertEquals(0, $nb);
     // Adding one
     $f = new WpHerissonBookmarks();
     $f->setUrl($this->sampleUrl);
     $f->save();
     // Count should be 1
     $nb = WpHerissonBookmarksTable::countWhere("url=?", array($this->sampleUrl));
     $this->assertEquals(1, $nb);
     // Adding another one
     $f = new WpHerissonBookmarks();
     $f->setUrl($this->sampleUrl);
     $f->save();
     // List should contains 2 elements, with the sampleUrl
     $bookmarks = WpHerissonBookmarksTable::getWhere("url=?", array($this->sampleUrl));
     $this->assertSame(get_class($bookmarks), 'Doctrine_Collection');
     $this->assertCount(2, $bookmarks->toArray());
     foreach ($bookmarks as $bookmark) {
         $this->assertSame($bookmark->url, $this->sampleUrl);
     }
 }
 /**
  * Test adding a new bookmark and delete it
  *
  * @return void
  */
 public function testAddBookmarkAndDelete()
 {
     // Create a sample bookmark
     $f = new WpHerissonBookmarks();
     $f->setUrl($this->sampleUrl);
     $f->save();
     // Check it's saved in the DB
     $bookmarks = WpHerissonBookmarksTable::getWhere('url=?', array($this->sampleUrl));
     $this->assertEquals(1, sizeof($bookmarks));
     // Delete it and verify it's not there anymore
     foreach ($bookmarks as $f) {
         $f->delete();
     }
     $bookmarks = WpHerissonBookmarksTable::getWhere('url=?', array($this->sampleUrl));
     $this->assertEquals(0, sizeof($bookmarks));
 }