public function testInvalidate() { $this->structure->hasTag('sulu.rlp')->willReturn(true); $this->structure->getPropertyValueByTagName('sulu.rlp')->willReturn('/path/to'); $this->structure->getLanguageCode()->willReturn($this->languageCode); $this->structure->getWebspaceKey()->willReturn($this->webspaceKey); $urls = ['/path/to/1', '/path/to/2']; $this->webspaceManager->findUrlsByResourceLocator('/path/to', $this->env, $this->languageCode, $this->webspaceKey)->willReturn($urls); $this->proxyClient->purge($urls[0])->shouldBeCalled(); $this->proxyClient->purge($urls[1])->shouldBeCalled(); $this->proxyClient->flush()->shouldBeCalled(); $this->webspaceManager->findUrlsByResourceLocator(Argument::any())->shouldNotBeCalled(); $this->handler->invalidateStructure($this->structure->reveal()); $this->handler->flush(); }
/** * Returns select of a single structure with title and url selector. */ private function buildSelectForStructure($locale, StructureInterface $structure, &$names) { $nodeNameProperty = $structure->getProperty('title'); $result = ''; $name = $this->getTranslatedProperty($nodeNameProperty, $locale)->getName(); if (!in_array($name, $names)) { $names[] = $name; $result .= ', ' . $this->buildSelector($name); } if ($structure->hasTag('sulu.rlp')) { $urlProperty = $structure->getPropertyByTagName('sulu.rlp'); $name = $this->getTranslatedProperty($urlProperty, $locale)->getName(); if ($urlProperty->getContentTypeName() !== 'resource_locator' && !in_array($name, $names)) { $names[] = $name; $result .= ', ' . $this->buildSelector($name); } } return $result; }