Skip to content

Commit

Permalink
fixed return types
Browse files Browse the repository at this point in the history
  • Loading branch information
deluxetom committed Jan 2, 2025
1 parent 03c3805 commit 2ddea0f
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions tests/Manipulators/SizeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ public function testCreateInstance(): void
$this->assertInstanceOf(Size::class, $this->manipulator);
}

public function testSetMaxImageSize()
public function testSetMaxImageSize(): void
{
$this->manipulator->setMaxImageSize(500 * 500);
$this->assertSame(500 * 500, $this->manipulator->getMaxImageSize());
}

public function testGetMaxImageSize()
public function testGetMaxImageSize(): void
{
$this->assertNull($this->manipulator->getMaxImageSize());
}

public function testRun()
public function testRun(): void
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('width')->andReturn('200')->twice();
Expand All @@ -51,7 +51,7 @@ public function testRun()
);
}

public function testGetWidth()
public function testGetWidth(): void
{
$this->assertSame(100, $this->manipulator->setParams(['w' => 100])->getWidth());
$this->assertSame(100, $this->manipulator->setParams(['w' => 100.1])->getWidth());
Expand All @@ -60,7 +60,7 @@ public function testGetWidth()
$this->assertSame(null, $this->manipulator->setParams(['w' => '-100'])->getWidth());
}

public function testGetHeight()
public function testGetHeight(): void
{
$this->assertSame(100, $this->manipulator->setParams(['h' => 100])->getHeight());
$this->assertSame(100, $this->manipulator->setParams(['h' => 100.1])->getHeight());
Expand All @@ -69,7 +69,7 @@ public function testGetHeight()
$this->assertSame(null, $this->manipulator->setParams(['h' => '-100'])->getHeight());
}

public function testGetFit()
public function testGetFit(): void
{
$this->assertSame('contain', $this->manipulator->setParams(['fit' => 'contain'])->getFit());
$this->assertSame('fill', $this->manipulator->setParams(['fit' => 'fill'])->getFit());
Expand All @@ -85,7 +85,7 @@ public function testGetFit()
$this->assertSame('contain', $this->manipulator->setParams(['fit' => 'invalid'])->getFit());
}

public function testGetCrop()
public function testGetCrop(): void
{
$this->assertSame([0, 0, 1.0], $this->manipulator->setParams(['fit' => 'crop-top-left'])->getCrop());
$this->assertSame([0, 100, 1.0], $this->manipulator->setParams(['fit' => 'crop-bottom-left'])->getCrop());
Expand All @@ -110,15 +110,15 @@ public function testGetCrop()
$this->assertSame([50, 50, 1.0], $this->manipulator->setParams(['fit' => 'invalid'])->getCrop());
}

public function testGetDpr()
public function testGetDpr(): void
{
$this->assertSame(1.0, $this->manipulator->setParams(['dpr' => 'invalid'])->getDpr());
$this->assertSame(1.0, $this->manipulator->setParams(['dpr' => '-1'])->getDpr());
$this->assertSame(1.0, $this->manipulator->setParams(['dpr' => '9'])->getDpr());
$this->assertSame(2.0, $this->manipulator->setParams(['dpr' => '2'])->getDpr());
}

public function testResolveMissingDimensions()
public function testResolveMissingDimensions(): void
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('width')->andReturn(400);
Expand All @@ -130,7 +130,7 @@ public function testResolveMissingDimensions()
$this->assertSame([200, 100], $this->manipulator->resolveMissingDimensions($image, null, 100));
}

public function testResolveMissingDimensionsWithOddDimensions()
public function testResolveMissingDimensionsWithOddDimensions(): void
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('width')->andReturn(1024);
Expand All @@ -140,15 +140,15 @@ public function testResolveMissingDimensionsWithOddDimensions()
$this->assertSame([411, 222], $this->manipulator->resolveMissingDimensions($image, 411, null));
}

public function testLimitImageSize()
public function testLimitImageSize(): void
{
$this->assertSame([1000, 1000], $this->manipulator->limitImageSize(1000, 1000));
$this->manipulator->setMaxImageSize(500 * 500);
$this->assertSame([500, 500], $this->manipulator->limitImageSize(500, 500));
$this->assertSame([500, 500], $this->manipulator->limitImageSize(1000, 1000));
}

public function testRunResize()
public function testRunResize(): void
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('width')->andReturn(100)->times(4);
Expand Down Expand Up @@ -202,7 +202,7 @@ public function testRunResize()
);
}

public function testRunContainResize()
public function testRunContainResize(): void
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('scale')->with(100, 100)->andReturn($mock)->once();
Expand All @@ -214,7 +214,7 @@ public function testRunContainResize()
);
}

public function testRunFillResize()
public function testRunFillResize(): void
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('pad')->with(100, 100)->andReturn($mock)->once();
Expand All @@ -226,7 +226,7 @@ public function testRunFillResize()
);
}

public function testRunMaxResize()
public function testRunMaxResize(): void
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('scaleDown')->with(100, 100)->andReturn($mock)->once();
Expand All @@ -238,7 +238,7 @@ public function testRunMaxResize()
);
}

public function testRunStretchResize()
public function testRunStretchResize(): void
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('resize')->with(100, 100)->andReturn($mock)->once();
Expand All @@ -250,7 +250,7 @@ public function testRunStretchResize()
);
}

public function testRunCropResize()
public function testRunCropResize(): void
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('width')->andReturn(100)->times(4);
Expand All @@ -265,7 +265,7 @@ public function testRunCropResize()
);
}

public function testRunCoverResize()
public function testRunCoverResize(): void
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('width')->andReturn(100);
Expand All @@ -281,7 +281,7 @@ public function testRunCoverResize()
);
}

public function testRunCoverResizePosition()
public function testRunCoverResizePosition(): void
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('width')->andReturn(100);
Expand All @@ -307,7 +307,7 @@ public function testRunCoverResizePosition()
);
}

public function testResizeDoesNotRunWhenNoParamsAreSet()
public function testResizeDoesNotRunWhenNoParamsAreSet(): void
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('width')->andReturn(100)->twice();
Expand All @@ -321,7 +321,7 @@ public function testResizeDoesNotRunWhenNoParamsAreSet()
);
}

public function testResizeDoesNotRunWhenSettingFitCropToCenterWithNoZoom()
public function testResizeDoesNotRunWhenSettingFitCropToCenterWithNoZoom(): void
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('width')->andReturn(100)->twice();
Expand All @@ -337,7 +337,7 @@ public function testResizeDoesNotRunWhenSettingFitCropToCenterWithNoZoom()
);
}

public function testResizeDoesRunWhenDimensionsAreTheSameAndTheCropZoomIsNotDefaultOne()
public function testResizeDoesRunWhenDimensionsAreTheSameAndTheCropZoomIsNotDefaultOne(): void
{
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
$mock->shouldReceive('width')->andReturn(100);
Expand Down

0 comments on commit 2ddea0f

Please sign in to comment.