-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathEncodingTest.php
More file actions
82 lines (72 loc) · 2.31 KB
/
Copy pathEncodingTest.php
File metadata and controls
82 lines (72 loc) · 2.31 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?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\Writing;
/**
* Test javax.jcr.Node read methods (read) §5.6
* With special characters.
*/
class EncodingTest extends \PHPCR\Test\BaseCase
{
public static function setupBeforeClass($fixtures = '10_Writing/encoding')
{
parent::setupBeforeClass($fixtures);
}
public function setUp()
{
parent::setUp();
// because of the data provider the signature will not match
$this->node = $this->rootNode->getNode('tests_write_encoding')->getNode('testEncoding');
}
/**
* @dataProvider getNodeNames
*/
public function testEncoding($name)
{
$node = $this->node->addNode($name);
$this->assertInstanceOf('PHPCR\NodeInterface', $node);
$session = $this->saveAndRenewSession();
$node = $session->getNode('/tests_write_encoding/testEncoding');
$this->assertTrue($node->hasNode($name));
$this->assertInstanceOf('PHPCR\NodeInterface', $node->getNode($name));
}
public static function getNodeNames()
{
return array(
array('node-ä-x'),
array('node-è-x'),
array('node-ï-x'),
array('node-%-x'),
array('node-%2F-x'),
array('node-;-x'),
array('node- -x'),
array('node-ç-x'),
array('node-&-x'),
);
}
/**
* @dataProvider getPropertyValues
*/
public function testEncodingPropertyValues($value, $type)
{
$this->node->setProperty($type, $value);
$session = $this->saveAndRenewSession();
$this->assertEquals($value, $session->getRootNode()->getNode('tests_write_encoding')->getNode('testEncoding')->getPropertyValue($type));
}
public static function getPropertyValues()
{
return array(
array('PHPCR\Query\QueryInterface', 'backslash'),
array('PHPCR\\\\Query\\\\QueryInterface', 'doublebackslash'),
array('"\'', 'quotes'),
array('a\\\'\\\'b\\\'\\\'c', 'quotesandbackslash'),
array('foo & bar&baz', 'ampersand'),
);
}
}