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

Something wrong with ImageTest.php #863

Closed
jremes-foss opened this issue Mar 23, 2016 · 4 comments
Closed

Something wrong with ImageTest.php #863

jremes-foss opened this issue Mar 23, 2016 · 4 comments

Comments

@jremes-foss
Copy link
Contributor

This probably needs to be investigated. My Travis CI build failed due to this:

There was 1 failure:
1) Faker\Test\Provider\ImageTest::testDownloadWithDefaults
Failed asserting that null matches expected 640.
/home/travis/build/fzaninotto/Faker/test/Faker/Provider/ImageTest.php:52

How ever, as far as I know there has been no changes to this file after May 20, 2015.

The line failing is as follows:

$this->assertEquals(640, $width);

For some reason, the variable $width is null. Why?

On my side, the test is actually OK:

$ phpunit --filter testDownloadWithDefaults test/Faker/Provider/ImageTest.php
PHPUnit 4.8.23 by Sebastian Bergmann and contributors.

.

Time: 17.27 seconds, Memory: 5.25Mb

OK (1 test, 4 assertions)

Few notes: Composer is up to date, and this error happens only with PHP 7.0.4. This might explain why the test works on my side, as my local development server is running PHP 5.5.9.

This issue might have an impact to further Pull Requests (causing them to fail the Travis CI build), such as the case stands in #862.

Edit: One possible explanation for this behaviour is curl not being enabled on Travis PHP 7.0.4 environment. It might be worth checking. Another issue might be that LoremPixel is down? The site seems to work and generate images but it might be that the site does not pass data to Faker.

@fzaninotto
Copy link
Owner

Yep, the problem comes from LoremPixel. I think the Image Test should ping lorempixel first, and skip tests if the response time si too long.

@jremes-foss
Copy link
Contributor Author

If you need help with this one, I can create a PR.

@jremes-foss
Copy link
Contributor Author

I checked the HTTP header using curl and looks like the site is moved permanently:

$ curl -I http://www.lorempixel.com
HTTP/1.1 301 Moved Permanently
Date: Tue, 29 Mar 2016 13:05:51 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
Server: Apache
Location: http://lorempixel.com/
Vary: Accept-Encoding

As a band-aid, I've created a PR #866 to check the HTTP status before assertions.

@fzaninotto
Copy link
Owner

Fixed by #866

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants