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

Commit 6a9d875

Browse files
committed
Enhancement: Assert that imageUrl can be used with gray flag
1 parent 3bb4619 commit 6a9d875

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ Methods accepting a `$timezone` argument default to `date_default_timezone_get()
265265
imageUrl($width = 640, $height = 480) // 'http://lorempixel.com/640/480/'
266266
imageUrl($width, $height, 'cats') // 'http://lorempixel.com/800/600/cats/'
267267
imageUrl($width, $height, 'cats', true, 'Faker') // 'http://lorempixel.com/800/400/cats/Faker'
268-
imageUrl($width, $height, 'cats', true, 'Faker', true) // 'http://lorempixel.com/grey/800/400/cats/Faker/' Monochrome image
268+
imageUrl($width, $height, 'cats', true, 'Faker', true) // 'http://lorempixel.com/gray/800/400/cats/Faker/' Monochrome image
269269
image($dir = '/tmp', $width = 640, $height = 480) // '/tmp/13b73edae8443990be1aa8f1a483bc27.jpg'
270270
image($dir, $width, $height, 'cats') // 'tmp/13b73edae8443990be1aa8f1a483bc27.jpg' it's a cat!
271271
image($dir, $width, $height, 'cats', false) // '13b73edae8443990be1aa8f1a483bc27.jpg' it's a filename without path

test/Faker/Provider/ImageTest.php

+28
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,34 @@ public function testImageUrlAcceptsCustomText()
2727
$this->assertRegExp('#^https://lorempixel.com/800/400/nature/Faker#', Image::imageUrl(800, 400, 'nature', false, 'Faker'));
2828
}
2929

30+
public function testImageUrlReturnsLinkToRegularImageWhenGrayIsFalse()
31+
{
32+
$imageUrl = Image::imageUrl(
33+
800,
34+
400,
35+
'nature',
36+
false,
37+
'Faker',
38+
false
39+
);
40+
41+
$this->assertSame('https://lorempixel.com/800/400/nature/Faker/', $imageUrl);
42+
}
43+
44+
public function testImageUrlReturnsLinkToRegularImageWhenGrayIsTrue()
45+
{
46+
$imageUrl = Image::imageUrl(
47+
800,
48+
400,
49+
'nature',
50+
false,
51+
'Faker',
52+
true
53+
);
54+
55+
$this->assertSame('https://lorempixel.com/gray/800/400/nature/Faker/', $imageUrl);
56+
}
57+
3058
public function testImageUrlAddsARandomGetParameterByDefault()
3159
{
3260
$url = Image::imageUrl(800, 400);

0 commit comments

Comments
 (0)