Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
deluxetom committed Jan 2, 2025
1 parent b89b658 commit 03c3805
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/Manipulators/SizeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ public function testGetFit()
$this->assertSame('stretch', $this->manipulator->setParams(['fit' => 'stretch'])->getFit());
$this->assertSame('cover', $this->manipulator->setParams(['fit' => 'cover'])->getFit());
$this->assertSame('cover', $this->manipulator->setParams(['fit' => 'crop'])->getFit());
$this->assertSame('cover', $this->manipulator->setParams(['fit' => 'crop-bottom'])->getFit());
$this->assertSame('cover', $this->manipulator->setParams(['fit' => 'crop-top-left'])->getFit());
$this->assertSame('cover', $this->manipulator->setParams(['fit' => 'crop-center'])->getFit());
$this->assertSame('crop', $this->manipulator->setParams(['fit' => 'crop-27-75'])->getFit());
$this->assertSame('crop', $this->manipulator->setParams(['fit' => 'crop-25-75'])->getFit());
$this->assertSame('contain', $this->manipulator->setParams(['fit' => 'invalid'])->getFit());
}

Expand Down Expand Up @@ -286,13 +287,23 @@ public function testRunCoverResizePosition()
$mock->shouldReceive('width')->andReturn(100);
$mock->shouldReceive('height')->andReturn(100);
$mock->shouldReceive('cover')->with(50, 50, 'top-left')->andReturn($mock)->once();
$mock->shouldReceive('cover')->with(50, 50, 'bottom')->andReturn($mock)->once();
$mock->shouldReceive('cover')->with(50, 50, 'bottom-right')->andReturn($mock)->once();
});

$this->manipulator->setParams(['w' => 50, 'h' => 50, 'fit' => 'crop-top-left']);

$this->assertInstanceOf(
ImageInterface::class,
$this->manipulator->run($image)
$this->manipulator->setParams(['w' => 50, 'h' => 50, 'fit' => 'crop-top-left'])->run($image)
);
$this->assertInstanceOf(
ImageInterface::class,
$this->manipulator->setParams(['w' => 50, 'h' => 50, 'fit' => 'crop-bottom'])->run($image)
);
$this->assertInstanceOf(
ImageInterface::class,
$this->manipulator->setParams(['w' => 50, 'h' => 50, 'fit' => 'crop-bottom-right'])->run($image)
);
}

Expand Down

0 comments on commit 03c3805

Please sign in to comment.