Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request zendframework/zendframework#7476 from Maks3w/hotix…
Browse files Browse the repository at this point in the history
…/remove-evil-assertBoolean-not-boolean-values

[test] Remove evil assert boolean for not boolean values
  • Loading branch information
weierophinney committed May 4, 2015
2 parents 44838ae + ae69bea commit 96b3bd6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions test/Document/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testTransformShouldBeCalledStatically()
public function testTransformShouldReturnStringByDefault()
{
$test = Query::cssToXpath('');
$this->assertTrue(is_string($test));
$this->assertInternalType('string', $test);
}

/**
Expand All @@ -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)));
}
Expand Down Expand Up @@ -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(
Expand Down
16 changes: 8 additions & 8 deletions test/DocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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));
}
}

Expand Down Expand Up @@ -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()
Expand All @@ -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()');
}

/**
Expand All @@ -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);
}

/**
Expand Down

0 comments on commit 96b3bd6

Please sign in to comment.