| @@ 56-63 (lines=8) @@ | ||
| 53 | ])); |
|
| 54 | } |
|
| 55 | ||
| 56 | public function test_scale_down() { |
|
| 57 | $sourceFile = $this->createSourceFile(); |
|
| 58 | $imageObject = $this->createImageObject(); |
|
| 59 | ||
| 60 | $sizes = $this->scaler->scale($sourceFile, $imageObject); |
|
| 61 | ||
| 62 | $this->assertTrue(count($sizes) > 1); |
|
| 63 | } |
|
| 64 | ||
| 65 | public function test_scale_down_with_max_width() { |
|
| 66 | $sourceFile = $this->createSourceFile(); |
|
| @@ 77-85 (lines=9) @@ | ||
| 74 | } |
|
| 75 | } |
|
| 76 | ||
| 77 | public function test_scale_down_with_max_filesize() { |
|
| 78 | $sourceFile = $this->createSourceFile(); |
|
| 79 | $imageObject = $this->createImageObject(); |
|
| 80 | ||
| 81 | $this->scaler->setMaxFileSize(100000); |
|
| 82 | $sizes = $this->scaler->scale($sourceFile, $imageObject); |
|
| 83 | ||
| 84 | $this->assertCount(3, $sizes); |
|
| 85 | } |
|
| 86 | ||
| 87 | public function test_scale_down_with_include_source_disabled() { |
|
| 88 | $sourceFile = $this->createSourceFile(); |
|
| @@ 87-95 (lines=9) @@ | ||
| 84 | $this->assertCount(3, $sizes); |
|
| 85 | } |
|
| 86 | ||
| 87 | public function test_scale_down_with_include_source_disabled() { |
|
| 88 | $sourceFile = $this->createSourceFile(); |
|
| 89 | $imageObject = $this->createImageObject(); |
|
| 90 | ||
| 91 | $this->scaler->setIncludeSource(false); |
|
| 92 | $sizes = $this->scaler->scale($sourceFile, $imageObject); |
|
| 93 | ||
| 94 | $this->assertFalse(array_key_exists(1920, $sizes)); |
|
| 95 | } |
|
| 96 | ||
| 97 | // TODO: test algorithm |
|
| 98 | ||
| @@ 59-66 (lines=8) @@ | ||
| 56 | ])); |
|
| 57 | } |
|
| 58 | ||
| 59 | public function test_scale_down() { |
|
| 60 | $sourceFile = $this->createSourceFile(); |
|
| 61 | $imageObject = $this->createImageObject(); |
|
| 62 | ||
| 63 | $sizes = $this->scaler->scale($sourceFile, $imageObject); |
|
| 64 | ||
| 65 | $this->assertTrue(count($sizes) > 1); |
|
| 66 | } |
|
| 67 | ||
| 68 | public function test_scale_down_with_max_width() { |
|
| 69 | $sourceFile = $this->createSourceFile(); |
|
| @@ 80-88 (lines=9) @@ | ||
| 77 | } |
|
| 78 | } |
|
| 79 | ||
| 80 | public function test_scale_down_with_include_source_disabled() { |
|
| 81 | $sourceFile = $this->createSourceFile(); |
|
| 82 | $imageObject = $this->createImageObject(); |
|
| 83 | ||
| 84 | $this->scaler->setIncludeSource(false); |
|
| 85 | $sizes = $this->scaler->scale($sourceFile, $imageObject); |
|
| 86 | ||
| 87 | $this->assertFalse(array_key_exists(1920, $sizes)); |
|
| 88 | } |
|
| 89 | ||
| 90 | private function createSourceFile() { |
|
| 91 | $sourceFiles = Finder::create()->files()->in('./tests/img')->name('image.jpeg')->getIterator(); |
|