/** * @param \Cms\Data\Page $result * @param string $expectedData */ protected function assertResultSuccess($result, $expectedData = '') { $this->assertInstanceOf('Cms\\Data\\Page', $result); $this->assertSame($result->getName(), $expectedData); $this->assertNotSame($result->getId(), $this->testEntry->getId()); $this->assertSame($result->getWebsiteId(), $this->testEntry->getWebsiteId()); $this->assertEquals($result->getPageType(), $this->testEntry->getPageType()); $this->assertEquals($result->getPageAttributes(), $this->testEntry->getPageAttributes()); }
/** * @test * @group library */ public function success() { $attributes = array('name' => 'new name', 'pageType' => 'the_new_page_type_id', 'pageAttributes' => (object) array('newKey' => 'newValue')); $this->assertNotEquals($attributes['name'], $this->testEntry->getName()); $this->assertNotEquals($attributes['pageType'], $this->testEntry->getPageType()); $this->assertNotEquals($attributes['pageAttributes'], json_decode($this->testEntry->getPageAttributes())); $lastUpdateBeforUpdate = $this->testEntry->getLastupdate(); // kurz warten, damit updateTime geprueft werden kann (sonst ist Zeit zu kurz) sleep(1); $this->service->update($this->testEntry->getId(), $this->websiteId, $attributes); $page = $this->service->getById($this->testEntry->getId(), $this->websiteId); $this->assertEquals($attributes['name'], $page->getName()); $this->assertEquals($attributes['pageType'], $page->getPageType()); $this->assertEquals($attributes['pageAttributes'], json_decode($page->getPageAttributes())); // Timestamp der letzten Aenderung darf nicht aelter sein als ein paar Sekunden $this->assertNotNull($page->getLastupdate()); $this->assertNotEquals($lastUpdateBeforUpdate, $page->getLastupdate()); $currentTime = time(); $this->assertLessThanOrEqual($currentTime, $page->getLastupdate()); $this->assertGreaterThan($currentTime - 2, $page->getLastupdate()); }
protected function setValuesFromData(PageData $data) { $this->setId($data->getId()); $this->setWebsiteId($data->getWebsiteid()); $this->setTemplateId($data->getTemplateid()); $this->setMediaId($data->getMediaId()); $this->setName($data->getName()); $this->setDescription($data->getDescription()); $this->setInNavigation($data->getInnavigation()); $this->setDate($data->getDate()); $this->setNavigationTitle($data->getNavigationtitle()); $this->setContent($data->getContent()); $this->setPageType($data->getPageType()); $this->setPageAttributes($data->getPageAttributes()); $this->setScreenshot(); }