From ebc9a8af538c392435d39b85426c43f1a0bceb71 Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Wed, 28 Feb 2018 05:20:34 -0300 Subject: [PATCH] Improve assertions --- tests/NodeTypeDiscovery/NodeDefinitionTest.php | 8 ++++---- tests/Observation/ObservationManagerTest.php | 2 +- tests/PhpcrUtils/CndParserTest.php | 12 ++++++------ tests/Query/NodeViewTest.php | 2 +- tests/Query/QOM/QomToSql2ConverterTest.php | 2 +- tests/Query/QOM/Sql2ToQomConverterTest.php | 2 +- tests/Query/QueryResultsTest.php | 4 ++-- tests/Query/RowIteratorTest.php | 2 +- tests/Query/RowTest.php | 2 +- tests/Reading/BinaryReadMethodsTest.php | 16 ++++++++-------- tests/Reading/NodeReadMethodsTest.php | 6 +++--- tests/Reading/PropertyReadMethodsTest.php | 6 +++--- tests/Reading/SessionReadMethodsTest.php | 16 ++++++++-------- tests/Versioning/VersionHistoryTest.php | 14 +++++++------- tests/Writing/CopyMethodsTest.php | 16 ++++++++-------- tests/Writing/MixinCreatedTest.php | 4 ++-- tests/Writing/NamespaceRegistryTest.php | 6 +++--- .../Writing/SetPropertyDynamicRebindingTest.php | 4 ++-- tests/Writing/SetPropertyTypesTest.php | 8 ++++---- 19 files changed, 66 insertions(+), 66 deletions(-) diff --git a/tests/NodeTypeDiscovery/NodeDefinitionTest.php b/tests/NodeTypeDiscovery/NodeDefinitionTest.php index 063c02b2..63a01d3f 100644 --- a/tests/NodeTypeDiscovery/NodeDefinitionTest.php +++ b/tests/NodeTypeDiscovery/NodeDefinitionTest.php @@ -108,24 +108,24 @@ public function getRequiredPrimaryTypeNames() { $names = $this->content->getRequiredPrimaryTypeNames(); $this->assertInternalType('array', $names); - $this->assertTrue(1, count($names)); + $this->assertCount(1, $names); $this->assertEquals('nt:base', $names[0]); $names = $this->hierarchyNodeDef->getRequiredPrimaryTypeNames(); $this->assertInternalType('array', $names); - $this->assertTrue(1, count($names)); + $this->assertCount(1, $names); $this->assertEquals('nt:hierarchyNode', $names[0]); } public function getRequiredPrimaryTypes() { $types = $this->content->getRequiredPrimaryTypeNames(); $this->assertInternalType('array', $types); - $this->assertTrue(1, count($types)); + $this->assertCount(1, $types); $this->assertEquals(self::$base, $types[0]); $types = $this->hierarchyNodeDef->getRequiredPrimaryTypeNames(); $this->assertInternalType('array', $types); - $this->assertTrue(1, count($types)); + $this->assertCount(1, $types); $this->assertEquals(self::$hierarchyNodeType, $types[0]); } diff --git a/tests/Observation/ObservationManagerTest.php b/tests/Observation/ObservationManagerTest.php index ede1abc0..a9460cc1 100644 --- a/tests/Observation/ObservationManagerTest.php +++ b/tests/Observation/ObservationManagerTest.php @@ -242,7 +242,7 @@ protected function assertFilterOnPathDeep(ObservationManagerInterface $observati $journal->next(); // Notice the assertion is slightly different from the one in testFilterOnPathNoDeep - $this->assertTrue(substr($event->getPath(), 0, strlen($this->nodePath.'/child')) === $this->nodePath.'/child'); + $this->assertSame($this->nodePath.'/child', substr($event->getPath(), 0, strlen($this->nodePath.'/child'))); } } diff --git a/tests/PhpcrUtils/CndParserTest.php b/tests/PhpcrUtils/CndParserTest.php index caf82f40..6981a521 100644 --- a/tests/PhpcrUtils/CndParserTest.php +++ b/tests/PhpcrUtils/CndParserTest.php @@ -157,10 +157,10 @@ public function testNoStopAtEofError() { $res = $this->cndParser->parseFile(__DIR__.'/resources/cnd/no-stop-at-eof.cnd'); - $this->assertTrue(isset($res['namespaces'])); + $this->assertArrayHasKey('namespaces', $res); $this->assertEquals(['phpcr' => 'http://www.doctrine-project.org/projects/phpcr_odm'], $res['namespaces']); - $this->assertTrue(isset($res['nodeTypes'])); + $this->assertArrayHasKey('nodeTypes', $res); } public function testBigFile() @@ -169,10 +169,10 @@ public function testBigFile() $res = $this->cndParser->parseFile(__DIR__.'/resources/cnd/jackrabbit_nodetypes.cnd'); // some random sanity checks - $this->assertTrue(isset($res['nodeTypes'])); + $this->assertArrayHasKey('nodeTypes', $res); $def = $res['nodeTypes']; - $this->assertTrue(isset($def['nt:file'])); + $this->assertArrayHasKey('nt:file', $def); /** @var $parsed NodeTypeDefinitionInterface */ $parsed = $def['nt:file']; $this->assertEquals('nt:file', $parsed->getName()); @@ -190,10 +190,10 @@ public function testBigFile() */ protected function assertExampleCnd($res) { - $this->assertTrue(isset($res['namespaces'])); + $this->assertArrayHasKey('namespaces', $res); $this->assertEquals(['ns' => 'http://namespace.com/ns'], $res['namespaces']); - $this->assertTrue(isset($res['nodeTypes'])); + $this->assertArrayHasKey('nodeTypes', $res); // get first node type reset($res['nodeTypes']); /** @var $def NodeTypeDefinitionInterface */ diff --git a/tests/Query/NodeViewTest.php b/tests/Query/NodeViewTest.php index 3069c02d..e3df18c9 100644 --- a/tests/Query/NodeViewTest.php +++ b/tests/Query/NodeViewTest.php @@ -74,6 +74,6 @@ public function testCountable() $nodes[] = $node; } - $this->assertEquals(count($nodes), $this->nodeIterator->count()); + $this->assertCount($this->nodeIterator->count(), $nodes); } } diff --git a/tests/Query/QOM/QomToSql2ConverterTest.php b/tests/Query/QOM/QomToSql2ConverterTest.php index db2c6062..1f77061b 100644 --- a/tests/Query/QOM/QomToSql2ConverterTest.php +++ b/tests/Query/QOM/QomToSql2ConverterTest.php @@ -411,7 +411,7 @@ protected function assertQuery($expectedSql2, $source, $columns = [], $constrain $result = $this->parser->convert($query); if (is_array($expectedSql2)) { - $this->assertTrue(in_array($result, $expectedSql2), "The statement '$result' does not match an expected variation"); + $this->assertContains($result, $expectedSql2, "The statement '$result' does not match an expected variation"); } else { $this->assertEquals($expectedSql2, $result); } diff --git a/tests/Query/QOM/Sql2ToQomConverterTest.php b/tests/Query/QOM/Sql2ToQomConverterTest.php index 6306196d..b97f097d 100644 --- a/tests/Query/QOM/Sql2ToQomConverterTest.php +++ b/tests/Query/QOM/Sql2ToQomConverterTest.php @@ -55,7 +55,7 @@ public function testColumnsAndSelector() $this->assertEquals('nt:unstructured', $query->getSource()->getNodeTypeName()); $cols = $query->getColumns(); - $this->assertTrue(is_array($cols)); + $this->assertInternalType('array', $cols); $this->assertCount(2, $cols); $this->assertEquals('u', $cols[0]->getselectorName()); diff --git a/tests/Query/QueryResultsTest.php b/tests/Query/QueryResultsTest.php index efff4544..88e71ed7 100644 --- a/tests/Query/QueryResultsTest.php +++ b/tests/Query/QueryResultsTest.php @@ -146,7 +146,7 @@ public function testReadPropertyContentFromResults() { $seekName = '/tests_general_base/multiValueProperty'; - $this->assertTrue(count($this->qr->getNodes()) > 0); + $this->assertGreaterThan(0, count($this->qr->getNodes())); foreach ($this->qr->getNodes() as $path => $node) { if ($seekName == $path) { break; @@ -202,7 +202,7 @@ public function testCompareNumberFieldsMulti() } $this->assertCount(1, $rows); - + // returning a string value is, perhaps suprisingly, the correct behavior. $this->assertEquals('4 2 8', $rows[0]->getValue('data.longNumberToCompareMulti')); } diff --git a/tests/Query/RowIteratorTest.php b/tests/Query/RowIteratorTest.php index 86f655df..8a9973ff 100644 --- a/tests/Query/RowIteratorTest.php +++ b/tests/Query/RowIteratorTest.php @@ -79,6 +79,6 @@ public function testCountable() $rows[] = $row; } - $this->assertEquals(count($rows), $this->rowIterator->count()); + $this->assertCount($this->rowIterator->count(), $rows); } } diff --git a/tests/Query/RowTest.php b/tests/Query/RowTest.php index 8b2a99fb..213ffc96 100644 --- a/tests/Query/RowTest.php +++ b/tests/Query/RowTest.php @@ -87,7 +87,7 @@ public function testGetNode() public function testGetPath() { - $this->assertTrue(in_array($this->row->getPath(), $this->resultPaths), 'not one of the expected results'); + $this->assertContains($this->row->getPath(), $this->resultPaths, 'not one of the expected results'); } public function testGetScore() diff --git a/tests/Reading/BinaryReadMethodsTest.php b/tests/Reading/BinaryReadMethodsTest.php index 6c05a18e..26dacc08 100644 --- a/tests/Reading/BinaryReadMethodsTest.php +++ b/tests/Reading/BinaryReadMethodsTest.php @@ -55,18 +55,18 @@ public function setUp() public function testReadBinaryValue() { $binary = $this->binaryProperty->getBinary(); - $this->assertTrue(is_resource($binary)); + $this->assertInternalType('resource', $binary); $this->assertEquals($this->decodedstring, stream_get_contents($binary)); // stream must start when getting again $binary = $this->binaryProperty->getBinary(); - $this->assertTrue(is_resource($binary)); + $this->assertInternalType('resource', $binary); $this->assertEquals($this->decodedstring, stream_get_contents($binary), 'Stream must begin at start again on second read'); // stream must not be the same fclose($binary); $binary = $this->binaryProperty->getBinary(); - $this->assertTrue(is_resource($binary)); + $this->assertInternalType('resource', $binary); $this->assertEquals($this->decodedstring, stream_get_contents($binary), 'Stream must be different for each call, fclose should not matter'); } @@ -100,7 +100,7 @@ public function testReadBinaryValues() $vals = $binaryMulti->getValue(); $this->assertInternalType('array', $vals); foreach ($vals as $value) { - $this->assertTrue(is_resource($value)); + $this->assertInternalType('resource', $value); $this->assertEquals($this->decodedstring, stream_get_contents($value)); } } @@ -161,8 +161,8 @@ public function testReadEmptyBinaryMultivalue() $empty = $node->getProperty('empty_multidata'); $this->assertEquals(PropertyType::BINARY, $empty->getType()); $emptyValue = $empty->getBinary(); - $this->assertTrue(is_array($emptyValue)); - $this->assertTrue(count($emptyValue) === 0); + $this->assertInternalType('array', $emptyValue); + $this->assertCount(0, $emptyValue); } /** @@ -174,8 +174,8 @@ public function testReadSingleBinaryMultivalue() $single = $node->getProperty('single_multidata'); $this->assertEquals(PropertyType::BINARY, $single->getType()); $singleValue = $single->getBinary(); - $this->assertTrue(is_array($singleValue)); - $this->assertTrue(is_resource($singleValue[0])); + $this->assertInternalType('array', $singleValue); + $this->assertInternalType('resource', $singleValue[0]); $contents = stream_get_contents($singleValue[0]); $this->assertEquals($this->decodedstring, $contents); } diff --git a/tests/Reading/NodeReadMethodsTest.php b/tests/Reading/NodeReadMethodsTest.php index 2b9218c0..3f085fa1 100644 --- a/tests/Reading/NodeReadMethodsTest.php +++ b/tests/Reading/NodeReadMethodsTest.php @@ -496,7 +496,7 @@ public function testGetIdentifierNonReferenceable() public function testGetIndex() { $index = $this->node->getIndex(); - $this->assertTrue(is_numeric($index)); + $this->assertInternalType('numeric', $index); $this->assertEquals(1, $index); } @@ -523,7 +523,7 @@ public function testGetReferencesAll() $this->assertCount(2, $iterator, 'Wrong number of references to idExample'); foreach ($iterator as $prop) { $this->assertInstanceOf(PropertyInterface::class, $prop); - $this->assertTrue(in_array($prop, $source)); + $this->assertContains($prop, $source); } } @@ -594,7 +594,7 @@ public function testGetWeakReferencesAll() $this->assertCount(3, $iterator, 'Wrong number of weak references to weakreference_target'); foreach ($iterator as $prop) { $this->assertInstanceOf(PropertyInterface::class, $prop); - $this->assertTrue(in_array($prop, $source, true)); + $this->assertContains($prop, $source); } } diff --git a/tests/Reading/PropertyReadMethodsTest.php b/tests/Reading/PropertyReadMethodsTest.php index 10139e21..d942b8b3 100644 --- a/tests/Reading/PropertyReadMethodsTest.php +++ b/tests/Reading/PropertyReadMethodsTest.php @@ -207,7 +207,7 @@ public function testGetStringMulti() public function testGetBinary() { $bin = $this->valProperty->getBinary(); - $this->assertTrue(is_resource($bin)); + $this->assertInternalType('resource', $bin); $str = $this->valProperty->getString(); $this->assertEquals($str, stream_get_contents($bin)); $this->assertEquals($this->valProperty->getLength(), strlen($str)); @@ -215,7 +215,7 @@ public function testGetBinary() $prop = $this->node->getProperty('index.txt/jcr:content/jcr:data'); $this->assertEquals(PropertyType::BINARY, $prop->getType(), 'Expected binary type'); $bin = $prop->getValue(); - $this->assertTrue(is_resource($bin)); + $this->assertInternalType('resource', $bin); $this->assertNotNull(stream_get_contents($bin)); fclose($bin); } @@ -227,7 +227,7 @@ public function testGetBinaryMulti() $arr = $prop->getValue(); $this->assertInternalType('array', $arr); foreach ($arr as $bin) { - $this->assertTrue(is_resource($bin)); + $this->assertInternalType('resource', $bin); $this->assertNotNull(stream_get_contents($bin)); } } diff --git a/tests/Reading/SessionReadMethodsTest.php b/tests/Reading/SessionReadMethodsTest.php index b5f9d337..3ea13589 100644 --- a/tests/Reading/SessionReadMethodsTest.php +++ b/tests/Reading/SessionReadMethodsTest.php @@ -93,8 +93,8 @@ public function testGetNodes() ]); $this->assertCount(2, $nodes); - $this->assertTrue(isset($nodes['/tests_general_base'])); - $this->assertTrue(isset($nodes['/tests_general_base/numberPropertyNode'])); + $this->assertArrayHasKey('/tests_general_base', $nodes); + $this->assertArrayHasKey('/tests_general_base/numberPropertyNode', $nodes); foreach ($nodes as $key => $node) { $this->assertInstanceOf(NodeInterface::class, $node); @@ -115,8 +115,8 @@ public function testGetNodesTraversable() ])); $this->assertCount(2, $nodes); - $this->assertTrue(isset($nodes['/tests_general_base'])); - $this->assertTrue(isset($nodes['/tests_general_base/numberPropertyNode'])); + $this->assertArrayHasKey('/tests_general_base', $nodes); + $this->assertArrayHasKey('/tests_general_base/numberPropertyNode', $nodes); foreach ($nodes as $key => $node) { $this->assertInstanceOf(NodeInterface::class, $node); @@ -169,8 +169,8 @@ public function testGetProperties() '/tests_general_base/../not_existing/jcr:primaryType', ]); $this->assertCount(2, $properties); - $this->assertTrue(isset($properties['/tests_general_base/jcr:primaryType'])); - $this->assertTrue(isset($properties['/tests_general_base/numberPropertyNode/jcr:primaryType'])); + $this->assertArrayHasKey('/tests_general_base/jcr:primaryType', $properties); + $this->assertArrayHasKey('/tests_general_base/numberPropertyNode/jcr:primaryType', $properties); foreach ($properties as $key => $property) { $this->assertInstanceOf(PropertyInterface::class, $property); $this->assertEquals($key, $property->getPath()); @@ -186,8 +186,8 @@ public function testGetPropertiesTraversable() '/tests_general_base/../not_existing/jcr:primaryType', ])); $this->assertCount(2, $properties); - $this->assertTrue(isset($properties['/tests_general_base/jcr:primaryType'])); - $this->assertTrue(isset($properties['/tests_general_base/numberPropertyNode/jcr:primaryType'])); + $this->assertArrayHasKey('/tests_general_base/jcr:primaryType', $properties); + $this->assertArrayHasKey('/tests_general_base/numberPropertyNode/jcr:primaryType', $properties); foreach ($properties as $key => $property) { $this->assertInstanceOf(PropertyInterface::class, $property); $this->assertEquals($key, $property->getPath()); diff --git a/tests/Versioning/VersionHistoryTest.php b/tests/Versioning/VersionHistoryTest.php index 9e74c891..4d3d2429 100644 --- a/tests/Versioning/VersionHistoryTest.php +++ b/tests/Versioning/VersionHistoryTest.php @@ -402,15 +402,15 @@ public function testGetVersionLabels() $version = $history->getVersion('1.0'); $labels = $history->getVersionLabels($version); - $this->assertEquals(2, count($labels)); - $this->assertTrue(in_array('stable', $labels)); - $this->assertTrue(in_array('labelname', $labels)); + $this->assertCount(2, $labels); + $this->assertContains('stable', $labels); + $this->assertContains('labelname', $labels); $labels = $history->getVersionLabels(); - $this->assertEquals(3, count($labels)); - $this->assertTrue(in_array('stable', $labels)); - $this->assertTrue(in_array('labelname', $labels)); - $this->assertTrue(in_array('anotherlabelname', $labels)); + $this->assertCount(3, $labels); + $this->assertContains('stable', $labels); + $this->assertContains('labelname', $labels); + $this->assertContains('anotherlabelname', $labels); } /** diff --git a/tests/Writing/CopyMethodsTest.php b/tests/Writing/CopyMethodsTest.php index c0e01ebf..a947eacb 100644 --- a/tests/Writing/CopyMethodsTest.php +++ b/tests/Writing/CopyMethodsTest.php @@ -275,8 +275,8 @@ public function testCopyChildrenBinaryData() $srcVal = $srcProp->getBinary(); $dstVal = $dstProp->getBinary(); - $this->assertTrue(is_resource($srcVal), 'Failed to get src binary stream'); - $this->assertTrue(is_resource($dstVal), 'Failed to get dst binary stream'); + $this->assertInternalType('resource', $srcVal, 'Failed to get src binary stream'); + $this->assertInternalType('resource', $dstVal, 'Failed to get dst binary stream'); $this->assertEquals(stream_get_contents($srcVal), stream_get_contents($dstVal)); } @@ -303,13 +303,13 @@ public function testCopyChildrenBinaryDataMultivalue() $srcVal = $srcProp->getValue(); $dstVal = $dstProp->getValue(); - $this->assertTrue(is_array($srcVal), 'Failed to get src value'); - $this->assertTrue(is_array($dstVal), 'Failed to get dst value'); + $this->assertInternalType('array', $srcVal, 'Failed to get src value'); + $this->assertInternalType('array', $dstVal, 'Failed to get dst value'); - $this->assertTrue(is_resource($srcVal[0])); - $this->assertTrue(is_resource($srcVal[1])); - $this->assertTrue(is_resource($dstVal[0])); - $this->assertTrue(is_resource($dstVal[1])); + $this->assertInternalType('resource', $srcVal[0]); + $this->assertInternalType('resource', $srcVal[1]); + $this->assertInternalType('resource', $dstVal[0]); + $this->assertInternalType('resource', $dstVal[1]); $this->assertEquals(stream_get_contents($srcVal[0]), stream_get_contents($dstVal[0])); $this->assertEquals(stream_get_contents($srcVal[1]), stream_get_contents($dstVal[1])); diff --git a/tests/Writing/MixinCreatedTest.php b/tests/Writing/MixinCreatedTest.php index 9b9cbb7e..0e2ce419 100644 --- a/tests/Writing/MixinCreatedTest.php +++ b/tests/Writing/MixinCreatedTest.php @@ -48,7 +48,7 @@ public function testCreationNode() $this->assertInstanceOf(DateTime::class, $date); /* @var $date DateTime */ $diff = time() - $date->getTimestamp(); - $this->assertTrue($diff < 60 * 10, 'jcr:created should be current date as fixture was just imported: '.$date->format('c')); + $this->assertLessThan(60 * 10, $diff, 'jcr:created should be current date as fixture was just imported: '.$date->format('c')); // Re-read the node to be sure things got properly saved $this->renewSession(); @@ -59,6 +59,6 @@ public function testCreationNode() $date = $child->getPropertyValue('jcr:created'); $this->assertInstanceOf(DateTime::class, $date); $diff = time() - $date->getTimestamp(); - $this->assertTrue($diff < 60 * 10, 'jcr:created should be current date as fixture was just imported: '.$date->format('c')); + $this->assertLessThan(60 * 10, $diff, 'jcr:created should be current date as fixture was just imported: '.$date->format('c')); } } diff --git a/tests/Writing/NamespaceRegistryTest.php b/tests/Writing/NamespaceRegistryTest.php index cc812764..ac6944ef 100644 --- a/tests/Writing/NamespaceRegistryTest.php +++ b/tests/Writing/NamespaceRegistryTest.php @@ -43,14 +43,14 @@ public function testGetPrefixes() { $ret = $this->nr->getPrefixes(); $this->assertInternalType('array', $ret); - $this->assertTrue(count($ret) >= count($this->nsBuiltIn)); + $this->assertGreaterThanOrEqual(count($this->nsBuiltIn), count($ret)); } public function testGetURIs() { $ret = $this->nr->getURIs(); $this->assertInternalType('array', $ret); - $this->assertTrue(count($ret) >= count($this->nsBuiltIn)); + $this->assertGreaterThanOrEqual(count($this->nsBuiltIn), count($ret)); //we test in getURI / getPrefix if the names match } @@ -150,6 +150,6 @@ public function testIterator() $this->assertInternalType('string', $url); $this->assertEquals($url, $this->nr->getURI($prefix)); } - $this->assertTrue($results > 3, 'Not enough namespaces'); + $this->assertGreaterThan(3, $results, 'Not enough namespaces'); } } diff --git a/tests/Writing/SetPropertyDynamicRebindingTest.php b/tests/Writing/SetPropertyDynamicRebindingTest.php index 6b48035b..a7fec819 100644 --- a/tests/Writing/SetPropertyDynamicRebindingTest.php +++ b/tests/Writing/SetPropertyDynamicRebindingTest.php @@ -77,7 +77,7 @@ public function testDynamicRebinding($propName, $sourcePropType, $sourcePropValu $this->assertEquals($sourcePropValue, $prop->getValue(), 'Initial property value does not match before saving'); } else { // PHPUnit does not like to assertEquals on resources - $this->assertTrue(is_resource($prop->getValue())); + $this->assertInternalType('resource', $prop->getValue()); } // Read it from backend check it's still valid @@ -97,7 +97,7 @@ public function testDynamicRebinding($propName, $sourcePropType, $sourcePropValu $this->assertEquals($sourcePropValue, $prop->getValue(), 'Initial property value does not match after saving'); } else { // PHPUnit does not like to assertEquals on resources - $this->assertTrue(is_resource($prop->getValue())); + $this->assertInternalType('resource', $prop->getValue()); } try { diff --git a/tests/Writing/SetPropertyTypesTest.php b/tests/Writing/SetPropertyTypesTest.php index f0137787..eff7eb54 100644 --- a/tests/Writing/SetPropertyTypesTest.php +++ b/tests/Writing/SetPropertyTypesTest.php @@ -82,7 +82,7 @@ public function testCreateValueBinaryFromStream() $oldSession = $this->session; $this->saveAndRenewSession(); // either this $oldSession->logout(); // or this should close the stream - $this->assertFalse(is_resource($stream), 'The responsibility for the stream goes into phpcr who must close it'); + $this->assertNotInternalType('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()); @@ -102,7 +102,7 @@ public function testCreateValueBinaryFromStreamAndRead() $oldSession = $this->session; $this->saveAndRenewSession(); // either this $oldSession->logout(); // or this should close the stream - $this->assertFalse(is_resource($stream), 'The responsibility for the stream goes into phpcr who must close it'); + $this->assertNotInternalType('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()); @@ -185,13 +185,13 @@ public function testCreateValueBoolean() $this->assertInstanceOf(PropertyInterface::class, $value); $this->assertEquals(PropertyType::BOOLEAN, $value->getType(), 'wrong type'); $this->assertTrue($value->getBoolean(), 'boolean not true'); - $this->assertTrue($value->getString() == true, 'wrong string value'); //boolean converted to string must be true + $this->assertEquals(true, $value->getString(), 'wrong string value'); //boolean converted to string must be true $this->saveAndRenewSession(); $value = $this->session->getProperty('/tests_general_base/numberPropertyNode/jcr:content/propBoolean'); $this->assertEquals(PropertyType::BOOLEAN, $value->getType(), 'wrong type'); $this->assertTrue($value->getBoolean(), 'boolean not true'); - $this->assertTrue($value->getString() == true, 'wrong string value'); //boolean converted to string must be true + $this->assertEquals(true, $value->getString(), 'wrong string value'); //boolean converted to string must be true } public function testCreateValueNode()