public function testStartPage() { $data = ['title' => 'startpage', 'tags' => ['tag1', 'tag2'], 'url' => '/', 'article' => 'article']; $this->mapper->saveStartPage($data, 'overview', 'sulu_io', 'en', 1, false); $startPage = $this->mapper->loadStartPage('sulu_io', 'en'); $this->assertEquals('startpage', $startPage->title); $this->assertEquals('/', $startPage->url); $data['title'] = 'new-startpage'; $this->mapper->saveStartPage($data, 'overview', 'sulu_io', 'en', 1, false); $startPage = $this->mapper->loadStartPage('sulu_io', 'en'); $this->assertEquals('new-startpage', $startPage->title); $this->assertEquals('/', $startPage->url); $startPage = $this->mapper->loadByResourceLocator('/', 'sulu_io', 'en'); $this->assertEquals('new-startpage', $startPage->title); $this->assertEquals('/', $startPage->url); }
public function testContentTree() { $data = [['title' => 'News', 'tags' => ['tag1', 'tag2'], 'url' => '/news', 'article' => 'asdfasdfasdf'], ['title' => 'Testnews-1', 'tags' => ['tag1', 'tag2'], 'url' => '/news/test-1', 'article' => 'sulu_io'], ['title' => 'Testnews-2', 'tags' => ['tag1', 'tag2'], 'url' => '/news/test-2', 'article' => 'sulu_io'], ['title' => 'Testnews-2-1', 'tags' => ['tag1', 'tag2'], 'url' => '/news/test-2/test-1', 'article' => 'sulu_io']]; // save root content $root = $this->mapper->save($data[0], 'overview', 'sulu_io', 'de', 1); // add a child content $this->mapper->save($data[1], 'overview', 'sulu_io', 'de', 1, true, null, $root->getUuid()); $child = $this->mapper->save($data[2], 'overview', 'sulu_io', 'de', 1, true, null, $root->getUuid()); $this->mapper->save($data[3], 'overview', 'sulu_io', 'de', 1, true, null, $child->getUuid()); // check nodes $content = $this->mapper->loadByResourceLocator('/news', 'sulu_io', 'de'); $this->assertEquals('News', $content->title); $this->assertTrue($content->getHasChildren()); $content = $this->mapper->loadByResourceLocator('/news/test-1', 'sulu_io', 'de'); $this->assertEquals('Testnews-1', $content->title); $this->assertFalse($content->getHasChildren()); $content = $this->mapper->loadByResourceLocator('/news/test-2', 'sulu_io', 'de'); $this->assertEquals('Testnews-2', $content->title); $this->assertTrue($content->getHasChildren()); $content = $this->mapper->loadByResourceLocator('/news/test-2/test-1', 'sulu_io', 'de'); $this->assertEquals('Testnews-2-1', $content->title); $this->assertFalse($content->getHasChildren()); // check content repository $root = $this->session->getRootNode(); $contentRootNode = $root->getNode('cmf/sulu_io/contents'); $newsNode = $contentRootNode->getNode('news'); $this->assertEquals(2, count($newsNode->getNodes())); $this->assertEquals('News', $newsNode->getPropertyValue($this->languageNamespace . ':de-title')); $testNewsNode = $newsNode->getNode('testnews-1'); $this->assertEquals('Testnews-1', $testNewsNode->getPropertyValue($this->languageNamespace . ':de-title')); $testNewsNode = $newsNode->getNode('testnews-2'); $this->assertEquals(1, count($testNewsNode->getNodes())); $this->assertEquals('Testnews-2', $testNewsNode->getPropertyValue($this->languageNamespace . ':de-title')); $subTestNewsNode = $testNewsNode->getNode('testnews-2-1'); $this->assertEquals('Testnews-2-1', $subTestNewsNode->getPropertyValue($this->languageNamespace . ':de-title')); }