Skip to content

Commit 2aeb5e1

Browse files
committed
cleaning tests to use the provided member variables
1 parent 7753ab5 commit 2aeb5e1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+570
-638
lines changed

tests/04_Connecting/SessionReadMethodsTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ class SessionReadMethodsTest extends \PHPCR\Test\BaseCase
1919
//4.4.3
2020
public function testGetRepository()
2121
{
22-
$rep = $this->sharedFixture['session']->getRepository();
22+
$rep = $this->session->getRepository();
2323
$this->assertInstanceOf('PHPCR\RepositoryInterface', $rep);
2424
}
2525

2626
//4.4.1
2727
public function testGetUserId()
2828
{
29-
$user = $this->sharedFixture['session']->getUserId();
29+
$user = $this->session->getUserId();
3030
$this->assertEquals(self::$loader->getUserId(), $user);
3131
}
3232

@@ -59,7 +59,7 @@ public function testGetAttribute()
5959
//4.5.1
6060
public function testGetWorkspace()
6161
{
62-
$workspace = $this->sharedFixture['session']->getWorkspace();
62+
$workspace = $this->session->getWorkspace();
6363
$this->assertInstanceOf('PHPCR\WorkspaceInterface', $workspace);
6464
}
6565
}

tests/04_Connecting/WorkspaceReadMethodsTest.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace PHPCR\Tests\Connecting;
33

4+
use PHPCR\WorkspaceInterface;
5+
46
require_once(__DIR__ . '/../../inc/BaseCase.php');
57

68
/** test javax.jcr.Workspace read methods (read)
@@ -13,20 +15,23 @@
1315
class WorkspaceReadMethodsTest extends \PHPCR\Test\BaseCase
1416
{
1517
protected $path = 'read/read';
18+
/**
19+
* @var WorkspaceInterface
20+
*/
1621
protected $workspace;
1722

1823
//4.5 Workspace Read Methods
1924

2025
public function setUp()
2126
{
2227
parent::setUp();
23-
$this->workspace = $this->sharedFixture['session']->getWorkspace();
28+
$this->workspace = $this->session->getWorkspace();
2429
}
2530

2631
//4.5.2
2732
public function testGetSession()
2833
{
29-
$this->assertEquals($this->sharedFixture['session'], $this->workspace->getSession());
34+
$this->assertEquals($this->session, $this->workspace->getSession());
3035
}
3136

3237
//4.5.3
@@ -42,7 +47,7 @@ public function testGetQueryManager()
4247
}
4348

4449
/**
45-
* @expectedException PHPCR\RepositoryException
50+
* @expectedException \PHPCR\RepositoryException
4651
*/
4752
public function testGetQueryManagerRepositoryException()
4853
{
@@ -56,7 +61,7 @@ public function testGetNamespaceRegistry()
5661
}
5762

5863
/**
59-
* @expectedException PHPCR\RepositoryException
64+
* @expectedException \PHPCR\RepositoryException
6065
*/
6166
public function testGetNamespaceRegistryRepositoryException()
6267
{
@@ -70,7 +75,7 @@ public function testGetNodeTypeManager()
7075
}
7176

7277
/**
73-
* @expectedException PHPCR\RepositoryException
78+
* @expectedException \PHPCR\RepositoryException
7479
*/
7580
public function testGetNodeTypeManagerRepositoryException()
7681
{
@@ -86,7 +91,7 @@ public function testGetAccessibleWorkspaceNames()
8691
}
8792

