tests for Original sizer

This commit is contained in:
Joby Elliott 2020-10-01 13:13:09 -06:00
parent 3ce4c29671
commit 67b4bd1209

View file

@ -0,0 +1,36 @@
<?php
/* image-transform | https://github.com/jobyone/image-transform | MIT License */
namespace ByJoby\ImageTransform\tests\units\Sizers;
use atoum;
use ByJoby\ImageTransform\Sizers\Original as SizerUnderTest;
use ByJoby\ImageTransform\tests\units\mock\MockDriver;
class Original extends atoum
{
public function testRotation()
{
$this
->given($image = $this->image(__DIR__.'/../100x200.jpg'))
->integer($image->width())->isEqualTo(100)
->integer($image->height())->isEqualTo(200)
->variable($image->sizer()->resizeToWidth())->isNull()
->variable($image->sizer()->resizeToHeight())->isNull()
->variable($image->sizer()->cropToWidth())->isNull()
->variable($image->sizer()->cropToHeight())->isNull()
->given($image->rotate())
->integer($image->width())->isEqualTo(200)
->integer($image->height())->isEqualTo(100)
->variable($image->sizer()->resizeToWidth())->isNull()
->variable($image->sizer()->resizeToHeight())->isNull()
->variable($image->sizer()->cropToWidth())->isNull()
->variable($image->sizer()->cropToHeight())->isNull()
;
}
protected function image(string $path)
{
$driver = new MockDriver();
return $driver->image($path, new SizerUnderTest());
}
}