Test Failed
Push — master ( d80a54...b07f16 )
by Konrad
04:15
created

InsertIntoQueryHandlerTest::getSubjectUnderTest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
/*
4
 * This file is part of the sweetrdf/InMemoryStoreSqlite package and licensed under
5
 * the terms of the GPL-3 license.
6
 *
7
 * (c) Konrad Abicht <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Tests\Integration\Store\QueryHandler;
14
15
use sweetrdf\InMemoryStoreSqlite\Log\Logger;
16
use sweetrdf\InMemoryStoreSqlite\Store\InMemoryStoreSqlite;
17
use sweetrdf\InMemoryStoreSqlite\Store\QueryHandler\InsertQueryHandler;
18
use Tests\TestCase;
19
20
class InsertIntoQueryHandlerTest extends TestCase
21
{
22
    private function getSubjectUnderTest(): InsertQueryHandler
23
    {
24
        /** @var \sweetrdf\InMemoryStoreSqlite\Log\Logger */
25
        $logger = $this->getMockBuilder(Logger::class)->disableOriginalConstructor()->getMock();
26
27
        return new InsertQueryHandler(InMemoryStoreSqlite::createInstance(), $logger);
28
    }
29
30
    public function test1()
31
    {
32
        $sut = $this->getSubjectUnderTest();
33
        $graphIri = 'http://test/';
34
35
        $sut->runQuery([
36
            'query' => [
37
                'construct_triples' => [
38
                    [
39
                        's' => 'http://www.w3.org/2009/manifest#agg05',
40
                        's_type' => 'uri',
41
                        'p' => 'http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#action',
42
                        'o' => '_:28848a60b33',
43
                        'o_type' => 'bnode',
44
                        'o_datatype' => '',
45
                        'o_lang' => '',
46
                    ],
47
                    [
48
                        's' => '_:28848a60b33',
49
                        's_type' => 'bnode',
50
                        'p' => 'http://www.w3.org/2001/sw/DataAccess/tests/test-query#query',
51
                        'o' => 'file:///var/www/html/in-memory-store-sqlite/tests/aggregates/agg05.rq',
52
                        'o_type' => 'uri',
53
                        'o_datatype' => '',
54
                        'o_lang' => '',
55
                    ],
56
                ],
57
                'target_graph' => $graphIri,
58
            ],
59
        ]);
60
61
        $query = 'SELECT * FROM <'.$graphIri.'> WHERE { ?s ?p ?o }';
62
        $result = $sut->getStore()->query($query);
63
        $this->assertCount(2, $result);
64
    }
65
}
66