-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathQueryBaseCase.php
More file actions
65 lines (57 loc) · 1.92 KB
/
Copy pathQueryBaseCase.php
File metadata and controls
65 lines (57 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/*
* This file is part of the PHPCR API Tests package
*
* Copyright (c) 2015 Liip and others
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPCR\Tests\Query;
/**
* a base class for all query tests.
*/
abstract class QueryBaseCase extends \PHPCR\Test\BaseCase
{
/**
* @var \PHPCR\Query\QueryInterface
*/
protected $query;
/**
* The results to be expected in $this->query.
*
* @var array
*/
protected $resultPaths;
/**
* in addition to base stuff, prepare the query manager and load general/query fixture.
*
* @param string $fixture name of the fixture to load, defaults to general/base
*/
public static function setupBeforeClass($fixture = 'general/base')
{
parent::setupBeforeClass($fixture);
self::$staticSharedFixture['qm'] = self::$staticSharedFixture['session']->getWorkspace()->getQueryManager();
}
/**
* in addition to base stuff, prepare $this->query with a simple select query.
*/
public function setUp()
{
parent::setUp();
$this->query = $this->sharedFixture['qm']->createQuery('
SELECT *
FROM [nt:folder]
WHERE ISDESCENDANTNODE([/tests_general_base])
OR ISSAMENODE([/tests_general_base])
',
\PHPCR\Query\QueryInterface::JCR_SQL2
);
// the query result is not ordered, but these are the nodes that are to be expected in any order
$this->resultPaths = array('/tests_general_base',
'/tests_general_base/test:namespacedNode',
'/tests_general_base/emptyExample',
'/tests_general_base/multiValueProperty/deepnode',
'/tests_general_base/multiValueProperty', );
}
}