Skip to content

Commit

Permalink
Fix Border and Flip test
Browse files Browse the repository at this point in the history
  • Loading branch information
Art4 committed Jan 25, 2024
1 parent 9d10e69 commit 66ad315
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
6 changes: 3 additions & 3 deletions tests/Manipulators/BorderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function testRunOverlay()
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('width')->andReturn(100)->once();
$mock->shouldReceive('height')->andReturn(100)->once();
$mock->shouldReceive('rectangle')->with(5, 5, 95, 95, \Mockery::on(function ($closure) {
$mock->shouldReceive('drawRectangle')->with(5, 5, \Mockery::on(function ($closure) {
return true;
}))->andReturn($mock)->once();
});
Expand All @@ -111,7 +111,7 @@ public function testRunShrink()
$mock->shouldReceive('width')->andReturn(100)->once();
$mock->shouldReceive('height')->andReturn(100)->once();
$mock->shouldReceive('resize')->with(80, 80)->andReturn($mock)->once();
$mock->shouldReceive('resizeCanvas')->with(20, 20, 'center', true, 'rgba(0, 0, 0, 0.5)')->andReturn($mock)->once();
$mock->shouldReceive('resizeCanvasRelative')->with(20, 20, 'rgba(0, 0, 0, 0.5)', 'center')->andReturn($mock)->once();
});

$border = new Border();
Expand All @@ -123,7 +123,7 @@ public function testRunShrink()
public function testRunExpand()
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('resizeCanvas')->with(20, 20, 'center', true, 'rgba(0, 0, 0, 0.5)')->andReturn($mock)->once();
$mock->shouldReceive('resizeCanvasRelative')->with(20, 20, 'rgba(0, 0, 0, 0.5)', 'center')->andReturn($mock)->once();
});

$border = new Border();
Expand Down
17 changes: 15 additions & 2 deletions tests/Manipulators/FlipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public function testCreateInstance()
public function testRun()
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('flip')->andReturn($mock)->with('h')->once();
$mock->shouldReceive('flip')->andReturn($mock)->with('v')->once();
$mock->shouldReceive('flip')->andReturn($mock)->once();
$mock->shouldReceive('flop')->andReturn($mock)->once();
});

$this->assertInstanceOf(
Expand All @@ -42,6 +42,19 @@ public function testRun()
);
}

public function testRunBoth()
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('flip')->andReturn($mock)->once();
$mock->shouldReceive('flop')->andReturn($mock)->once();
});

$this->assertInstanceOf(
ImageInterface::class,
$this->manipulator->setParams(['flip' => 'both'])->run($image)
);
}

public function testGetFlip()
{
$this->assertSame('h', $this->manipulator->setParams(['flip' => 'h'])->getFlip());
Expand Down

0 comments on commit 66ad315

Please sign in to comment.