AskQueryOutputInstancesTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 23
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testAsk() 0 14 1
1
<?php
2
3
/**
4
 * This file is part of the sweetrdf/InMemoryStoreSqlite package and licensed under
5
 * the terms of the GPL-2 license.
6
 *
7
 * (c) Konrad Abicht <[email protected]>
8
 * (c) Benjamin Nowack
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Tests\Integration\Store\InMemoryStoreSqlite\Query;
15
16
use simpleRdf\Literal;
17
use sweetrdf\InMemoryStoreSqlite\Store\InMemoryStoreSqlite;
18
use Tests\TestCase;
19
20
/**
21
 * Tests for query method - focus on ASK queries.
22
 *
23
 * Output format is: instances
24
 */
25
class AskQueryOutputInstancesTest extends TestCase
26
{
27
    protected function setUp(): void
28
    {
29
        parent::setUp();
30
31
        $this->subjectUnderTest = InMemoryStoreSqlite::createInstance();
32
    }
33
34
    public function testAsk()
35
    {
36
        // test data
37
        $this->subjectUnderTest->query('INSERT INTO <http://example.com/> {
38
            <http://s> <http://p1> "baz" .
39
        }');
40
41
        $sparql = 'ASK FROM <http://example.com/> {<http://s> <http://p1> ?o.}';
42
        $result = $this->subjectUnderTest->query($sparql, 'instances');
43
        $this->assertEquals(new Literal(true), $result);
44
45
        $sparql = 'ASK FROM <http://example.com/> {<http://foo> <http://bar> ?o.}';
46
        $result = $this->subjectUnderTest->query($sparql, 'instances');
47
        $this->assertEquals(new Literal(false), $result);
48
    }
49
}
50