Example #1
0
 /**
  * @test
  * @group library
  */
 public function businessGetAllByWebsiteIdShouldReturnExpectedAlbums()
 {
     $allAlbumsForWebsiteId = $this->business->getAllByWebsiteId($this->websiteId);
     $this->assertTrue(count($allAlbumsForWebsiteId) === 4);
     foreach ($allAlbumsForWebsiteId as $albumsOfWebsiteId) {
         $this->assertInstanceOf('Cms\\Data\\Album', $albumsOfWebsiteId);
         $this->assertSame($this->websiteId, $albumsOfWebsiteId->getWebsiteId());
         $this->assertTrue($this->validateUniqueId(new DataAlbum(), $albumsOfWebsiteId->getId()));
         $this->assertNotEmpty($albumsOfWebsiteId->getName());
     }
 }
Example #2
0
 /**
  * @test
  * @group library
  */
 public function businessShouldCreateAlbumAsExpected()
 {
     $createValues = array('name' => 'business_test_album_0');
     $testAlbum = $this->business->create($this->websiteId, $createValues);
     $this->assertSame($createValues['name'], $testAlbum->getName());
     $this->assertSame($this->websiteId, $testAlbum->getWebsiteid());
     $this->assertTrue($this->validateUniqueId(new DataAlbum(), $testAlbum->getId()));
     // Timestamp der letzten Aenderung darf nicht aelter sein als ein paar Sekunden
     $this->assertNotNull($testAlbum->getLastupdate());
     $maxAlter = time() - 2;
     $this->assertGreaterThan($maxAlter, $testAlbum->getLastupdate());
 }
Example #3
0
 /**
  * @test
  * @group library
  */
 public function businessEditShouldEditAlbumAsExpected()
 {
     $allAlbumsForWebsiteId = $this->business->getAllByWebsiteId($this->websiteId);
     $this->assertTrue(count($allAlbumsForWebsiteId) === 1);
     $this->assertInstanceOf('Cms\\Data\\Album', $allAlbumsForWebsiteId[0]);
     $this->assertSame('business_test_album_name_0', $allAlbumsForWebsiteId[0]->getName());
     $lastUpdateDateBeforeUpdate = $allAlbumsForWebsiteId[0]->getLastUpdate();
     $updateValues = array('name' => 'business_test_album_name_0_altered');
     $editedAlbum = $this->business->edit($this->albumId, $this->websiteId, $updateValues);
     $this->assertSame($updateValues['name'], $editedAlbum->getName());
     $this->assertSame($this->websiteId, $editedAlbum->getWebsiteid());
     $this->assertSame($this->albumId, $editedAlbum->getId());
     $this->assertNotSame($lastUpdateDateBeforeUpdate, $editedAlbum->getLastUpdate());
     $maxUpdateDateFromEntry = time();
     $minUpdateDateFromEntry = $maxUpdateDateFromEntry - 3;
     $this->assertGreaterThanOrEqual($minUpdateDateFromEntry, $editedAlbum->getLastUpdate());
     $this->assertLessThanOrEqual($maxUpdateDateFromEntry, $editedAlbum->getLastUpdate());
     $allAlbumsForWebsiteId = $this->business->getAllByWebsiteId($this->websiteId);
     $this->assertTrue(count($allAlbumsForWebsiteId) === 1);
     $this->assertInstanceOf('Cms\\Data\\Album', $allAlbumsForWebsiteId[0]);
     $this->assertSame('business_test_album_name_0_altered', $allAlbumsForWebsiteId[0]->getName());
 }