public function testDescribeOfLargeGraph() { $uri = "http://largegraph/1"; $testStartTime = microtime(); $graph = new \Tripod\ExtendedGraph(); $graph->add_literal_triple($uri, "http://rdfs.org/sioc/spec/name", "new name"); $this->tripod->describeResource($uri); $testEndTime = microtime(); $this->assertLessThan(self::BENCHMARK_DESCRIBE_TIME, $this->getTimeDifference($testStartTime, $testEndTime), "It should always take less than " . self::BENCHMARK_DESCRIBE_TIME . "ms to describe large graph"); }
public function testSearchDocumentsRegenerateWhenDefinedPredicateChanged() { // First make a change that affects a search document $tripod = $this->getMock('\\Tripod\\Mongo\\Driver', array('getSearchIndexer', 'getDataUpdater'), array('CBD_testing', 'tripod_php_testing', array('defaultContext' => 'http://talisaspire.com/', 'async' => array(OP_VIEWS => true, OP_TABLES => true, OP_SEARCH => false)))); $tripodUpdate = $this->getMock('\\Tripod\\Mongo\\Updates', array('storeChanges'), array($tripod, array('defaultContext' => 'http://talisaspire.com/', 'async' => array(OP_VIEWS => true, OP_TABLES => true, OP_SEARCH => false)))); $labeller = new \Tripod\Mongo\Labeller(); $subjectsAndPredicatesOfChange = array($labeller->uri_to_alias("http://talisaspire.com/authors/1") => array("foaf:name")); $tripodUpdate->expects($this->atLeastOnce())->method('storeChanges')->will($this->returnValue(array("subjectsAndPredicatesOfChange" => $subjectsAndPredicatesOfChange, "transaction_id" => "t1234"))); $tripod->expects($this->atLeastOnce())->method('getDataUpdater')->will($this->returnValue($tripodUpdate)); $searchIndexer = $this->getMock('\\Tripod\\Mongo\\Composites\\SearchIndexer', array('getSearchProvider', 'getImpactedSubjects'), array($tripod)); $searchProvider = $this->getMock('\\Tripod\\Mongo\\MongoSearchProvider', array('deleteDocument', 'indexDocument'), array($tripod)); $searchProvider->expects($this->exactly(3))->method('deleteDocument')->with($this->matchesRegularExpression("/http:\\/\\/talisaspire\\.com\\/resources\\/doc(1|2|3)\$/"), 'http://talisaspire.com/', $this->equalTo(array('i_search_resource'))); $searchProvider->expects($this->exactly(3))->method('indexDocument'); $searchIndexer->expects($this->atLeastOnce())->method('getSearchProvider')->will($this->returnValue($searchProvider)); $impactedSubjects = array($this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')->setConstructorArgs(array(array(_ID_RESOURCE => 'http://talisaspire.com/resources/doc1', _ID_CONTEXT => 'http://talisaspire.com/'), OP_SEARCH, 'tripod_php_testing', 'CBD_testing', array('i_search_resource')))->setMethods(array('getTripod'))->getMock(), $this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')->setConstructorArgs(array(array(_ID_RESOURCE => 'http://talisaspire.com/resources/doc2', _ID_CONTEXT => 'http://talisaspire.com/'), OP_SEARCH, 'tripod_php_testing', 'CBD_testing', array('i_search_resource')))->setMethods(array('getTripod'))->getMock(), $this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')->setConstructorArgs(array(array(_ID_RESOURCE => 'http://talisaspire.com/resources/doc3', _ID_CONTEXT => 'http://talisaspire.com/'), OP_SEARCH, 'tripod_php_testing', 'CBD_testing', array('i_search_resource')))->setMethods(array('getTripod'))->getMock()); $impactedSubjects[0]->expects($this->once())->method('getTripod')->will($this->returnValue($tripod)); $impactedSubjects[1]->expects($this->once())->method('getTripod')->will($this->returnValue($tripod)); $impactedSubjects[2]->expects($this->once())->method('getTripod')->will($this->returnValue($tripod)); $searchIndexer->expects($this->once())->method('getImpactedSubjects')->with($subjectsAndPredicatesOfChange, 'http://talisaspire.com/')->will($this->returnValue($impactedSubjects)); $tripod->expects($this->atLeastOnce())->method('getSearchIndexer')->will($this->returnValue($searchIndexer)); $g1 = $tripod->describeResource("http://talisaspire.com/authors/1"); $g2 = $tripod->describeResource("http://talisaspire.com/authors/1"); $g2->add_literal_triple("http://talisaspire.com/authors/1", $g2->qname_to_uri("foaf:name"), "Bill Shakespeare"); $tripod->saveChanges($g1, $g2); // Now make a change that affects a different search document - Create new document $tripod = $this->getMock('\\Tripod\\Mongo\\Driver', array('getSearchIndexer'), array('CBD_testing', 'tripod_php_testing', array('defaultContext' => 'http://talisaspire.com/', 'async' => array(OP_VIEWS => true, OP_TABLES => true, OP_SEARCH => false)))); $searchIndexer = $this->getMock('\\Tripod\\Mongo\\Composites\\SearchIndexer', array('getSearchProvider', 'getImpactedSubjects'), array($tripod)); $searchProvider = $this->getMock('\\Tripod\\Mongo\\MongoSearchProvider', array('deleteDocument', 'indexDocument'), array($tripod)); $searchProvider->expects($this->exactly(1))->method('deleteDocument')->with($this->equalTo("http://talisaspire.com/lists/1234"), 'http://talisaspire.com/', $this->isEmpty()); $searchProvider->expects($this->exactly(1))->method('indexDocument'); $searchIndexer->expects($this->atLeastOnce())->method('getSearchProvider')->will($this->returnValue($searchProvider)); $impactedSubject = $this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')->setConstructorArgs(array(array(_ID_RESOURCE => 'http://talisaspire.com/lists/1234', _ID_CONTEXT => 'http://talisaspire.com/'), OP_SEARCH, 'tripod_php_testing', 'CBD_testing'))->setMethods(array('getTripod'))->getMock(); $impactedSubject->expects($this->once())->method('getTripod')->will($this->returnValue($tripod)); $searchIndexer->expects($this->once())->method('getImpactedSubjects')->will($this->returnValue(array($impactedSubject))); $tripod->expects($this->atLeastOnce())->method('getSearchIndexer')->will($this->returnValue($searchIndexer)); $list = new \Tripod\ExtendedGraph(); $list->add_resource_triple("http://talisaspire.com/lists/1234", RDF_TYPE, "http://purl.org/vocab/resourcelist/schema#List"); $list->add_literal_triple("http://talisaspire.com/lists/1234", "http://rdfs.org/sioc/spec/name", "Testing list"); $tripod->saveChanges(new \Tripod\ExtendedGraph(), $list); // Regen our search docs for real since this step was overridden in the stub $this->tripod->getSearchIndexer()->generateAndIndexSearchDocuments("http://talisaspire.com/lists/1234", "http://talisaspire.com/", 'CBD_testing'); // Now make a change to the last document $tripod = $this->getMock('\\Tripod\\Mongo\\Driver', array('getSearchIndexer'), array('CBD_testing', 'tripod_php_testing', array('defaultContext' => 'http://talisaspire.com/', 'async' => array(OP_VIEWS => true, OP_TABLES => true, OP_SEARCH => false)))); $searchIndexer = $this->getMock('\\Tripod\\Mongo\\Composites\\SearchIndexer', array('getSearchProvider', 'getImpactedSubjects'), array($tripod)); $searchProvider = $this->getMock('\\Tripod\\Mongo\\MongoSearchProvider', array('deleteDocument', 'indexDocument'), array($tripod)); $impactedSubject = $this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')->setConstructorArgs(array(array(_ID_RESOURCE => 'http://talisaspire.com/lists/1234', _ID_CONTEXT => 'http://talisaspire.com/'), OP_SEARCH, 'tripod_php_testing', 'CBD_testing', array('i_search_list')))->setMethods(array('getTripod'))->getMock(); $impactedSubject->expects($this->once())->method('getTripod')->will($this->returnValue($tripod)); $searchProvider->expects($this->exactly(1))->method('deleteDocument')->with($this->equalTo("http://talisaspire.com/lists/1234"), 'http://talisaspire.com/', array('i_search_list')); $searchProvider->expects($this->exactly(1))->method('indexDocument'); $searchIndexer->expects($this->atLeastOnce())->method('getSearchProvider')->will($this->returnValue($searchProvider)); $searchIndexer->expects($this->once())->method('getImpactedSubjects')->will($this->returnValue(array($impactedSubject))); $tripod->expects($this->atLeastOnce())->method('getSearchIndexer')->will($this->returnValue($searchIndexer)); $oldList = $tripod->describeResource("http://talisaspire.com/lists/1234"); $list = $tripod->describeResource("http://talisaspire.com/lists/1234"); /** @var ExtendedGraph $list */ $list->remove_property_values("http://talisaspire.com/lists/1234", "http://rdfs.org/sioc/spec/name"); $list->add_literal_triple("http://talisaspire.com/lists/1234", "http://rdfs.org/sioc/spec/name", "IMPROVED testing list"); $tripod->saveChanges($oldList, $list); // Regen our search docs for real since this step was overridden in the stub again $this->tripod->getSearchIndexer()->generateAndIndexSearchDocuments("http://talisaspire.com/lists/1234", "http://talisaspire.com/", 'CBD_testing'); }
public function testCursorNoExceptionThrownWhenCursorThrowsSomeExceptions() { $uri1 = "http://uri1"; $viewType = "someView"; $context = "http://someContext"; $returnedGraph = new \Tripod\ExtendedGraph(); $returnedGraph->add_literal_triple($uri1, 'http://somepred', 'someval'); $mockDb = $this->getMockBuilder('\\MongoDB\\Database')->disableOriginalConstructor()->setMethods(['selectCollection'])->getMock(); $mockColl = $this->getMockBuilder('\\MongoDB\\Collection')->disableOriginalConstructor()->setMethods(['findOne'])->getMock(); $mockViewColl = $this->getMockBuilder('\\MongoDB\\Collection')->disableOriginalConstructor()->setMethods(['find', 'findOne'])->getMock(); $mockCursor = $this->getMock('\\ArrayIterator', array('rewind')); $mockCursor->expects($this->exactly(5))->method('rewind')->will($this->onConsecutiveCalls($this->throwException(new \Exception('Exception thrown when cursoring to Mongo')), $this->throwException(new \Exception('Exception thrown when cursoring to Mongo')), $this->throwException(new \Exception('Exception thrown when cursoring to Mongo')), $this->throwException(new \Exception('Exception thrown when cursoring to Mongo')), $this->returnValue($mockCursor))); $mockViewColl->expects($this->once())->method('find')->will($this->returnValue($mockCursor)); $mockDb->expects($this->any())->method("selectCollection")->will($this->returnValue($mockColl)); $mockColl->expects($this->once())->method("findOne")->will($this->returnValue(null)); /** @var PHPUnit_Framework_MockObject_MockObject|TripodTestConfig $mockConfig */ $mockConfig = $this->getMock('TripodTestConfig', array('getCollectionForCBD', 'getCollectionForView')); $mockConfig->expects($this->atLeastOnce())->method('getCollectionForCBD')->with('tripod_php_testing', $this->anything(), $this->anything())->will($this->returnValue($mockColl)); $mockConfig->expects($this->atLeastOnce())->method('getCollectionForView')->with('tripod_php_testing', $this->anything(), $this->anything())->will($this->returnValue($mockViewColl)); $mockConfig->loadConfig(\Tripod\Mongo\Config::getConfig()); /* @var $mockTripodViews|PHPUnit_Framework_MockObject_MockObject Views */ $mockTripodViews = $this->getMock('\\Tripod\\Mongo\\Composites\\Views', array('generateView', 'getConfigInstance'), array('tripod_php_testing', $mockColl, $context)); $mockTripodViews->expects($this->never())->method('generateView'); $mockTripodViews->expects($this->atLeastOnce())->method('getConfigInstance')->will($this->returnValue($mockConfig)); $mockTripodViews->getViewForResources(array($uri1), $viewType, $context); }
public function testDeleteResourceCreatesImpactedSubjects() { $uri = 'http://example.com/users/' . uniqid(); $labeller = new \Tripod\Mongo\Labeller(); $uriAlias = $labeller->uri_to_alias($uri); $graph = new \Tripod\ExtendedGraph(); $graph->add_resource_triple($uri, RDF_TYPE, $labeller->qname_to_uri('spec:User')); $graph->add_literal_triple($uri, $labeller->qname_to_uri('foaf:firstName'), 'Anne'); $graph->add_literal_triple($uri, $labeller->qname_to_uri('foaf:surname'), 'Onymous'); $uri2 = 'http://example.com/users/' . uniqid(); $uriAlias2 = $labeller->uri_to_alias($uri2); $graph2 = new \Tripod\ExtendedGraph(); $graph2->add_resource_triple($uri2, RDF_TYPE, $labeller->qname_to_uri('spec:User')); $graph2->add_literal_triple($uri2, $labeller->qname_to_uri('foaf:firstName'), 'Ann'); $graph2->add_literal_triple($uri2, $labeller->qname_to_uri('foaf:surname'), 'O\'ther'); // Save the graphs and ensure that table rows are generated $tripod = new \Tripod\Mongo\Driver($this->defaultPodName, $this->defaultStoreName, array('defaultContext' => $this->defaultContext, OP_ASYNC => array(OP_VIEWS => false, OP_TABLES => false, OP_SEARCH => false))); $tripod->saveChanges(new \Tripod\ExtendedGraph(), $graph); $tableRows = $tripod->getTableRows('t_users', array(_ID_KEY . '.' . _ID_RESOURCE => $uriAlias, _ID_KEY . '.' . _ID_CONTEXT => $this->defaultContext)); $this->assertEquals(1, $tableRows['head']['count']); $tripod->saveChanges(new \Tripod\ExtendedGraph(), $graph2); $tableRows = $tripod->getTableRows('t_users', array(_ID_KEY . '.' . _ID_RESOURCE => $uriAlias2, _ID_KEY . '.' . _ID_CONTEXT => $this->defaultContext)); $this->assertEquals(1, $tableRows['head']['count']); /** @var \Tripod\Mongo\Driver|PHPUnit_Framework_MockObject_MockObject $mockTripod */ $mockTripod = $this->getMockBuilder('\\Tripod\\Mongo\\Driver')->setMethods(array('getDataUpdater'))->setConstructorArgs(array($this->defaultPodName, $this->defaultStoreName, array('defaultContext' => $this->defaultContext, OP_ASYNC => array(OP_VIEWS => false, OP_TABLES => false, OP_SEARCH => false))))->getMock(); /** @var \Tripod\Mongo\Updates|PHPUnit_Framework_MockObject_MockObject $mockUpdates */ $mockTripodUpdates = $this->getMockBuilder('\\Tripod\\Mongo\\Updates')->setConstructorArgs(array($mockTripod, array('defaultContext' => $this->defaultContext, OP_ASYNC => array(OP_VIEWS => false, OP_TABLES => false, OP_SEARCH => false))))->setMethods(array('processSyncOperations'))->getMock(); $mockTripod->expects($this->once())->method('getDataUpdater')->will($this->returnValue($mockTripodUpdates)); $expectedSubjectsAndPredicatesOfChange = array($uriAlias => array('rdf:type', 'foaf:firstName', 'foaf:surname'), $uriAlias2 => array('rdf:type', 'foaf:firstName', 'foaf:surname')); $mockTripodUpdates->expects($this->once())->method('processSyncOperations')->with($expectedSubjectsAndPredicatesOfChange, $this->defaultContext); $graph->add_graph($graph2); // Delete both user resources $mockTripod->saveChanges($graph, new \Tripod\ExtendedGraph()); $deletedGraph = $mockTripod->describeResources(array($uri, $uri2)); $this->assertTrue($deletedGraph->is_empty()); // Manually walk through the tables operation /** @var \Tripod\Mongo\Composites\Tables $tables */ $tables = $mockTripod->getComposite(OP_TABLES); $expectedImpactedSubjects = array(new \Tripod\Mongo\ImpactedSubject(array(_ID_RESOURCE => $uriAlias, _ID_CONTEXT => $this->defaultContext), OP_TABLES, $this->defaultStoreName, $this->defaultPodName, array('t_users')), new \Tripod\Mongo\ImpactedSubject(array(_ID_RESOURCE => $uriAlias2, _ID_CONTEXT => $this->defaultContext), OP_TABLES, $this->defaultStoreName, $this->defaultPodName, array('t_users'))); $this->assertEquals($expectedImpactedSubjects, $tables->getImpactedSubjects($expectedSubjectsAndPredicatesOfChange, $this->defaultContext)); foreach ($expectedImpactedSubjects as $subject) { $tables->update($subject); } $tableRows = $tripod->getTableRows('t_users', array(_ID_KEY . '.' . _ID_RESOURCE => $uriAlias, _ID_KEY . '.' . _ID_CONTEXT => $this->defaultContext)); $this->assertEquals(0, $tableRows['head']['count']); $tableRows = $tripod->getTableRows('t_users', array(_ID_KEY . '.' . _ID_RESOURCE => $uriAlias2, _ID_KEY . '.' . _ID_CONTEXT => $this->defaultContext)); $this->assertEquals(0, $tableRows['head']['count']); }
public function testSaveChangesWithInvalidCardinality() { $this->setExpectedException('\\Tripod\\Exceptions\\CardinalityException', "Cardinality failed on http://foo/bar/1 for 'rdf:type' - should only have 1 value and has: http://foo/bar#Class1, http://foo/bar#Class2"); $config = array(); $config['namespaces'] = array('rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'); $config["defaultContext"] = "http://talisaspire.com/"; $config["transaction_log"] = array("database" => "transactions", "collection" => "transaction_log", "data_source" => "tlog"); $config["data_sources"] = array("db" => array("type" => "mongo", "connection" => "mongodb://localhost"), "tlog" => array("type" => "mongo", "connection" => "mongodb://*****:*****@localhost:27018")); $config["stores"] = array("tripod_php_testing" => array("data_source" => "db", "pods" => array("CBD_testing" => array("cardinality" => array("rdf:type" => 1))))); $config['queue'] = array("database" => "queue", "collection" => "q_queue", "data_source" => "db"); // Override the config defined in base test class as we need specific config here. \Tripod\Mongo\Config::setConfig($config); $tripod = new \Tripod\Mongo\Driver('CBD_testing', 'tripod_php_testing', array('defaultContext' => 'http://talisaspire.com/')); $oldGraph = new \Tripod\ExtendedGraph(); $newGraph = new \Tripod\ExtendedGraph(); $newGraph->add_resource_triple('http://foo/bar/1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://foo/bar#Class1'); $newGraph->add_resource_triple('http://foo/bar/1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://foo/bar#Class2'); $tripod->saveChanges($oldGraph, $newGraph, "http://talisaspire.com/"); }
public function testDeleteResourceCreatesImpactedSubjects() { $uri = 'http://example.com/resources/' . uniqid(); $labeller = new Tripod\Mongo\Labeller(); $uriAlias = $labeller->uri_to_alias($uri); $creatorUri = 'http://example.com/identities/oscar-wilde'; $creatorUriAlias = $labeller->uri_to_alias($creatorUri); $graph = new \Tripod\ExtendedGraph(); $graph->add_resource_triple($uri, RDF_TYPE, $labeller->qname_to_uri('acorn:Resource')); $graph->add_resource_triple($uri, RDF_TYPE, $labeller->qname_to_uri('bibo:Book')); $graph->add_literal_triple($uri, $labeller->qname_to_uri('dct:title'), 'The Importance of Being Earnest'); $graph->add_literal_triple($uri, $labeller->qname_to_uri('dct:subject'), 'Plays -- Satire'); $graph->add_resource_triple($uri, $labeller->qname_to_uri('dct:creator'), $creatorUri); $uri2 = 'http://example.com/resources/' . uniqid(); $uriAlias2 = $labeller->uri_to_alias($uri2); $graph2 = new \Tripod\ExtendedGraph(); $graph2->add_resource_triple($uri2, RDF_TYPE, $labeller->qname_to_uri('acorn:Resource')); $graph2->add_resource_triple($uri2, RDF_TYPE, $labeller->qname_to_uri('bibo:Book')); $graph2->add_literal_triple($uri2, $labeller->qname_to_uri('dct:title'), 'The Picture of Dorian Gray'); $graph2->add_literal_triple($uri2, $labeller->qname_to_uri('dct:subject'), 'Portraits -- Fiction'); $graph2->add_resource_triple($uri2, $labeller->qname_to_uri('dct:creator'), $creatorUri); $graph3 = new \Tripod\ExtendedGraph(); $graph3->add_resource_triple($creatorUri, RDF_TYPE, $labeller->qname_to_uri('foaf:Person')); $graph3->add_literal_triple($creatorUri, $labeller->qname_to_uri('foaf:name'), 'Oscar Wilde'); // Save the graphs and ensure that table rows are generated $tripod = new \Tripod\Mongo\Driver($this->defaultPodName, $this->defaultStoreName, array('defaultContext' => $this->defaultContext, OP_ASYNC => array(OP_VIEWS => false, OP_TABLES => false, OP_SEARCH => false))); // Save the author graph first so the joins work $tripod->saveChanges(new \Tripod\ExtendedGraph(), $graph3); $tripod->saveChanges(new \Tripod\ExtendedGraph(), $graph); $collection = \Tripod\Mongo\Config::getInstance()->getCollectionForSearchDocument($this->defaultStoreName, 'i_search_resource'); $query = array(_ID_KEY => array(_ID_RESOURCE => $uriAlias, _ID_CONTEXT => $this->defaultContext, _ID_TYPE => 'i_search_resource')); $this->assertEquals(1, $collection->count($query)); $tripod->saveChanges(new \Tripod\ExtendedGraph(), $graph2); $query[_ID_KEY][_ID_RESOURCE] = $uriAlias2; $this->assertEquals(1, $collection->count($query)); $impactQuery = array(_ID_KEY . '.' . _ID_TYPE => 'i_search_resource', '_impactIndex' => array(_ID_RESOURCE => $creatorUriAlias, _ID_CONTEXT => $this->defaultContext), 'result.author' => 'Oscar Wilde'); $this->assertEquals(2, $collection->count($impactQuery)); /** @var \Tripod\Mongo\Driver|PHPUnit_Framework_MockObject_MockObject $mockTripod */ $mockTripod = $this->getMockBuilder('\\Tripod\\Mongo\\Driver')->setMethods(array('getDataUpdater'))->setConstructorArgs(array($this->defaultPodName, $this->defaultStoreName, array('defaultContext' => $this->defaultContext, OP_ASYNC => array(OP_VIEWS => false, OP_TABLES => false, OP_SEARCH => false))))->getMock(); $mockTripodUpdates = $this->getMockBuilder('\\Tripod\\Mongo\\Updates')->setConstructorArgs(array($mockTripod, array('defaultContext' => $this->defaultContext, OP_ASYNC => array(OP_VIEWS => false, OP_TABLES => false, OP_SEARCH => false))))->setMethods(array('processSyncOperations'))->getMock(); $mockTripod->expects($this->once())->method('getDataUpdater')->will($this->returnValue($mockTripodUpdates)); $expectedSubjectsAndPredicatesOfChange = array($creatorUriAlias => array('rdf:type', 'foaf:name')); $mockTripodUpdates->expects($this->once())->method('processSyncOperations')->with($expectedSubjectsAndPredicatesOfChange, $this->defaultContext); // Delete creator resource $mockTripod->saveChanges($graph3, new \Tripod\ExtendedGraph()); $deletedGraph = $mockTripod->describeResource($creatorUri); $this->assertTrue($deletedGraph->is_empty()); // Manually walk through the tables operation /** @var \Tripod\Mongo\Composites\SearchIndexer $search */ $search = $mockTripod->getComposite(OP_SEARCH); $expectedImpactedSubjects = array(new \Tripod\Mongo\ImpactedSubject(array(_ID_RESOURCE => $uriAlias, _ID_CONTEXT => $this->defaultContext), OP_SEARCH, $this->defaultStoreName, $this->defaultPodName, array('i_search_resource')), new \Tripod\Mongo\ImpactedSubject(array(_ID_RESOURCE => $uriAlias2, _ID_CONTEXT => $this->defaultContext), OP_SEARCH, $this->defaultStoreName, $this->defaultPodName, array('i_search_resource'))); $this->assertEquals($expectedImpactedSubjects, $search->getImpactedSubjects($expectedSubjectsAndPredicatesOfChange, $this->defaultContext)); foreach ($expectedImpactedSubjects as $subject) { $search->update($subject); } $query = array(_ID_KEY => array(_ID_RESOURCE => $uriAlias, _ID_CONTEXT => $this->defaultContext, _ID_TYPE => 'i_search_resource')); $this->assertEquals(1, $collection->count($query)); $query[_ID_KEY][_ID_RESOURCE] = $uriAlias2; $this->assertEquals(1, $collection->count($query)); // Deleted resource will still be impact indexes because join still exists $impactQuery = array(_ID_KEY . '.' . _ID_TYPE => 'i_search_resource', '_impactIndex' => array(_ID_RESOURCE => $creatorUriAlias, _ID_CONTEXT => $this->defaultContext)); $this->assertEquals(2, $collection->count($impactQuery)); // But the document should have been regenerated without the value $impactQuery['result.author'] = 'Oscar Wilde'; $this->assertEquals(0, $collection->count($impactQuery)); }