Beispiel #1
0
 public function testGetUniquePath()
 {
     // machines & machines-1 exists
     $result = $this->rlpMapper->getUniquePath('/products/machines', 'sulu_io', 'de');
     $this->assertEquals('/products/machines-2', $result);
     $this->assertTrue($this->rlpMapper->unique($result, 'sulu_io', 'de'));
     // drill & drill-1 exists
     $result = $this->rlpMapper->getUniquePath('/products/machines/drill', 'sulu_io', 'de');
     $this->assertEquals('/products/machines/drill-2', $result);
     $this->assertTrue($this->rlpMapper->unique($result, 'sulu_io', 'de'));
     // products exists
     $result = $this->rlpMapper->getUniquePath('/products', 'sulu_io', 'de');
     $this->assertEquals('/products-1', $result);
     $this->assertTrue($this->rlpMapper->unique($result, 'sulu_io', 'de'));
     // news not exists
     $result = $this->rlpMapper->getUniquePath('/news', 'sulu_io', 'de');
     $this->assertEquals('/news', $result);
     $this->assertTrue($this->rlpMapper->unique($result, 'sulu_io', 'de'));
 }
Beispiel #2
0
 /**
  * checks if path is valid.
  *
  * @param string $path         path of route
  * @param string $webspaceKey  key of portal
  * @param string $languageCode
  * @param string $segmentKey
  *
  * @return bool
  */
 public function isValid($path, $webspaceKey, $languageCode, $segmentKey = null)
 {
     return $this->cleaner->validate($path) && $this->mapper->unique($path, $webspaceKey, $languageCode, $segmentKey);
 }