8893
/**
89-
* @expectedException PHPCR\RepositoryException
94+
* @expectedException \PHPCR\RepositoryException
9095
*/
9196
public function testGetAccessibleWorkspaceNamesRepositoryException()
9297
{

tests/05_Reading/BinaryReadMethodsTest.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace PHPCR\Tests\Reading;
33

4+
use PHPCR\PropertyInterface;
5+
46
require_once(__DIR__ . '/../../inc/BaseCase.php');
57

68
// According to PHPCR\BinaryInterface
@@ -10,7 +12,8 @@
1012
*/
1113
class BinaryReadMethodsTest extends \PHPCR\Test\BaseCase
1214
{
13-
protected $node;
15+
/** @var PropertyInterface */
16+
private $binaryProperty;
1417
private $decodedstring = 'h1. Chapter 1 Title
1518
1619
* foo
@@ -32,7 +35,7 @@ class BinaryReadMethodsTest extends \PHPCR\Test\BaseCase
3235
public function setUp()
3336
{
3437
parent::setUp();
35-
$this->node = $this->sharedFixture['session']->getRootNode()->getNode('tests_general_base/numberPropertyNode/jcr:content');
38+
$this->node = $this->session->getRootNode()->getNode('tests_general_base/numberPropertyNode/jcr:content');
3639
$this->binaryProperty = $this->node->getProperty('jcr:data');
3740
$this->assertEquals(\PHPCR\PropertyType::BINARY, $this->binaryProperty->getType());
3841
}
@@ -77,7 +80,7 @@ public function testGetLength()
7780

7881
public function testReadBinaryValues()
7982
{
80-
$node = $this->sharedFixture['session']->getRootNode()->getNode('tests_general_base/index.txt/jcr:content');
83+
$node = $this->session->getRootNode()->getNode('tests_general_base/index.txt/jcr:content');
8184
$binaryMulti = $node->getProperty('multidata');
8285
$this->assertTrue($binaryMulti->isMultiple());
8386
$this->assertEquals(\PHPCR\PropertyType::BINARY, $binaryMulti->getType());
@@ -91,7 +94,7 @@ public function testReadBinaryValues()
9194

9295
public function testReadBinaryValuesAsString()
9396
{
94-
$node = $this->sharedFixture['session']->getRootNode()->getNode('tests_general_base/index.txt/jcr:content');
97+
$node = $this->session->getRootNode()->getNode('tests_general_base/index.txt/jcr:content');
9598
$binaryMulti = $node->getProperty('multidata');
9699
$this->assertTrue($binaryMulti->isMultiple());
97100
$this->assertEquals(\PHPCR\PropertyType::BINARY, $binaryMulti->getType());
@@ -105,7 +108,7 @@ public function testReadBinaryValuesAsString()
105108

106109
public function testGetLengthMultivalue()
107110
{
108-
$node = $this->sharedFixture['session']->getRootNode()->getNode('tests_general_base/index.txt/jcr:content');
111+
$node = $this->session->getRootNode()->getNode('tests_general_base/index.txt/jcr:content');
109112
$binaryMulti = $node->getProperty('multidata');
110113
$sizes = $binaryMulti->getLength();
111114
$this->assertInternalType('array', $sizes);

tests/05_Reading/NodeReadMethodsTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public function testGetPropertiesNameGlobs()
359359

360360
public function testGetPropertiesValuesAll()
361361
{
362-
$node = $this->sharedFixture['session']->getNode('/tests_general_base/idExample/jcr:content/weakreference_source1');
362+
$node = $this->session->getNode('/tests_general_base/idExample/jcr:content/weakreference_source1');
363363
$props = $node->getPropertiesValues();
364364
$this->assertInternalType('array', $props);
365365
$this->assertArrayHasKey('ref1', $props);
@@ -368,7 +368,7 @@ public function testGetPropertiesValuesAll()
368368

369369
public function testGetPropertiesValuesAllNoDereference()
370370
{
371-
$node = $this->sharedFixture['session']->getNode('/tests_general_base/idExample/jcr:content/weakreference_source1');
371+
$node = $this->session->getNode('/tests_general_base/idExample/jcr:content/weakreference_source1');
372372
$props = $node->getPropertiesValues(null,false);
373373
$this->assertInternalType('array', $props);
374374
$this->assertArrayHasKey('ref1', $props);
@@ -377,7 +377,7 @@ public function testGetPropertiesValuesAllNoDereference()
377377

378378
public function testGetPropertiesValuesGlob()
379379
{
380-
$node = $this->sharedFixture['session']->getNode('/tests_general_base/idExample/jcr:content/weakreference_source1');
380+
$node = $this->session->getNode('/tests_general_base/idExample/jcr:content/weakreference_source1');
381381
$props = $node->getPropertiesValues("jcr:*");
382382
$this->assertInternalType('array', $props);
383383
/*

tests/05_Reading/SessionNamespaceRemappingTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ public function testSetNamespacePrefix()
3636
*/
3737
public function testSetNamespacePrefixXml()
3838
{
39-
$this->sharedFixture['session']->setNamespacePrefix('xmlwhatever', 'http://www.jcp.org/jcr/mix/1.0');
39+
$this->session->setNamespacePrefix('xmlwhatever', 'http://www.jcp.org/jcr/mix/1.0');
4040
}
4141

4242
public function testGetNamespacePrefixes()
4343
{
44-
$ret = $this->sharedFixture['session']->getNamespacePrefixes();
44+
$ret = $this->session->getNamespacePrefixes();
4545
$this->assertInternalType('array', $ret);
4646
foreach ($this->nsBuiltIn as $prefix => $uri) {
4747
$this->assertContains($prefix, $ret);
@@ -50,7 +50,7 @@ public function testGetNamespacePrefixes()
5050

5151
public function testGetNamespaceURI()
5252
{
53-
$ret = $this->sharedFixture['session']->getNamespaceURI('jcr');
53+
$ret = $this->session->getNamespaceURI('jcr');
5454
$this->assertEquals($this->nsBuiltIn['jcr'], $ret);
5555
}
5656

@@ -59,12 +59,12 @@ public function testGetNamespaceURI()
5959
*/
6060
public function testGetNamespaceURINonExistent()
6161
{
62-
$this->sharedFixture['session']->getNamespaceURI('http://nonexistent/2.0');
62+
$this->session->getNamespaceURI('http://nonexistent/2.0');
6363
}
6464

6565
public function testGetNamespacePrefix()
6666
{
67-
$ret = $this->sharedFixture['session']->getNamespacePrefix($this->nsBuiltIn['jcr']);
67+
$ret = $this->session->getNamespacePrefix($this->nsBuiltIn['jcr']);
6868
$this->assertEquals('jcr', $ret);
6969
}
7070

@@ -73,6 +73,6 @@ public function testGetNamespacePrefix()
7373
*/
7474
public function testGetNamespacePrefixNonExistent()
7575
{
76-
$this->sharedFixture['session']->getNamespacePrefix('nonexistent');
76+
$this->session->getNamespacePrefix('nonexistent');
7777
}
7878
}

0 commit comments

Comments
 (0)