AskQueryTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testAskDefaultGraph() 0 14 1
A testAskGraphSpecified() 0 14 1
A setUp() 0 5 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 sweetrdf\InMemoryStoreSqlite\Store\InMemoryStoreSqlite;
17
use Tests\TestCase;
18
19
/**
20
 * Tests for query method - focus on ASK queries.
21
 */
22
class AskQueryTest extends TestCase
23
{
24
    protected function setUp(): void
25
    {
26
        parent::setUp();
27
28
        $this->subjectUnderTest = InMemoryStoreSqlite::createInstance();
29
    }
30
31
    public function testAskDefaultGraph()
32
    {
33
        // test data
34
        $this->subjectUnderTest->query('INSERT INTO <http://example.com/> {
35
            <http://s> <http://p1> "baz" .
36
        }');
37
38
        $res = $this->subjectUnderTest->query('ASK {<http://s> <http://p1> ?o.}');
39
        $this->assertEquals(
40
            [
41
                'query_type' => 'ask',
42
                'result' => true,
43
            ],
44
            $res
45
        );
46
    }
47
48
    public function testAskGraphSpecified()
49
    {
50
        // test data
51
        $this->subjectUnderTest->query('INSERT INTO <http://example.com/> {
52
            <http://s> <http://p1> "baz" .
53
        }');
54
55
        $res = $this->subjectUnderTest->query('ASK FROM <http://example.com/> {<http://s> <http://p1> ?o.}');
56
        $this->assertEquals(
57
            [
58
                'query_type' => 'ask',
59
                'result' => true,
60
            ],
61
            $res
62
        );
63
    }
64
}
65