mirror of
https://github.com/Intervention/image.git
synced 2025-08-26 15:24:37 +02:00
PHPUnit 10 Migration (#1302)
* Bump PHPUnit dependencies * Set return type of base TestCase methods From the [PHPUnit 8 release notes][1], the `TestCase` methods below now declare a `void` return type: - `setUpBeforeClass()` - `setUp()` - `assertPreConditions()` - `assertPostConditions()` - `tearDown()` - `tearDownAfterClass()` - `onNotSuccessfulTest()` [1]: https://phpunit.de/announcements/phpunit-8.html * Ignore PHPUnit cache folder * Adopt PHP attributes in test classes * Declare data providers as `static` * Add return types to test methods * Define test classes as `final` * Migrate phpunit.xml to phpunit 10 * Correct phpunit attribute class name * Rename base test class * Restructure test folders * Fix test image paths * Only set rules for php files in .editorconfig * Remove php unit flag in local test env --------- Co-authored-by: Shift <shift@laravelshift.com>
This commit is contained in:
32
tests/Unit/Drivers/Gd/Modifiers/ContainModifierTest.php
Normal file
32
tests/Unit/Drivers/Gd/Modifiers/ContainModifierTest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Tests\Unit\Drivers\Gd\Modifiers;
|
||||
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
|
||||
use Intervention\Image\Modifiers\ContainModifier;
|
||||
use Intervention\Image\Tests\BaseTestCase;
|
||||
use Intervention\Image\Tests\Traits\CanCreateGdTestImage;
|
||||
|
||||
#[RequiresPhpExtension('gd')]
|
||||
#[CoversClass(\Intervention\Image\Modifiers\ContainModifier::class)]
|
||||
#[CoversClass(\Intervention\Image\Drivers\Gd\Modifiers\ContainModifier::class)]
|
||||
final class ContainModifierTest extends BaseTestCase
|
||||
{
|
||||
use CanCreateGdTestImage;
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->readTestImage('blocks.png');
|
||||
$this->assertEquals(640, $image->width());
|
||||
$this->assertEquals(480, $image->height());
|
||||
$image->modify(new ContainModifier(200, 100, 'ff0'));
|
||||
$this->assertEquals(200, $image->width());
|
||||
$this->assertEquals(100, $image->height());
|
||||
$this->assertColor(255, 255, 0, 255, $image->pickColor(0, 0));
|
||||
$this->assertTransparency($image->pickColor(140, 10));
|
||||
$this->assertColor(255, 255, 0, 255, $image->pickColor(175, 10));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user