Skip to content

Commit 5599d57

Browse files
authored
Merge pull request #191 from phpcr/fix-stream-handling
fix stream assertions and avoid phpunit warnings
2 parents 541e0d8 + 59ee39f commit 5599d57

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

tests/NodeTypeManagement/NodeTypeBaseCase.php

+2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ public function testValidateCustomNodeType()
148148

149149
$node->setProperty('phpcr:class', ['x', 'y']);
150150
$this->session->save();
151+
152+
$this->addToAssertionCount(1);
151153
}
152154

153155
public function testRegisterNodeTypesNoUpdate()

tests/Query/CharacterTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ public function testQueryWithColon()
120120
',
121121
QueryInterface::JCR_SQL2
122122
)->execute();
123+
124+
$this->addToAssertionCount(1);
123125
}
124126

125127
public function testQueryWithAmpersand()

tests/Writing/MixinReferenceableTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -219,5 +219,7 @@ public function testCreateReferenceInSingleTransaction()
219219
$child1->setProperty('someref', $child2, PropertyType::REFERENCE);
220220

221221
$this->session->save();
222+
223+
$this->addToAssertionCount(1);
222224
}
223225
}

tests/Writing/SetPropertyTypesTest.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ public function testCreateValueBinaryFromStream()
8282
$oldSession = $this->session;
8383
$this->saveAndRenewSession(); // either this
8484
$oldSession->logout(); // or this should close the stream
85-
$this->assertNotInternalType('resource', $stream, 'The responsibility for the stream goes into phpcr who must close it');
85+
// phpunit assertNotInternalType type still considers the closed stream a resource
86+
$this->assertFalse(\is_resource($stream), 'The responsibility for the stream goes into phpcr who must close it');
8687

8788
$bin = $this->session->getProperty('/tests_general_base/numberPropertyNode/jcr:content/newBinaryStream');
8889
$this->assertEquals(PropertyType::BINARY, $bin->getType());
@@ -102,7 +103,8 @@ public function testCreateValueBinaryFromStreamAndRead()
102103
$oldSession = $this->session;
103104
$this->saveAndRenewSession(); // either this
104105
$oldSession->logout(); // or this should close the stream
105-
$this->assertNotInternalType('resource', $stream, 'The responsibility for the stream goes into phpcr who must close it');
106+
// phpunit assertNotInternalType type still considers the closed stream a resource
107+
$this->assertFalse(\is_resource($stream), 'The responsibility for the stream goes into phpcr who must close it');
106108

107109
$bin = $this->session->getProperty('/tests_general_base/numberPropertyNode/jcr:content/newBinaryStream');
108110
$this->assertEquals(PropertyType::BINARY, $bin->getType());

0 commit comments

Comments
 (0)