Skip to content

Commit

Permalink
chore(release): v4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
luqven committed Jan 19, 2023
1 parent 4d3385d commit f733aef
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "imgix/imgix-php",
"description": "A PHP client library for generating URLs with imgix.",
"type": "library",
"version": "3.3.1",
"version": "4.0.0",
"license": "BSD-2-Clause",
"keywords": [
"imgix"
Expand Down
2 changes: 1 addition & 1 deletion src/UrlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class UrlBuilder {

private $currentVersion = "3.3.1";
private $currentVersion = "4.0.0";
private $domain;
private $useHttps;
private $signKey;
Expand Down
78 changes: 39 additions & 39 deletions tests/UrlBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function testCustomSrcsetPairs() {
$builder = new UrlBuilder("demos.imgix.net", true, false);
$opts = array('start' => 328, 'stop' => 328);
$actual = $builder->createSrcSet($path="image.jpg", $params=array(), $options=$opts);
$expected = 'https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=328 328w';
$expected = 'https://demos.imgix.net/image.jpg?ixlib=php-4.0.0&w=328 328w';
$this->assertEquals($expected, $actual);

$builder = new UrlBuilder("demos.imgix.net", true, false);
Expand All @@ -225,15 +225,15 @@ public function testCustomSrcsetPairs() {
$params=array(),
$options=array('start' => 720, 'stop' => 720));

$expected = 'https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=720 720w';
$expected = 'https://demos.imgix.net/image.jpg?ixlib=php-4.0.0&w=720 720w';
$this->assertEquals($expected, $actual);

$builder = new UrlBuilder("demos.imgix.net", true, false);
$opts = array('start' => 640, 'stop' => 720);
$actual = $builder->createSrcSet($path="image.jpg", $params=array(), $options=$opts);
$expected = // Raw string literal
'https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=640 640w,
https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=720 720w';
'https://demos.imgix.net/image.jpg?ixlib=php-4.0.0&w=640 640w,
https://demos.imgix.net/image.jpg?ixlib=php-4.0.0&w=720 720w';

$this->assertEquals($expected, $actual);

Expand All @@ -242,11 +242,11 @@ public function testCustomSrcsetPairs() {
$opts = array('start' => 100, 'stop' => 108, 'tol' => 0.01);
$actual = $builder->createSrcSet($path="image.jpg", $params=array(), $options=$opts);
$expected = // Raw string literal
'https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=100 100w,
https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=102 102w,
https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=104 104w,
https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=106 106w,
https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=108 108w';
'https://demos.imgix.net/image.jpg?ixlib=php-4.0.0&w=100 100w,
https://demos.imgix.net/image.jpg?ixlib=php-4.0.0&w=102 102w,
https://demos.imgix.net/image.jpg?ixlib=php-4.0.0&w=104 104w,
https://demos.imgix.net/image.jpg?ixlib=php-4.0.0&w=106 106w,
https://demos.imgix.net/image.jpg?ixlib=php-4.0.0&w=108 108w';

$this->assertEquals($expected, $actual);
}
Expand Down Expand Up @@ -291,11 +291,11 @@ public function testDprSrcsetWithQ100() {
$actual = $builder->createSrcSet(
$path="image.jpg", $params=array("w" => 640, "q" => 100));
$expected =
'https://demos.imgix.net/image.jpg?dpr=1&ixlib=php-3.3.1&q=100&w=640 1x,
https://demos.imgix.net/image.jpg?dpr=2&ixlib=php-3.3.1&q=100&w=640 2x,
https://demos.imgix.net/image.jpg?dpr=3&ixlib=php-3.3.1&q=100&w=640 3x,
https://demos.imgix.net/image.jpg?dpr=4&ixlib=php-3.3.1&q=100&w=640 4x,
https://demos.imgix.net/image.jpg?dpr=5&ixlib=php-3.3.1&q=100&w=640 5x';
'https://demos.imgix.net/image.jpg?dpr=1&ixlib=php-4.0.0&q=100&w=640 1x,
https://demos.imgix.net/image.jpg?dpr=2&ixlib=php-4.0.0&q=100&w=640 2x,
https://demos.imgix.net/image.jpg?dpr=3&ixlib=php-4.0.0&q=100&w=640 3x,
https://demos.imgix.net/image.jpg?dpr=4&ixlib=php-4.0.0&q=100&w=640 4x,
https://demos.imgix.net/image.jpg?dpr=5&ixlib=php-4.0.0&q=100&w=640 5x';
$this->assertEquals($expected, $actual);
}

Expand All @@ -305,11 +305,11 @@ public function testDprSrcsetWithDefaultQuality() {
$actual = $builder->createSrcSet($path="image.jpg", $params=array("w" => 740));

$expected =
'https://demos.imgix.net/image.jpg?dpr=1&ixlib=php-3.3.1&q=75&w=740 1x,
https://demos.imgix.net/image.jpg?dpr=2&ixlib=php-3.3.1&q=50&w=740 2x,
https://demos.imgix.net/image.jpg?dpr=3&ixlib=php-3.3.1&q=35&w=740 3x,
https://demos.imgix.net/image.jpg?dpr=4&ixlib=php-3.3.1&q=23&w=740 4x,
https://demos.imgix.net/image.jpg?dpr=5&ixlib=php-3.3.1&q=20&w=740 5x';
'https://demos.imgix.net/image.jpg?dpr=1&ixlib=php-4.0.0&q=75&w=740 1x,
https://demos.imgix.net/image.jpg?dpr=2&ixlib=php-4.0.0&q=50&w=740 2x,
https://demos.imgix.net/image.jpg?dpr=3&ixlib=php-4.0.0&q=35&w=740 3x,
https://demos.imgix.net/image.jpg?dpr=4&ixlib=php-4.0.0&q=23&w=740 4x,
https://demos.imgix.net/image.jpg?dpr=5&ixlib=php-4.0.0&q=20&w=740 5x';
$this->assertEquals($expected, $actual);
}

Expand All @@ -321,11 +321,11 @@ public function testDprVariableQualityDisabled() {
$actual = $builder->createSrcSet($path="image.jpg", $params=$params, $opts=$opts);

$expected =
'https://demos.imgix.net/image.jpg?dpr=1&ixlib=php-3.3.1&w=640 1x,
https://demos.imgix.net/image.jpg?dpr=2&ixlib=php-3.3.1&w=640 2x,
https://demos.imgix.net/image.jpg?dpr=3&ixlib=php-3.3.1&w=640 3x,
https://demos.imgix.net/image.jpg?dpr=4&ixlib=php-3.3.1&w=640 4x,
https://demos.imgix.net/image.jpg?dpr=5&ixlib=php-3.3.1&w=640 5x';
'https://demos.imgix.net/image.jpg?dpr=1&ixlib=php-4.0.0&w=640 1x,
https://demos.imgix.net/image.jpg?dpr=2&ixlib=php-4.0.0&w=640 2x,
https://demos.imgix.net/image.jpg?dpr=3&ixlib=php-4.0.0&w=640 3x,
https://demos.imgix.net/image.jpg?dpr=4&ixlib=php-4.0.0&w=640 4x,
https://demos.imgix.net/image.jpg?dpr=5&ixlib=php-4.0.0&w=640 5x';
$this->assertEquals($expected, $actual);
}

Expand All @@ -338,11 +338,11 @@ public function testDprSrcsetQOverridesEnabledVariableQuality() {
$actual = $builder->createSrcSet($path="image.jpg", $params, $opts);

$expected =
'https://demos.imgix.net/image.jpg?dpr=1&ixlib=php-3.3.1&q=75&w=540 1x,
https://demos.imgix.net/image.jpg?dpr=2&ixlib=php-3.3.1&q=75&w=540 2x,
https://demos.imgix.net/image.jpg?dpr=3&ixlib=php-3.3.1&q=75&w=540 3x,
https://demos.imgix.net/image.jpg?dpr=4&ixlib=php-3.3.1&q=75&w=540 4x,
https://demos.imgix.net/image.jpg?dpr=5&ixlib=php-3.3.1&q=75&w=540 5x';
'https://demos.imgix.net/image.jpg?dpr=1&ixlib=php-4.0.0&q=75&w=540 1x,
https://demos.imgix.net/image.jpg?dpr=2&ixlib=php-4.0.0&q=75&w=540 2x,
https://demos.imgix.net/image.jpg?dpr=3&ixlib=php-4.0.0&q=75&w=540 3x,
https://demos.imgix.net/image.jpg?dpr=4&ixlib=php-4.0.0&q=75&w=540 4x,
https://demos.imgix.net/image.jpg?dpr=5&ixlib=php-4.0.0&q=75&w=540 5x';
$this->assertEquals($expected, $actual);
}

Expand All @@ -356,11 +356,11 @@ public function testDprSrcsetQOverridesDisabledVariableQuality() {
$options=$opts);

$expected =
'https://demos.imgix.net/image.jpg?dpr=1&ixlib=php-3.3.1&q=99&w=440 1x,
https://demos.imgix.net/image.jpg?dpr=2&ixlib=php-3.3.1&q=99&w=440 2x,
https://demos.imgix.net/image.jpg?dpr=3&ixlib=php-3.3.1&q=99&w=440 3x,
https://demos.imgix.net/image.jpg?dpr=4&ixlib=php-3.3.1&q=99&w=440 4x,
https://demos.imgix.net/image.jpg?dpr=5&ixlib=php-3.3.1&q=99&w=440 5x';
'https://demos.imgix.net/image.jpg?dpr=1&ixlib=php-4.0.0&q=99&w=440 1x,
https://demos.imgix.net/image.jpg?dpr=2&ixlib=php-4.0.0&q=99&w=440 2x,
https://demos.imgix.net/image.jpg?dpr=3&ixlib=php-4.0.0&q=99&w=440 3x,
https://demos.imgix.net/image.jpg?dpr=4&ixlib=php-4.0.0&q=99&w=440 4x,
https://demos.imgix.net/image.jpg?dpr=5&ixlib=php-4.0.0&q=99&w=440 5x';
$this->assertEquals($expected, $actual);
}

Expand All @@ -369,11 +369,11 @@ public function testCreateSrcSetFromWidthsArray() {
$opts = array('widths' => array(100, 200, 303, 404, 535));
$actual = $builder->createSrcSet($path="image.jpg", $params=array(), $options=$opts);
$expected =
'https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=100 100w,
https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=200 200w,
https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=303 303w,
https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=404 404w,
https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=535 535w';
'https://demos.imgix.net/image.jpg?ixlib=php-4.0.0&w=100 100w,
https://demos.imgix.net/image.jpg?ixlib=php-4.0.0&w=200 200w,
https://demos.imgix.net/image.jpg?ixlib=php-4.0.0&w=303 303w,
https://demos.imgix.net/image.jpg?ixlib=php-4.0.0&w=404 404w,
https://demos.imgix.net/image.jpg?ixlib=php-4.0.0&w=535 535w';

$this->assertEquals($expected, $actual);
}
Expand Down

0 comments on commit f733aef

Please sign in to comment.