Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php declare(strict_types=1); namespace Intervention\Image\Tests\Unit; use PHPUnit\Fra..
Decoded Output download
<?php
declare(strict_types=1);
namespace Intervention\Image\Tests\Unit;
use PHPUnit\Framework\Attributes\CoversClass;
use Intervention\Image\Resolution;
use Intervention\Image\Tests\BaseTestCase;
#[CoversClass(\Intervention\Image\Resolution::class)]
final class ResolutionTest extends BaseTestCase
{
public function testConstructor(): void
{
$resolution = new Resolution(1, 2);
$this->assertInstanceOf(Resolution::class, $resolution);
}
public function testXY(): void
{
$resolution = new Resolution(1.2, 3.4);
$this->assertEquals(1.2, $resolution->x());
$this->assertEquals(3.4, $resolution->y());
}
public function testPerInch(): void
{
$resolution = new Resolution(300, 150); // per inch
$this->assertEquals(300, $resolution->perInch()->x());
$this->assertEquals(150, $resolution->perInch()->y());
$resolution = new Resolution(300, 150, Resolution::PER_CM);
$this->assertEquals(118.11024, round($resolution->perInch()->x(), 5));
$this->assertEquals(59.05512, round($resolution->perInch()->y(), 5));
}
public function testPerCm(): void
{
$resolution = new Resolution(118.11024, 59.05512); // per inch
$this->assertEquals(300, round($resolution->perCm()->x()));
$this->assertEquals(150, round($resolution->perCm()->y()));
$resolution = new Resolution(300, 150, Resolution::PER_CM);
$this->assertEquals(300, $resolution->perCm()->x());
$this->assertEquals(150, $resolution->perCm()->y());
}
public function testToString(): void
{
$resolution = new Resolution(300, 150, Resolution::PER_CM);
$this->assertEquals('300.00 x 150.00 dpcm', $resolution->toString());
$resolution = new Resolution(300, 150, Resolution::PER_INCH);
$this->assertEquals('300.00 x 150.00 dpi', $resolution->toString());
$this->assertEquals('300.00 x 150.00 dpi', (string) $resolution);
}
}
?>
Did this file decode correctly?
Original Code
<?php
declare(strict_types=1);
namespace Intervention\Image\Tests\Unit;
use PHPUnit\Framework\Attributes\CoversClass;
use Intervention\Image\Resolution;
use Intervention\Image\Tests\BaseTestCase;
#[CoversClass(\Intervention\Image\Resolution::class)]
final class ResolutionTest extends BaseTestCase
{
public function testConstructor(): void
{
$resolution = new Resolution(1, 2);
$this->assertInstanceOf(Resolution::class, $resolution);
}
public function testXY(): void
{
$resolution = new Resolution(1.2, 3.4);
$this->assertEquals(1.2, $resolution->x());
$this->assertEquals(3.4, $resolution->y());
}
public function testPerInch(): void
{
$resolution = new Resolution(300, 150); // per inch
$this->assertEquals(300, $resolution->perInch()->x());
$this->assertEquals(150, $resolution->perInch()->y());
$resolution = new Resolution(300, 150, Resolution::PER_CM);
$this->assertEquals(118.11024, round($resolution->perInch()->x(), 5));
$this->assertEquals(59.05512, round($resolution->perInch()->y(), 5));
}
public function testPerCm(): void
{
$resolution = new Resolution(118.11024, 59.05512); // per inch
$this->assertEquals(300, round($resolution->perCm()->x()));
$this->assertEquals(150, round($resolution->perCm()->y()));
$resolution = new Resolution(300, 150, Resolution::PER_CM);
$this->assertEquals(300, $resolution->perCm()->x());
$this->assertEquals(150, $resolution->perCm()->y());
}
public function testToString(): void
{
$resolution = new Resolution(300, 150, Resolution::PER_CM);
$this->assertEquals('300.00 x 150.00 dpcm', $resolution->toString());
$resolution = new Resolution(300, 150, Resolution::PER_INCH);
$this->assertEquals('300.00 x 150.00 dpi', $resolution->toString());
$this->assertEquals('300.00 x 150.00 dpi', (string) $resolution);
}
}
Function Calls
None |
Stats
MD5 | ccc57e5556f4e91659f8dddfbc55e7f9 |
Eval Count | 0 |
Decode Time | 92 ms |