forked from timber/timber
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-image-dimensions.php
49 lines (41 loc) · 1.04 KB
/
test-image-dimensions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
class ImageDimensionsTestable extends \Timber\ImageDimensions
{
public function __construct($file_loc)
{
parent::__construct($file_loc);
}
public function set_dimensions($width, $height)
{
$this->dimensions = [$width, $height];
}
}
/**
* @group image
*/
class TestImageDimensions extends Timber_UnitTestCase
{
public function ratioProvider()
{
return [
[200, 100, 2],
[100, 200, 0.5],
];
}
/**
* @dataProvider ratioProvider
*/
public function testRatio($w, $h, $r)
{
$imageDimensions = new ImageDimensionsTestable('');
$imageDimensions->set_dimensions($w, $h);
$this->assertEquals($r, $imageDimensions->aspect());
}
public function testDimensions()
{
$imageDimensions = new ImageDimensionsTestable('');
$imageDimensions->set_dimensions(100, 200);
$this->assertEquals(100, $imageDimensions->width());
$this->assertEquals(200, $imageDimensions->height());
}
}