| 1 |
<?php |
| 2 |
|
| 3 |
namespace WebPConvert\Tests\Convert\Converters; |
| 4 |
|
| 5 |
use WebPConvert\Convert\Converters\Stack; |
| 6 |
use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperationalException; |
| 7 |
use WebPConvert\Convert\Exceptions\ConversionFailed\InvalidInput\ConverterNotFoundException; |
| 8 |
|
| 9 |
use PHPUnit\Framework\TestCase; |
| 10 |
|
| 11 |
class StackTest extends TestCase |
| 12 |
{ |
| 13 |
|
| 14 |
public static function getImageFolder() |
| 15 |
{ |
| 16 |
return realpath(__DIR__ . '/../../images'); |
| 17 |
} |
| 18 |
|
| 19 |
public static function getImagePath($image) |
| 20 |
{ |
| 21 |
return self::getImageFolder() . '/' . $image; |
| 22 |
} |
| 23 |
|
| 24 |
/* |
| 25 |
public function testConvert() |
| 26 |
{ |
| 27 |
//ConverterTestHelper::runAllConvertTests($this, 'Stack'); |
| 28 |
}*/ |
| 29 |
|
| 30 |
public function testConverterNotFound() |
| 31 |
{ |
| 32 |
$this->expectException(ConverterNotFoundException::class); |
| 33 |
|
| 34 |
Stack::convert( |
| 35 |
self::getImagePath('test.jpg'), |
| 36 |
self::getImagePath('test.webp'), |
| 37 |
[ |
| 38 |
'converters' => ['invalid-id'] |
| 39 |
] |
| 40 |
); |
| 41 |
} |
| 42 |
|
| 43 |
public function testCustomConverter() |
| 44 |
{ |
| 45 |
Stack::convert( |
| 46 |
self::getImagePath('test.jpg'), |
| 47 |
self::getImagePath('test.webp'), |
| 48 |
[ |
| 49 |
'converters' => [ |
| 50 |
'\\WebPConvert\\Tests\\Convert\\TestConverters\\SuccessGuaranteedConverter' |
| 51 |
] |
| 52 |
] |
| 53 |
); |
| 54 |
$this->addToAssertionCount(1); |
| 55 |
} |
| 56 |
|
| 57 |
} |
| 58 |
|