Skip to content

Commit

Permalink
Upgrade dev deps
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsche committed Dec 5, 2023
1 parent 5cc316c commit bb5dc3b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 37 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
"twig/twig": "^3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.2.1",
"mikey179/vfsstream": "^1.6.8",
"phpstan/phpstan": "^1.6.8",
"phpstan/phpstan-deprecation-rules": "^1.0.0",
"phpunit/phpunit": "^9.5",
"friendsofphp/php-cs-fixer": "^3.40.2",
"mikey179/vfsstream": "^1.6.11",
"phpstan/phpstan": "^1.10.47",
"phpstan/phpstan-deprecation-rules": "^1.1.4",
"phpunit/phpunit": "^10.5.1",
"symfony/browser-kit": "^6.4 || ^7.0"
},
"scripts": {
Expand Down
8 changes: 5 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd">
<php>
<env name="KERNEL_CLASS" value="Leapt\ImBundle\Tests\LeaptImTestingKernel" />
</php>
Expand All @@ -11,13 +11,15 @@
</testsuite>
</testsuites>

<coverage>
<coverage/>

<source>
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</coverage>
</source>
</phpunit>
13 changes: 5 additions & 8 deletions tests/Twig/Extension/ImExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Leapt\ImBundle\Manager;
use Leapt\ImBundle\Twig\Extension\ImExtension;
use Leapt\ImBundle\Wrapper;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Process\Process;

Expand All @@ -19,9 +20,7 @@ protected function setUp(): void
$this->imExtension = new ImExtension(new Manager(new Wrapper(Process::class), 'app/', '../web/', 'cache/im'));
}

/**
* @dataProvider providerConvert
*/
#[DataProvider('providerConvert')]
public function testConvert(string $input, string $expected): void
{
$this->assertEquals($expected, $this->imExtension->convert($input));
Expand All @@ -30,7 +29,7 @@ public function testConvert(string $input, string $expected): void
/**
* @return iterable<array<string>>
*/
public function providerConvert(): iterable
public static function providerConvert(): iterable
{
return [
['hop hop', 'hop hop'],
Expand All @@ -48,9 +47,7 @@ public function providerConvert(): iterable
];
}

/**
* @dataProvider providerImResize
*/
#[DataProvider('providerImResize')]
public function testImResize(string $filePath, string $format, string $expectedUrl): void
{
$this->assertEquals($expectedUrl, $this->imExtension->imResize($filePath, $format));
Expand All @@ -59,7 +56,7 @@ public function testImResize(string $filePath, string $format, string $expectedU
/**
* @return iterable<array<string>>
*/
public function providerImResize(): iterable
public static function providerImResize(): iterable
{
return [
['img.jpg', '100x', 'cache/im/100x/img.jpg'],
Expand Down
34 changes: 13 additions & 21 deletions tests/WrapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use org\bovigo\vfs\vfsStreamContent;
use org\bovigo\vfs\vfsStreamDirectory;
use org\bovigo\vfs\vfsStreamWrapper;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

final class WrapperTest extends TestCase
Expand All @@ -27,9 +28,8 @@ protected function setUp(): void

/**
* @param array<string|array<string|null, string>> $attributes
*
* @dataProvider providerPrepareAttributes
*/
#[DataProvider('providerPrepareAttributes')]
public function testPrepareAttributes(array $attributes, string $expected): void
{
$method = new \ReflectionMethod($this->wrapper, 'prepareAttributes');
Expand All @@ -41,7 +41,7 @@ public function testPrepareAttributes(array $attributes, string $expected): void
/**
* @return iterable<array<string|array<string|null, string>>>
*/
public function providerPrepareAttributes(): iterable
public static function providerPrepareAttributes(): iterable
{
yield 'empty_config' => [
[],
Expand All @@ -62,9 +62,7 @@ public function providerPrepareAttributes(): iterable
];
}

/**
* @dataProvider providerPrepareAttributesException
*/
#[DataProvider('providerPrepareAttributesException')]
public function testPrepareAttributesException(mixed $attributes): void
{
$this->expectException(\TypeError::class);
Expand All @@ -77,17 +75,16 @@ public function testPrepareAttributesException(mixed $attributes): void
/**
* @return iterable<array<string|object>>
*/
public function providerPrepareAttributesException(): iterable
public static function providerPrepareAttributesException(): iterable
{
yield ['some crappy string'];
yield [new \stdClass()];
}

/**
* @param array<string|array<string, string>> $attributes
*
* @dataProvider providerBuildCommand
*/
#[DataProvider('providerBuildCommand')]
public function testBuildCommand(string $command, string $inputFile, array $attributes, string $outputFile, string $expected): void
{
$method = new \ReflectionMethod($this->wrapper, 'buildCommand');
Expand All @@ -99,7 +96,7 @@ public function testBuildCommand(string $command, string $inputFile, array $attr
/**
* @return iterable<array<string|array<string, string>>>
*/
public function providerBuildCommand(): iterable
public static function providerBuildCommand(): iterable
{
yield ['convert', 'somefile', [], 'anotherfile', 'convert somefile anotherfile'];
yield ['mogrify', 'somefile', ['resize' => '450x'], '', 'mogrify -resize "450x" somefile'];
Expand All @@ -108,9 +105,8 @@ public function providerBuildCommand(): iterable

/**
* @param array<string|array<string>> $attributes
*
* @dataProvider providerBuildCommandException
*/
#[DataProvider('providerBuildCommandException')]
public function testBuildCommandException(string $command, string $inputFile, array $attributes, string $outputFile): void
{
$this->expectException(InvalidArgumentException::class);
Expand All @@ -124,7 +120,7 @@ public function testBuildCommandException(string $command, string $inputFile, ar
/**
* @return iterable<array<string|array<string>>>
*/
public function providerBuildCommandException(): iterable
public static function providerBuildCommandException(): iterable
{
yield ['ls', 'somefile', [], 'anotherfile'];
yield ['blaarhh', '', [], ''];
Expand All @@ -149,9 +145,7 @@ public function testRawRunRuntimeException(): void
$this->wrapper->rawRun('mogrify "somefailingstructure');
}

/**
* @dataProvider providerValidateCommand
*/
#[DataProvider('providerValidateCommand')]
public function testValidateCommand(string $commandString): void
{
$method = new \ReflectionMethod($this->wrapper, 'validateCommand');
Expand All @@ -163,15 +157,13 @@ public function testValidateCommand(string $commandString): void
/**
* @return iterable<array<string>>
*/
public function providerValidateCommand(): iterable
public static function providerValidateCommand(): iterable
{
yield ['convert somestrings'];
yield ['mogrify somestrings blouh +yop -paf -bim "zoup"'];
}

/**
* @dataProvider providerValidateCommandException
*/
#[DataProvider('providerValidateCommandException')]
public function testValidateCommandException(string $commandString): void
{
$this->expectException(\InvalidArgumentException::class);
Expand All @@ -185,7 +177,7 @@ public function testValidateCommandException(string $commandString): void
/**
* @return iterable<array<string>>
*/
public function providerValidateCommandException(): iterable
public static function providerValidateCommandException(): iterable
{
yield ['convert'];
yield ['bignou'];
Expand Down

0 comments on commit bb5dc3b

Please sign in to comment.