本文整理汇总了PHP中readFixture函数的典型用法代码示例。如果您正苦于以下问题:PHP readFixture函数的具体用法?PHP readFixture怎么用?PHP readFixture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了readFixture函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Set up the test suite before each test
*/
public function setUp()
{
$this->graph = new EasyRdf_Graph();
$this->resource = $this->graph->resource('http://www.example.com/');
$this->parser = new MockParser();
$this->data = readFixture('foaf.json');
}
示例2: testGetDefault
public function testGetDefault()
{
$this->client->addMock('GET', 'http://localhost:8080/data/?default', readFixture('foaf.json'));
$graph = $this->graphStore->getDefault();
$this->assertClass('EasyRdf_Graph', $graph);
$this->assertSame(null, $graph->getUri());
$this->assertStringEquals('Joe Bloggs', $graph->get('http://www.example.com/joe#me', 'foaf:name'));
}
示例3: testQueryConstructJson
public function testQueryConstructJson()
{
$this->_client->addMock('GET', '/sparql?query=CONSTRUCT+%7B%3Fs+%3Fp+%3Fo%7D+WHERE+%7B%3Fs+%3Fp+%3Fo%7D', readFixture('foaf.json'));
$graph = $this->_sparql->query("CONSTRUCT {?s ?p ?o} WHERE {?s ?p ?o}");
$this->assertType('EasyRdf_Graph', $graph);
$name = $graph->get('http://www.example.com/joe#me', 'foaf:name');
$this->assertStringEquals('Joe Bloggs', $name);
}
示例4: testParseQuery
public function testParseQuery()
{
$graph = new EasyRdf_Graph();
$graph->parse(readFixture('query/construct.ttl'), 'turtle');
$query = $graph->resource('test:construct');
$this->assertClass('EasySpinRdf_Query_Construct', $query);
$this->assertStringEquals("CONSTRUCT { ?this test:grandParent ?grandParent } WHERE { ?parent test:child ?this. ?grandParent test:child ?parent }", $query->getSparql());
}
示例5: testGetIndirect
public function testGetIndirect()
{
$this->_client->addMock('GET', 'http://localhost:8080/data/?graph=http%3A%2F%2Ffoo.com%2Fbar.rdf', readFixture('foaf.json'));
$graph = $this->_graphStore->get('http://foo.com/bar.rdf');
$this->assertType('EasyRdf_Graph', $graph);
$this->assertEquals('http://foo.com/bar.rdf', $graph->getUri());
$this->assertStringEquals('Joe Bloggs', $graph->get('http://www.example.com/joe#me', 'foaf:name'));
}
示例6: testGetHeaders
public function testGetHeaders()
{
$response = EasyRdf_Http_Response::fromString(readFixture('http_response_200'));
$this->assertEquals(8, count($response->getHeaders()), 'Header count is not as expected');
$this->assertEquals('Apache/2.2.9 (Unix) PHP/5.2.6', $response->getHeader('Server'), 'Server header is not as expected');
$this->assertEquals('text/plain', $response->getHeader('Content-Type'), 'Content-type header is not as expected');
$this->assertEquals(array('foo', 'bar'), $response->getHeader('X-Multiple'), 'Header with multiple values is not as expected');
}
示例7: testParseWithFormatObject
public function testParseWithFormatObject()
{
$data = readFixture('foaf.jsonld');
$format = EasyRdf_Format::getFormat('jsonld');
$count = $this->parser->parse($this->graph, $data, $format, null);
$this->assertSame(14, $count);
$joe = $this->graph->resource('http://www.example.com/joe#me');
$this->assertStringEquals('Joe Bloggs', $joe->get('foaf:name'));
}
示例8: setUp
public function setUp()
{
if (extension_loaded('redland')) {
$this->_parser = new EasyRdf_Parser_Redland();
$this->_graph = new EasyRdf_Graph();
$this->_data = readFixture('foaf.rdf');
} else {
$this->markTestSkipped("Redland PHP extension is not available.");
}
}
示例9: setUp
public function setUp()
{
if (requireExists('arc/ARC2.php')) {
$this->_parser = new EasyRdf_Parser_Arc();
$this->_graph = new EasyRdf_Graph();
$this->_data = readFixture('foaf.rdf');
} else {
$this->markTestSkipped("ARC2 library is not available.");
}
}
示例10: testParseSeq
public function testParseSeq()
{
$count = $this->parser->parse($this->graph, readFixture('rdf-seq.rdf'), 'rdfxml', 'http://www.w3.org/TR/REC-rdf-syntax/');
$this->assertSame(5, $count);
$favourites = $this->graph->resource('http://example.org/favourite-fruit');
$this->assertSame('rdf:Seq', $favourites->type());
$this->assertStringEquals('http://example.org/banana', $favourites->get('rdf:_1'));
$this->assertStringEquals('http://example.org/apple', $favourites->get('rdf:_2'));
$this->assertStringEquals('http://example.org/pear', $favourites->get('rdf:_3'));
$this->assertStringEquals('http://example.org/pear', $favourites->get('rdf:_4'));
}
示例11: setUp
public function setUp()
{
// FIXME: suppress stderr
// FIXME: check for rapper version 1.4.17
exec('which rapper', $output, $retval);
if ($retval == 0) {
$this->_parser = new EasyRdf_Parser_Rapper();
$this->_graph = new EasyRdf_Graph();
$this->_data = readFixture('foaf.rdf');
} else {
$this->markTestSkipped("The rapper command is not available on this system.");
}
}
示例12: setUp
public function setUp()
{
$this->graph = new EasyRdf_Graph();
$this->graph->parse(readFixture('element/triple_path.ttl'), 'turtle');
}
示例13: testLoad
public function testLoad()
{
EasyRdf_Http::setDefaultHttpClient($client = new EasyRdf_Http_MockClient());
$client->addMock('GET', 'http://example.com/foaf.json', readFixture('foaf.json'));
$graph = new EasyRdf_Graph('http://example.com/');
$resource = $graph->resource('http://example.com/foaf.json');
$resource->load();
$this->assertStringEquals('Joe Bloggs', $graph->get('http://www.example.com/joe#me', 'foaf:name'));
}
示例14: testIssue115
/**
* @see https://github.com/njh/easyrdf/issues/115
*/
public function testIssue115()
{
$triples = <<<RDF
<http://example.com/id/1> <http://www.w3.org/2000/01/rdf-schema#type> <http://example.com/ns/animals/dog> .
<http://example.com/id/2> <http://www.w3.org/2000/01/rdf-schema#type> <http://example.com/ns/animals/cat> .
<http://example.com/id/3> <http://www.w3.org/2000/01/rdf-schema#type> <http://example.com/ns/animals/bird> .
<http://example.com/id/4> <http://www.w3.org/2000/01/rdf-schema#type> <http://example.com/ns/animals/reptiles/snake> .
RDF;
EasyRdf_Namespace::set('id', 'http://example.com/id/');
EasyRdf_Namespace::set('animals', 'http://example.com/ns/animals/');
// parse graph
$graph = new EasyRdf_Graph();
$graph->parse($triples, 'ntriples');
// dump as text/turtle
$turtle = $graph->serialise('turtle');
$this->assertEquals(readFixture('turtle/gh115-nested-namespaces.ttl'), $turtle);
}
示例15: setUp
public function setUp()
{
$this->graph = new EasyRdf_Graph();
$this->parser = new EasyRdf_Parser_Ntriples();
$this->data = readFixture('foaf.nt');
}