Skip to content

Commit

Permalink
Merge pull request #191 from phpcr/fix-stream-handling
Browse files Browse the repository at this point in the history
fix stream assertions and avoid phpunit warnings
  • Loading branch information
dbu authored Dec 17, 2019
2 parents 541e0d8 + 59ee39f commit 5599d57
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions tests/NodeTypeManagement/NodeTypeBaseCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ public function testValidateCustomNodeType()

$node->setProperty('phpcr:class', ['x', 'y']);
$this->session->save();

$this->addToAssertionCount(1);
}

public function testRegisterNodeTypesNoUpdate()
Expand Down
2 changes: 2 additions & 0 deletions tests/Query/CharacterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ public function testQueryWithColon()
',
QueryInterface::JCR_SQL2
)->execute();

$this->addToAssertionCount(1);
}

public function testQueryWithAmpersand()
Expand Down
2 changes: 2 additions & 0 deletions tests/Writing/MixinReferenceableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,7 @@ public function testCreateReferenceInSingleTransaction()
$child1->setProperty('someref', $child2, PropertyType::REFERENCE);

$this->session->save();

$this->addToAssertionCount(1);
}
}
6 changes: 4 additions & 2 deletions tests/Writing/SetPropertyTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public function testCreateValueBinaryFromStream()
$oldSession = $this->session;
$this->saveAndRenewSession(); // either this
$oldSession->logout(); // or this should close the stream
$this->assertNotInternalType('resource', $stream, 'The responsibility for the stream goes into phpcr who must close it');
// phpunit assertNotInternalType type still considers the closed stream a resource
$this->assertFalse(\is_resource($stream), 'The responsibility for the stream goes into phpcr who must close it');

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

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

0 comments on commit 5599d57

Please sign in to comment.