diff --git a/test/Document/QueryTest.php b/test/Document/QueryTest.php index 888eb68..e34aa05 100644 --- a/test/Document/QueryTest.php +++ b/test/Document/QueryTest.php @@ -26,7 +26,7 @@ public function testTransformShouldBeCalledStatically() public function testTransformShouldReturnStringByDefault() { $test = Query::cssToXpath(''); - $this->assertTrue(is_string($test)); + $this->assertInternalType('string', $test); } /** @@ -35,7 +35,7 @@ public function testTransformShouldReturnStringByDefault() public function testTransformShouldReturnMultiplePathsWhenExpressionContainsCommas() { $test = Query::cssToXpath('#foo, #bar'); - $this->assertTrue(is_string($test)); + $this->assertInternalType('string', $test); $this->assertContains('|', $test); $this->assertEquals(2, count(explode('|', $test))); } @@ -77,7 +77,7 @@ public function testTransformShouldWriteChildSelectorsAsAbsoluteXpathRelations() public function testMultipleComplexCssSpecificationShouldTransformToExpectedXpath() { $test = Query::cssToXpath('div#foo span.bar, #bar li.baz a'); - $this->assertTrue(is_string($test)); + $this->assertInternalType('string', $test); $this->assertContains('|', $test); $actual = explode('|', $test); $expected = array( diff --git a/test/DocumentTest.php b/test/DocumentTest.php index e31d1ea..992e2e0 100644 --- a/test/DocumentTest.php +++ b/test/DocumentTest.php @@ -132,20 +132,20 @@ public function testgetDomMethodShouldReturnDomDocumentWithStringDocumentInConst { $html = $this->getHtml(); $document = new Document($html); - $this->assertTrue($document->getDomDocument() instanceof \DOMDocument); + $this->assertInstanceOf('DOMDocument', $document->getDomDocument()); } public function testgetDomMethodShouldReturnDomDocumentWithStringDocumentSetFromMethod() { $this->loadHtml(); - $this->assertTrue($this->document->getDomDocument() instanceof \DOMDocument); + $this->assertInstanceOf('DOMDocument', $this->document->getDomDocument()); } public function testQueryShouldReturnResultObject() { $this->loadHtml(); $result = Document\Query::execute('.foo', $this->document, Document\Query::TYPE_CSS); - $this->assertTrue($result instanceof Document\NodeList); + $this->assertInstanceOf('Zend\Dom\Document\NodeList', $result); } public function testResultShouldIndicateNumberOfFoundNodes() @@ -161,7 +161,7 @@ public function testResultShouldAllowIteratingOverFoundNodes() $result = Document\Query::execute('.foo', $this->document, Document\Query::TYPE_CSS); $this->assertEquals(3, count($result)); foreach ($result as $node) { - $this->assertTrue($node instanceof \DOMNode, var_export($result, 1)); + $this->assertInstanceOf('DOMNode', $node, var_export($result, true)); } } @@ -208,7 +208,7 @@ public function testXpathPhpFunctionsShouldBeDisabledByDefault() } catch (\Exception $e) { return; } - $this->assertTrue(false, 'XPath PHPFunctions should be disabled by default'); + $this->fail('XPath PHPFunctions should be disabled by default'); } public function testXpathPhpFunctionsShouldBeEnabledWithoutParameter() @@ -232,7 +232,7 @@ public function testXpathPhpFunctionsShouldBeNotCalledWhenSpecifiedFunction() // $e->getMessage() - Not allowed to call handler 'strtolower() return; } - $this->assertTrue(false, 'Not allowed to call handler strtolower()'); + $this->fail('Not allowed to call handler strtolower()'); } /** @@ -244,8 +244,8 @@ public function testLoadingDocumentWithErrorsShouldNotRaisePhpErrors() $this->document = new Document($file); $result = Document\Query::execute('p', $this->document, Document\Query::TYPE_CSS); $errors = $this->document->getErrors(); - $this->assertTrue(is_array($errors)); - $this->assertTrue(0 < count($errors)); + $this->assertInternalType('array', $errors); + $this->assertNotEmpty($errors); } /**