mirror of
https://github.com/Intervention/image.git
synced 2025-08-22 21:42:53 +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:
49
tests/Unit/FileTest.php
Normal file
49
tests/Unit/FileTest.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Tests\Unit;
|
||||
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Intervention\Image\File;
|
||||
use Intervention\Image\Tests\BaseTestCase;
|
||||
|
||||
#[CoversClass(\Intervention\Image\File::class)]
|
||||
final class FileTest extends BaseTestCase
|
||||
{
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$file = new File('foo');
|
||||
$this->assertInstanceOf(File::class, $file);
|
||||
}
|
||||
|
||||
public function testSave(): void
|
||||
{
|
||||
$filename = __DIR__ . '/file_' . strval(hrtime(true)) . '.test';
|
||||
$file = new File('foo');
|
||||
$file->save($filename);
|
||||
$this->assertTrue(file_exists($filename));
|
||||
unlink($filename);
|
||||
}
|
||||
|
||||
public function testToString(): void
|
||||
{
|
||||
$file = new File('foo');
|
||||
$string = $file->toString();
|
||||
$this->assertEquals('foo', $string);
|
||||
$this->assertEquals('foo', (string) $string);
|
||||
}
|
||||
|
||||
public function testToFilePointer(): void
|
||||
{
|
||||
$file = new File('foo');
|
||||
$fp = $file->toFilePointer();
|
||||
$this->assertIsResource($fp);
|
||||
}
|
||||
|
||||
public function testSize(): void
|
||||
{
|
||||
$file = new File('foo');
|
||||
$this->assertEquals(3, $file->size());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user