Skip to content
This repository has been archived by the owner on Jan 30, 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 f82b6bb + 03a0479 commit e2d64e9
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 63 deletions.
20 changes: 10 additions & 10 deletions test/PubSubHubbub/Subscriber/CallbackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ public function setUp()
public function testCanSetHttpResponseObject()
{
$this->_callback->setHttpResponse(new HttpResponse);
$this->assertTrue($this->_callback->getHttpResponse() instanceof HttpResponse);
$this->assertInstanceOf('Zend\Feed\PubSubHubbub\HttpResponse', $this->_callback->getHttpResponse());
}

public function testCanUsesDefaultHttpResponseObject()
{
$this->assertTrue($this->_callback->getHttpResponse() instanceof HttpResponse);
$this->assertInstanceOf('Zend\Feed\PubSubHubbub\HttpResponse', $this->_callback->getHttpResponse());
}

public function testThrowsExceptionOnInvalidHttpResponseObjectSet()
Expand Down Expand Up @@ -246,7 +246,7 @@ public function testRespondsToInvalidConfirmationWith404Response()
{
unset($this->_get['hub_mode']);
$this->_callback->handle($this->_get);
$this->assertTrue($this->_callback->getHttpResponse()->getStatusCode() == 404);
$this->assertEquals(404, $this->_callback->getHttpResponse()->getStatusCode());
}

public function testRespondsToValidConfirmationWith200Response()
Expand Down Expand Up @@ -281,7 +281,7 @@ public function testRespondsToValidConfirmationWith200Response()
->will($this->returnValue(true));

$this->_callback->handle($this->_get);
$this->assertTrue($this->_callback->getHttpResponse()->getStatusCode() == 200);
$this->assertEquals(200, $this->_callback->getHttpResponse()->getStatusCode());
}

public function testRespondsToValidConfirmationWithBodyContainingHubChallenge()
Expand Down Expand Up @@ -323,7 +323,7 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge()
);

$this->_callback->handle($this->_get);
$this->assertTrue($this->_callback->getHttpResponse()->getContent() == 'abc');
$this->assertEquals('abc', $this->_callback->getHttpResponse()->getContent());
}

public function testRespondsToValidFeedUpdateRequestWith200Response()
Expand Down Expand Up @@ -356,7 +356,7 @@ public function testRespondsToValidFeedUpdateRequestWith200Response()
->will($this->returnValue(1));

$this->_callback->handle(array());
$this->assertTrue($this->_callback->getHttpResponse()->getStatusCode() == 200);
$this->assertEquals(200, $this->_callback->getHttpResponse()->getStatusCode());
}

public function testRespondsToInvalidFeedUpdateNotPostWith404Response()
Expand All @@ -368,7 +368,7 @@ public function testRespondsToInvalidFeedUpdateNotPostWith404Response()
$GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml;

$this->_callback->handle(array());
$this->assertTrue($this->_callback->getHttpResponse()->getStatusCode() == 404);
$this->assertEquals(404, $this->_callback->getHttpResponse()->getStatusCode());
}

public function testRespondsToInvalidFeedUpdateWrongMimeWith404Response()
Expand All @@ -379,7 +379,7 @@ public function testRespondsToInvalidFeedUpdateWrongMimeWith404Response()
$feedXml = file_get_contents(__DIR__ . '/_files/atom10.xml');
$GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml;
$this->_callback->handle(array());
$this->assertTrue($this->_callback->getHttpResponse()->getStatusCode() == 404);
$this->assertEquals(404, $this->_callback->getHttpResponse()->getStatusCode());
}

