|
| 1 | +<?php |
| 2 | + declare(strict_types=1); |
| 3 | + |
| 4 | + namespace Fawno\PDFOptimizer\Tests\Parameters; |
| 5 | + |
| 6 | + use Fawno\Ghostscript\GhostscriptParameters; |
| 7 | + use Fawno\Ghostscript\Parameters\Enums\sDEVICEEnum; |
| 8 | + use Fawno\Ghostscript\Parameters\sDEVICE; |
| 9 | + |
| 10 | + class sDEVICETest extends TestParameterCase { |
| 11 | + public function testsDEVICETrait () : void { |
| 12 | + $this->assertIsTrait(sDEVICE::class); |
| 13 | + $this->assertClassHasProperty(sDEVICE::class, 'sDEVICE'); |
| 14 | + $this->assertClassPropertyIsType(sDEVICE::class, 'sDEVICE', [sDEVICEEnum::class, 'null']); |
| 15 | + } |
| 16 | + |
| 17 | + public function testsDEVICEDefault () : void { |
| 18 | + $params = GhostscriptParameters::create(); |
| 19 | + |
| 20 | + $this->assertInstanceOf(GhostscriptParameters::class, $params); |
| 21 | + |
| 22 | + $params = $params->getParameters(); |
| 23 | + $this->assertIsArray($params); |
| 24 | + $this->assertContains('-sDEVICE=' . sDEVICEEnum::PDFWRITE->value, $params); |
| 25 | + } |
| 26 | + |
| 27 | + public function testsDEVICENull () : void { |
| 28 | + $params = GhostscriptParameters::create()->device(null); |
| 29 | + |
| 30 | + $this->assertInstanceOf(GhostscriptParameters::class, $params); |
| 31 | + |
| 32 | + $params = $params->getParameters(); |
| 33 | + $this->assertIsArray($params); |
| 34 | + $this->assertNotContains('-sDEVICE=' . sDEVICEEnum::PDFWRITE->value, $params); |
| 35 | + } |
| 36 | + |
| 37 | + public function testsDEVICEJPEG () : void { |
| 38 | + $params = GhostscriptParameters::create()->device(sDEVICEEnum::JPEG); |
| 39 | + |
| 40 | + $this->assertInstanceOf(GhostscriptParameters::class, $params); |
| 41 | + |
| 42 | + $params = $params->getParameters(); |
| 43 | + $this->assertIsArray($params); |
| 44 | + $this->assertContains('-sDEVICE=' . sDEVICEEnum::JPEG->value, $params); |
| 45 | + } |
| 46 | + } |
0 commit comments