Skip to content

Commit

Permalink
Merge pull request #36 from gsteel/phpunit-10
Browse files Browse the repository at this point in the history
Remove support for PHP 8.0, Upgrade PHPUnit to 10.x
  • Loading branch information
gsteel authored Jul 25, 2023
2 parents b258af4 + fe79859 commit 3dfc9c6
Show file tree
Hide file tree
Showing 30 changed files with 302 additions and 610 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"laminas/laminas-stdlib": "^3.2"
},
"require-dev": {
"laminas/laminas-coding-standard": "~2.4.0",
"phpunit/phpunit": "^9.5.25"
"laminas/laminas-coding-standard": "~2.5.0",
"phpunit/phpunit": "^10.2.6"
},
"autoload": {
"psr-4": {
Expand Down
722 changes: 267 additions & 455 deletions composer.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<ruleset name="Laminas coding standard">
<rule ref="./vendor/laminas/laminas-coding-standard/src/LaminasCodingStandard/ruleset.xml"/>
<arg value="nps" />

<!-- Paths to check -->
<file>src</file>
Expand Down
5 changes: 2 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
<directory>./test</directory>
</testsuite>
</testsuites>

<coverage includeUncoveredFiles="true">
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
</source>
</phpunit>
4 changes: 0 additions & 4 deletions src/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer\Adapter;
Expand Down
4 changes: 0 additions & 4 deletions src/Adapter/AdapterInterface.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer\Adapter;
Expand Down
4 changes: 0 additions & 4 deletions src/Adapter/AdapterOptions.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer\Adapter;
Expand Down
4 changes: 0 additions & 4 deletions src/Adapter/IgBinary.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer\Adapter;
Expand Down
4 changes: 0 additions & 4 deletions src/Adapter/Json.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer\Adapter;
Expand Down
4 changes: 0 additions & 4 deletions src/Adapter/JsonOptions.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer\Adapter;
Expand Down
4 changes: 0 additions & 4 deletions src/Adapter/PhpCode.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer\Adapter;
Expand Down
4 changes: 0 additions & 4 deletions src/Adapter/PhpSerialize.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer\Adapter;
Expand Down
4 changes: 0 additions & 4 deletions src/Adapter/PhpSerializeOptions.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer\Adapter;
Expand Down
4 changes: 0 additions & 4 deletions src/AdapterPluginManager.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer;
Expand Down
4 changes: 0 additions & 4 deletions src/AdapterPluginManagerFactory.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer;
Expand Down
4 changes: 0 additions & 4 deletions src/ConfigProvider.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer;
Expand Down
4 changes: 0 additions & 4 deletions src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer\Exception;
Expand Down
4 changes: 0 additions & 4 deletions src/Exception/ExtensionNotLoadedException.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer\Exception;
Expand Down
7 changes: 0 additions & 7 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer\Exception;

/**
* @used InvalidArgumentException
*/
class InvalidArgumentException extends \InvalidArgumentException implements
ExceptionInterface
{
Expand Down
7 changes: 0 additions & 7 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer\Exception;

/**
* @used RuntimeException
*/
class RuntimeException extends \RuntimeException implements ExceptionInterface
{
}
4 changes: 0 additions & 4 deletions src/Module.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer;
Expand Down
4 changes: 0 additions & 4 deletions src/Serializer.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace Laminas\Serializer;
Expand Down
10 changes: 2 additions & 8 deletions test/Adapter/IgBinaryTest.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace LaminasTest\Serializer\Adapter;

use Laminas\Serializer;
use Laminas\Serializer\Adapter\IgBinary;
use Laminas\Serializer\Exception\ExtensionNotLoadedException;
use Laminas\Serializer\Exception\RuntimeException;
use PHPUnit\Framework\TestCase;
Expand All @@ -17,10 +14,7 @@
use function extension_loaded;
use function igbinary_serialize;

/**
* @group Laminas_Serializer
* @covers \Laminas\Serializer\Adapter\IgBinary
*/
#[CoversClass(IgBinary::class)]
class IgBinaryTest extends TestCase
{
/** @var Serializer\Adapter\IgBinary */
Expand Down
10 changes: 2 additions & 8 deletions test/Adapter/JsonTest.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace LaminasTest\Serializer\Adapter;

use Laminas\Json\Json;
use Laminas\Serializer;
use Laminas\Serializer\Exception\RuntimeException;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use stdClass;

/**
* @group Laminas_Serializer
* @covers \Laminas\Serializer\Adapter\Json
*/
#[CoversClass(Serializer\Adapter\Json::class)]
class JsonTest extends TestCase
{
/** @var Serializer\Adapter\Json */
Expand Down
33 changes: 14 additions & 19 deletions test/Adapter/PhpCodeTest.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
<?php

/**
* @see https://github.com/laminas/laminas-serializer for the canonical source repository
*/

declare(strict_types=1);

namespace LaminasTest\Serializer\Adapter;

use Laminas\Serializer;
use Laminas\Serializer\Adapter\PhpCode;
use LaminasTest\Serializer\TestAsset\Dummy;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

use function var_export;

/**
* @covers \Laminas\Serializer\Adapter\PhpCode
*/
#[CoversClass(PhpCode::class)]
class PhpCodeTest extends TestCase
{
/** @var Serializer\Adapter\PhpCode */
Expand All @@ -39,29 +35,28 @@ public function testSerializeObject(): void
}

/* TODO: PHP Fatal error: Call to undefined method stdClass::__set_state()
public function testUnserializeObject()
{
$value = "stdClass::__set_state(array(\n))";
$expected = new stdClass();
$data = $this->adapter->unserialize($value);
$this->assertEquals($expected, $data);
}
*/
public function testUnserializeObject()
{
$value = "stdClass::__set_state(array(\n))";
$expected = new stdClass();
$data = $this->adapter->unserialize($value);
$this->assertEquals($expected, $data);
}
*/
/**
* @dataProvider serializedValuesProvider
* @param mixed $unserialized
*/
#[DataProvider('serializedValuesProvider')]
public function testSerialize($unserialized, string $serialized): void
{
$this->assertEquals($serialized, $this->adapter->serialize($unserialized));
}

/**
* @dataProvider serializedValuesProvider
* @param mixed $unserialized
*/
#[DataProvider('serializedValuesProvider')]
public function testUnserialize($unserialized, string $serialized): void
{
$this->assertEquals($unserialized, $this->adapter->unserialize($serialized));
Expand All @@ -70,7 +65,7 @@ public function testUnserialize($unserialized, string $serialized): void
/**
* @return array<string, array<int, string|mixed>>
*/
public function serializedValuesProvider(): array
public static function serializedValuesProvider(): array
{
return [
// Description => [unserialized, serialized]
Expand Down
Loading

0 comments on commit 3dfc9c6

Please sign in to comment.