/**
Expand Down Expand Up @@ -420,7 +420,7 @@ public function testRespondsToInvalidFeedUpdateWrongFeedTypeForMimeWith200Respon
->will($this->returnValue(1));

$this->_callback->handle(array());
$this->assertTrue($this->_callback->getHttpResponse()->getStatusCode() == 200);
$this->assertEquals(200, $this->_callback->getHttpResponse()->getStatusCode());
}

public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader()
Expand Down Expand Up @@ -455,7 +455,7 @@ public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader()
->will($this->returnValue(1));

$this->_callback->handle(array());
$this->assertTrue($this->_callback->getHttpResponse()->getHeader('X-Hub-On-Behalf-Of') == 1);
$this->assertEquals(1, $this->_callback->getHttpResponse()->getHeader('X-Hub-On-Behalf-Of'));
}

protected function _getCleanMock($className)
Expand Down
2 changes: 1 addition & 1 deletion test/Reader/Entry/AtomStandaloneEntryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function testReaderImportOfAtomEntryDocumentReturnsEntryClass()
$object = Reader\Reader::importString(
file_get_contents($this->feedSamplePath . '/id/atom10.xml')
);
$this->assertTrue($object instanceof Reader\Entry\Atom);
$this->assertInstanceOf('Zend\Feed\Reader\Entry\Atom', $object);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions test/Reader/Entry/CommonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testGetsDomDocumentObject()
file_get_contents($this->feedSamplePath.'/atom.xml')
);
$entry = $feed->current();
$this->assertTrue($entry->getDomDocument() instanceof \DOMDocument);
$this->assertInstanceOf('DOMDocument', $entry->getDomDocument());
}

public function testGetsDomXpathObject()
Expand All @@ -44,7 +44,7 @@ public function testGetsDomXpathObject()
file_get_contents($this->feedSamplePath.'/atom.xml')
);
$entry = $feed->current();
$this->assertTrue($entry->getXpath() instanceof \DOMXPath);
$this->assertInstanceOf('DOMXPath', $entry->getXpath());
}

public function testGetsXpathPrefixString()
Expand All @@ -62,7 +62,7 @@ public function testGetsDomElementObject()
file_get_contents($this->feedSamplePath.'/atom.xml')
);
$entry = $feed->current();
$this->assertTrue($entry->getElement() instanceof \DOMElement);
$this->assertInstanceOf('DOMElement', $entry->getElement());
}

public function testSaveXmlOutputsXmlStringForEntry()
Expand All @@ -82,7 +82,7 @@ public function testGetsNamedExtension()
file_get_contents($this->feedSamplePath.'/atom.xml')
);
$entry = $feed->current();
$this->assertTrue($entry->getExtension('Atom') instanceof Extension\Atom\Entry);
$this->assertInstanceOf('Zend\Feed\Reader\Extension\Atom\Entry', $entry->getExtension('Atom'));
}

public function testReturnsNullIfExtensionDoesNotExist()
Expand Down
2 changes: 1 addition & 1 deletion test/Reader/Entry/RssTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,7 @@ public function testGetsDateModified($path, $edate)
);
$entry = $feed->current();

$this->assertTrue($edate == $entry->getDateModified());
$this->assertEquals($edate, $entry->getDateModified());
}

public function dateModifiedProvider()
Expand Down
2 changes: 1 addition & 1 deletion test/Reader/Feed/AtomSourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testGetsSourceFromEntry()
file_get_contents($this->feedSamplePath.'/title/atom10.xml')
);
$source = $feed->current()->getSource();
$this->assertTrue($source instanceof Reader\Feed\Atom\Source);
$this->assertInstanceOf('Zend\Feed\Reader\Feed\Atom\Source', $source);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions test/Reader/Feed/CommonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,31 @@ public function testGetsDomDocumentObject()
$feed = Reader\Reader::importString(
file_get_contents($this->feedSamplePath.'/atom.xml')
);
$this->assertTrue($feed->getDomDocument() instanceof \DOMDocument);
$this->assertInstanceOf('DOMDocument', $feed->getDomDocument());
}

public function testGetsDomXpathObject()
{
$feed = Reader\Reader::importString(
file_get_contents($this->feedSamplePath.'/atom.xml')
);
$this->assertTrue($feed->getXpath() instanceof \DOMXPath);
$this->assertInstanceOf('DOMXPath', $feed->getXpath());
}

public function testGetsXpathPrefixString()
{
$feed = Reader\Reader::importString(
file_get_contents($this->feedSamplePath.'/atom.xml')
);
$this->assertTrue($feed->getXpathPrefix() == '/atom:feed');
$this->assertEquals('/atom:feed', $feed->getXpathPrefix());
}

public function testGetsDomElementObject()
{
$feed = Reader\Reader::importString(
file_get_contents($this->feedSamplePath.'/atom.xml')
);
$this->assertTrue($feed->getElement() instanceof \DOMElement);
$this->assertInstanceOf('DOMElement', $feed->getElement());
}

public function testSaveXmlOutputsXmlStringForFeed()
Expand All @@ -75,7 +75,7 @@ public function testGetsNamedExtension()
$feed = Reader\Reader::importString(
file_get_contents($this->feedSamplePath.'/atom.xml')
);
$this->assertTrue($feed->getExtension('Atom') instanceof Reader\Extension\Atom\Feed);
$this->assertInstanceOf('Zend\Feed\Reader\Extension\Atom\Feed', $feed->getExtension('Atom'));
}

public function testReturnsNullIfExtensionDoesNotExist()
Expand Down
4 changes: 2 additions & 2 deletions test/Reader/Feed/RssTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,7 @@ public function testGetsLastBuildDateFromRss20()
file_get_contents($this->feedSamplePath.'/lastbuilddate/plain/rss20.xml')
);
$edate = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z');
$this->assertTrue($edate == $feed->getLastBuildDate());
$this->assertEquals($edate, $feed->getLastBuildDate());
}

public function testGetsLastBuildDateFromRss20_None()
Expand All @@ -2096,7 +2096,7 @@ public function testGetsDateModified($path, $edate)
file_get_contents($this->feedSamplePath . $path)
);

$this->assertTrue($edate == $feed->getDateModified());
$this->assertEquals($edate, $feed->getDateModified());
}

public function dateModifiedProvider()
Expand Down
4 changes: 2 additions & 2 deletions test/Reader/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function testCompilesLinksAsArrayObject()
$this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection');
}
$links = Reader\Reader::findFeedLinks('http://www.planet-php.net');
$this->assertTrue($links instanceof Reader\FeedSet);
$this->assertInstanceOf('Zend\Feed\Reader\FeedSet', $links);
$this->assertEquals(array(
'rel' => 'alternate', 'type' => 'application/rss+xml', 'href' => 'http://www.planet-php.org/rss/'
), (array) $links->getIterator()->current());
Expand All @@ -191,7 +191,7 @@ public function testFeedSetLoadsFeedObjectWhenFeedArrayKeyAccessed()
}
$links = Reader\Reader::findFeedLinks('http://www.planet-php.net');
$link = $links->getIterator()->current();
$this->assertTrue($link['feed'] instanceof Reader\Feed\Rss);
$this->assertInstanceOf('Zend\Feed\Reader\Feed\Rss', $link['feed']);
}

public function testZeroCountFeedSetReturnedFromEmptyList()
Expand Down
6 changes: 3 additions & 3 deletions test/Writer/DeletedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public function testSetReferenceThrowsExceptionOnInvalidParameter()
public function testGetReferenceReturnsNullIfNotSet()
{
$entry = new Writer\Deleted;
$this->assertTrue(null === $entry->getReference());
$this->assertNull($entry->getReference());
}

public function testSetWhenDefaultsToCurrentTime()
{
$entry = new Writer\Deleted;
$entry->setWhen();
$dateNow = new DateTime();
$this->assertTrue($dateNow >= $entry->getWhen());
$this->assertLessThanOrEqual($dateNow, $entry->getWhen());
}

public function testSetWhenUsesGivenUnixTimestamp()
Expand Down Expand Up @@ -100,7 +100,7 @@ public function testSetWhenThrowsExceptionOnInvalidParameter()
public function testGetWhenReturnsNullIfDateNotSet()
{
$entry = new Writer\Deleted;
$this->assertTrue(null === $entry->getWhen());
$this->assertNull($entry->getWhen());
}

public function testAddsByNameFromArray()
Expand Down
28 changes: 14 additions & 14 deletions test/Writer/EntryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function testSetDateCreatedDefaultsToCurrentTime()
$entry = new Writer\Entry;
$entry->setDateCreated();
$dateNow = new DateTime();
$this->assertTrue($dateNow >= $entry->getDateCreated());
$this->assertLessThanOrEqual($dateNow, $entry->getDateCreated());
}

public function testSetDateCreatedUsesGivenUnixTimestamp()
Expand Down Expand Up @@ -239,7 +239,7 @@ public function testSetDateModifiedDefaultsToCurrentTime()
$entry = new Writer\Entry;
$entry->setDateModified();
$dateNow = new DateTime();
$this->assertTrue($dateNow >= $entry->getDateModified());
$this->assertLessThanOrEqual($dateNow, $entry->getDateModified());
}

public function testSetDateModifiedUsesGivenUnixTimestamp()
Expand Down Expand Up @@ -303,25 +303,25 @@ public function testSetDateModifiedThrowsExceptionOnInvalidParameter()
public function testGetDateCreatedReturnsNullIfDateNotSet()
{
$entry = new Writer\Entry;
$this->assertTrue(null === $entry->getDateCreated());
$this->assertNull($entry->getDateCreated());
}

public function testGetDateModifiedReturnsNullIfDateNotSet()
{
$entry = new Writer\Entry;
$this->assertTrue(null === $entry->getDateModified());
$this->assertNull($entry->getDateModified());
}

public function testGetCopyrightReturnsNullIfDateNotSet()
{
$entry = new Writer\Entry;
$this->assertTrue(null === $entry->getCopyright());
$this->assertNull($entry->getCopyright());
}

public function testGetContentReturnsNullIfDateNotSet()
{
$entry = new Writer\Entry;
$this->assertTrue(null === $entry->getContent());
$this->assertNull($entry->getContent());
}

public function testSetsDescription()
Expand All @@ -344,7 +344,7 @@ public function testSetDescriptionThrowsExceptionOnInvalidParameter()
public function testGetDescriptionReturnsNullIfDateNotSet()
{
$entry = new Writer\Entry;
$this->assertTrue(null === $entry->getDescription());
$this->assertNull($entry->getDescription());
}

public function testSetsId()
Expand All @@ -367,7 +367,7 @@ public function testSetIdThrowsExceptionOnInvalidParameter()
public function testGetIdReturnsNullIfNotSet()
{
$entry = new Writer\Entry;
$this->assertTrue(null === $entry->getId());
$this->assertNull($entry->getId());
}

public function testSetsLink()
Expand Down Expand Up @@ -400,13 +400,13 @@ public function testSetLinkThrowsExceptionOnInvalidUri()
public function testGetLinkReturnsNullIfNotSet()
{
$entry = new Writer\Entry;
$this->assertTrue(null === $entry->getLink());
$this->assertNull($entry->getLink());
}

public function testGetLinksReturnsNullIfNotSet()
{
$entry = new Writer\Entry;
$this->assertTrue(null === $entry->getLinks());
$this->assertNull($entry->getLinks());
}

public function testSetsCommentLink()
Expand Down Expand Up @@ -439,7 +439,7 @@ public function testSetCommentLinkThrowsExceptionOnInvalidUri()
public function testGetCommentLinkReturnsNullIfDateNotSet()
{
$entry = new Writer\Entry;
$this->assertTrue(null === $entry->getCommentLink());
$this->assertNull($entry->getCommentLink());
}

public function testSetsCommentFeedLink()
Expand Down Expand Up @@ -489,7 +489,7 @@ public function testSetCommentFeedLinkThrowsExceptionOnInvalidType()
public function testGetCommentFeedLinkReturnsNullIfNoneSet()
{
$entry = new Writer\Entry;
$this->assertTrue(null === $entry->getCommentFeedLinks());
$this->assertNull($entry->getCommentFeedLinks());
}

public function testSetsTitle()
Expand All @@ -512,7 +512,7 @@ public function testSetTitleThrowsExceptionOnInvalidParameter()
public function testGetTitleReturnsNullIfDateNotSet()
{
$entry = new Writer\Entry;
$this->assertTrue(null === $entry->getTitle());
$this->assertNull($entry->getTitle());
}

public function testSetsCommentCount()
Expand Down Expand Up @@ -597,7 +597,7 @@ public function testSetCommentCountThrowsExceptionOnInvalidNonIntegerParameter()
public function testGetCommentCountReturnsNullIfDateNotSet()
{
$entry = new Writer\Entry;
$this->assertTrue(null === $entry->getCommentCount());
$this->assertNull($entry->getCommentCount());
}

/**
Expand Down
Loading

0 comments on commit e2d64e9

Please sign in to comment.