mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-12 10:18:39 +00:00
86 lines
1.8 KiB
PHP
86 lines
1.8 KiB
PHP
<?php
|
|
/**
|
|
* Karaka
|
|
*
|
|
* PHP Version 8.1
|
|
*
|
|
* @package tests
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link https://karaka.app
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace phpOMS\tests\Utils\Barcode;
|
|
|
|
use phpOMS\Utils\Barcode\C128c;
|
|
use phpOMS\Utils\Barcode\OrientationType;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
final class C128cTest extends \PHPUnit\Framework\TestCase
|
|
{
|
|
protected function setUp() : void
|
|
{
|
|
if (!\extension_loaded('gd')) {
|
|
$this->markTestSkipped(
|
|
'The GD extension is not available.'
|
|
);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @covers phpOMS\Utils\Barcode\C128c<extended>
|
|
* @group framework
|
|
*/
|
|
public function testImagePng() : void
|
|
{
|
|
$path = __DIR__ . '/c128c.png';
|
|
if (\is_file($path)) {
|
|
\unlink($path);
|
|
}
|
|
|
|
$img = new C128c('412163', 200, 50);
|
|
$img->saveToPngFile($path);
|
|
|
|
self::assertFileExists($path);
|
|
}
|
|
|
|
/**
|
|
* @covers phpOMS\Utils\Barcode\C128c<extended>
|
|
* @group framework
|
|
*/
|
|
public function testImageJpg() : void
|
|
{
|
|
$path = __DIR__ . '/c128c.jpg';
|
|
if (\is_file($path)) {
|
|
\unlink($path);
|
|
}
|
|
|
|
$img = new C128c('412163', 200, 50);
|
|
$img->saveToJpgFile($path);
|
|
|
|
self::assertFileExists($path);
|
|
}
|
|
|
|
/**
|
|
* @covers phpOMS\Utils\Barcode\C128c<extended>
|
|
* @group framework
|
|
*/
|
|
public function testOrientationAndMargin() : void
|
|
{
|
|
$path = __DIR__ . '/c128c_vertical.png';
|
|
if (\is_file($path)) {
|
|
\unlink($path);
|
|
}
|
|
|
|
$img = new C128c('412163', 50, 200, OrientationType::VERTICAL);
|
|
$img->setMargin(2);
|
|
$img->saveToPngFile($path);
|
|
|
|
self::assertFileExists($path);
|
|
}
|
|
}
|