Пример #1
0
 public function rawXmlResultDocumentProvider()
 {
     $rawResultProvider = new FakeRawResultProvider();
     #0
     $provider[] = array($rawResultProvider->getUriResourceSparqlResultXml(), new ExpResource('http://example.org/id/Foo'));
     #1
     $provider[] = array($rawResultProvider->getEmptySparqlResultXml(), null);
     #2 @bug 62218
     $provider[] = array($rawResultProvider->getNonTypeLiteralResultXml(), new ExpLiteral('Has foo'));
     #3
     $provider[] = array($rawResultProvider->getBooleanSparqlResultXml(), new ExpLiteral('true', 'http://www.w3.org/2001/XMLSchema#boolean'));
     #4
     $provider[] = array($rawResultProvider->getStringTypeLiteralSparqlResultXml(), new ExpLiteral('Foo', 'http://www.w3.org/2001/XMLSchema#string'));
     #5
     $provider[] = array($rawResultProvider->getIntegerTypeLiteralSparqlResultXml(), new ExpLiteral('1', 'http://www.w3.org/2001/XMLSchema#integer'));
     #6
     $provider[] = array($rawResultProvider->getMixedRowsSparqlResultXml(), array(new ExpResource('http://example.org/id/Foo'), new ExpResource('http://example.org/id/Bar'), new ExpLiteral('Quux', 'http://www.w3.org/2001/XMLSchema#string')));
     #7 #450
     $provider[] = array(false, null);
     #8 #450
     $provider[] = array('false', null);
     #9 #626
     $provider[] = array('true', new ExpLiteral('true', 'http://www.w3.org/2001/XMLSchema#boolean'));
     return $provider;
 }
 /**
  * @dataProvider httpDatabaseConnectorInstanceNameForAskProvider
  *
  * @see https://www.w3.org/TR/rdf-sparql-query/#ask
  */
 public function testAskToQueryEndpointOnMockedHttpRequest($httpDatabaseConnector, $expectedPostField)
 {
     $rawResultProvider = new FakeRawResultProvider();
     $httpRequest = $this->getMockBuilder('\\Onoi\\HttpRequest\\HttpRequest')->disableOriginalConstructor()->getMock();
     $httpRequest->expects($this->at(8))->method('setOption')->with($this->equalTo(CURLOPT_POSTFIELDS), $this->stringContains($expectedPostField))->will($this->returnValue(true));
     $httpRequest->expects($this->once())->method('execute')->will($this->returnValue($rawResultProvider->getEmptySparqlResultXml()));
     $instance = new $httpDatabaseConnector(new RepositoryClient('http://foo/myDefaultGraph', 'http://localhost:9999/query'), $httpRequest);
     $repositoryResult = $instance->ask('?x foaf:name "Foo"', array('foaf' => 'http://xmlns.com/foaf/0.1/>'));
     $this->assertInstanceOf('\\SMW\\SPARQLStore\\QueryEngine\\RepositoryResult', $repositoryResult);
 }