Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Fix randomly failing test #255

Merged
merged 1 commit into from
Aug 27, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Tests/Unit/Controller/SitemapControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,15 @@ public function testRequestJson()

public function testRequestXml()
{
$response = new Response('some-xml-string');
$this->templating->expects($this->once())->method('render')->will($this->returnValue($response));
$this->templating->expects($this->once())
->method('render')
->with($this->equalTo('CmfSeoBundle:Sitemap:index.xml.twig'), $this->anything())
->will($this->returnValue('some-xml-string'));

/** @var Response $response */
$response = $this->controller->indexAction('xml', 'test');

$this->assertEquals(new Response('some-xml-string'), $response->getContent());
$this->assertEquals('some-xml-string', $response->getContent());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was the actual cause of the random test failures: We compared a Response object to $response->getContent(). That means that PHP/HHVM needed to convert the first argument to a string before comparing with getContent. Some versions of HHVM did not do this and threw an exception: Comparing an object with a string

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

public function testRequestHtml()
Expand Down