public function testRemoveRootAssetMappingsDispatchesEvent() { $mapping1 = new AssetMapping('/path', 'target1', '/css', $this->binding1->getUuid()); $mapping2 = new AssetMapping('/other/path', 'target2', '/js', $this->binding2->getUuid()); $event1 = new RemoveAssetMappingEvent($mapping1); $event2 = new RemoveAssetMappingEvent($mapping2); $expr = $this->defaultExpr()->andKey(BindingDescriptor::PARAMETER_VALUES, Expr::key(DiscoveryUrlGenerator::SERVER_PARAMETER, Expr::same('target1'))); $this->dispatcher->expects($this->at(0))->method('hasListeners')->with(PuliEvents::POST_REMOVE_ASSET_MAPPING)->willReturn(true); $this->dispatcher->expects($this->at(1))->method('dispatch')->with(PuliEvents::POST_REMOVE_ASSET_MAPPING, $event1); $this->dispatcher->expects($this->at(2))->method('dispatch')->with(PuliEvents::POST_REMOVE_ASSET_MAPPING, $event2); $this->discoveryManager->expects($this->once())->method('findRootBindings')->with($expr)->willReturn(array($this->binding1, $this->binding2)); $this->discoveryManager->expects($this->once())->method('removeRootBindings')->with($expr); $this->manager->removeRootAssetMappings(Expr::same('target1', AssetMapping::SERVER_NAME)); }
public function testRemoveRootAssetMappings() { $this->discoveryManager->expects($this->once())->method('removeRootBindings')->with($this->defaultExpr()->andKey(BindingDescriptor::PARAMETER_VALUES, Expr::key(DiscoveryUrlGenerator::SERVER_PARAMETER, Expr::same('target1')))); $this->manager->removeRootAssetMappings(Expr::same('target1', AssetMapping::SERVER_NAME)); }