Skip to content

Commit

Permalink
PHPUnit9 support
Browse files Browse the repository at this point in the history
- Apply composer recipes:install phpunit/phpunit --force -v
  - see https://symfony.com/doc/5.4/testing.html
  • Loading branch information
nanasess committed Apr 27, 2022
1 parent 1b94d6a commit 766225d
Show file tree
Hide file tree
Showing 200 changed files with 271 additions and 262 deletions.
6 changes: 0 additions & 6 deletions bin/phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-php
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}
if (false === getenv('SYMFONY_PHPUNIT_VERSION')) {
putenv('SYMFONY_PHPUNIT_VERSION=8.3');
}
if (false === getenv('SYMFONY_PHPUNIT_REMOVE')) {
putenv('SYMFONY_PHPUNIT_REMOVE=symfony/yaml');
}
if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
}
Expand Down
45 changes: 27 additions & 18 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,40 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/7.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
convertDeprecationsToExceptions="false"
>
<php>
<ini name="display_errors" value="1" />
<ini name="error_reporting" value="-1" />
<env name="KERNEL_CLASS" value="Eccube\Kernel" />
<env name="APP_ENV" value="test" />
<env name="APP_DEBUG" value="1" />
<env name="SHELL_VERBOSITY" value="-1" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
<!-- define your env variables for the test env here -->
<server name="KERNEL_CLASS" value="Eccube\Kernel" />
<server name="SYMFONY_DEPRECATIONS_HELPER" value="999999" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="symfony/yaml" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
</php>

<testsuites>
<testsuite name="Project Test Suite">
<directory>tests/</directory>
<directory>tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src/</directory>
<exclude>
<directory suffix=".php">./src/Eccube/Resource</directory>
<directory suffix=".php">./src/Eccube/Command</directory>
</exclude>
</whitelist>
</filter>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
<exclude>
<directory suffix=".php">./src/Eccube/Resource</directory>
<directory suffix=".php">./src/Eccube/Command</directory>
</exclude>
</coverage>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
<listener class="\DAMA\DoctrineTestBundle\PHPUnit\PHPUnitListener" />
</listeners>

<!-- Run `composer require symfony/panther` before enabling this extension -->
<!--
<extensions>
<extension class="Symfony\Component\Panther\ServerExtension" />
</extensions>
-->
</phpunit>
13 changes: 9 additions & 4 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,18 @@
"version": "1.0.9"
},
"phpunit/phpunit": {
"version": "4.7",
"version": "9.5",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.7",
"ref": "c276fa48d4713de91eb410289b3b1834acb7e403"
}
"version": "9.3",
"ref": "a6249a6c4392e9169b87abf93225f7f9f59025e6"
},
"files": [
".env.test",
"phpunit.xml.dist",
"tests/bootstrap.php"
]
},
"psr/cache": {
"version": "1.0.1"
Expand Down
2 changes: 1 addition & 1 deletion tests/Eccube/Tests/Command/AbstractCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ abstract class AbstractCommandTest extends EccubeTestCase
*/
protected $loopCheckSum = 0;

public function tearDown()
protected function tearDown(): void
{
parent::tearDown();
Application::clearInstance();
Expand Down
4 changes: 2 additions & 2 deletions tests/Eccube/Tests/Command/CsvLoaderCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class CsvLoaderCommandTest extends AbstractCommandTest
/** @var \SplFileObject */
protected $file;

public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
self::markTestIncomplete();
}

public function setUp()
protected function setUp(): void
{
$this->markTestIncomplete(get_class($this).' は未実装です');
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class UpdateSchemaDoctrineCommandTest extends EccubeTestCase

const NAME = 'eccube:schema:update';

public function setUp()
protected function setUp(): void
{
parent::setUp();
$conn = $this->entityManager->getConnection();
Expand All @@ -68,7 +68,7 @@ public function setUp()
$this->schemaService = self::$container->get(SchemaService::class);
}

public function tearDown()
protected function tearDown(): void
{
$schema = $this->getSchemaManager();
$columns = $schema->listTableColumns('dtb_customer');
Expand Down
2 changes: 1 addition & 1 deletion tests/Eccube/Tests/Common/EccubeConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class EccubeConfigTest extends TestCase
*/
protected $eccubeConfig;

public function setup()
protected function setup(): void
{
$container = new Container();
$this->eccubeConfig = new EccubeConfig($container);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PluginPassTest extends TestCase
*/
private $containerBuilder;

public function setUp()
protected function setUp(): void
{
$this->containerBuilder = new ContainerBuilder();
$this->containerBuilder->register(\Plugin\Sample\TestClass::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PurchaseFlowPassTest extends EccubeTestCase
{
public static $called = false;

public function setUp()
protected function setUp(): void
{
self::$called = false;
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TwigExtensionPassTest extends TestCase
/** @var ContainerBuilder */
protected $containerBuilder;

public function setUp()
protected function setUp(): void
{
$this->containerBuilder = new ContainerBuilder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CsvFixtureTest extends EccubeTestCase
/**
* {@inheritdoc}
*/
public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class DbalExecutorTest extends EccubeTestCase
/**
* {@inheritdoc}
*/
public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class LoaderTest extends EccubeTestCase
/**
* {@inheritdoc}
*/
public function setUp()
protected function setUp(): void
{
parent::setUp();
$this->loader = new Loader();
Expand Down
4 changes: 2 additions & 2 deletions tests/Eccube/Tests/Doctrine/ORM/Tools/PaginationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class PaginationTest extends EccubeTestCase
* @throws \Doctrine\ORM\ORMException
* @throws \Doctrine\ORM\OptimisticLockException
*/
public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down Expand Up @@ -104,7 +104,7 @@ public function setUp()
}
}

public function tearDown()
protected function tearDown(): void
{
/** @var EntityManager $em */
$em = $this->entityManager;
Expand Down
2 changes: 1 addition & 1 deletion tests/Eccube/Tests/Doctrine/TimeZone/TimeZoneTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TimeZoneTest extends EccubeTestCase
*
* @throws \Doctrine\DBAL\DBALException
*/
public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
5 changes: 2 additions & 3 deletions tests/Eccube/Tests/EccubeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ abstract class EccubeTestCase extends WebTestCase
/**
* Client を生成しトランザクションを開始する.
*/
public function setUp()
protected function setUp(): void
{
parent::setUp();
self::bootKernel();
$this->client = static::createClient();
$this->entityManager = self::$container->get('doctrine')->getManager();
$this->eccubeConfig = self::$container->get(EccubeConfig::class);
Expand All @@ -69,7 +68,7 @@ public function setUp()
/**
* トランザクションをロールバックする.
*/
public function tearDown()
protected function tearDown(): void
{
parent::tearDown();

Expand Down
2 changes: 1 addition & 1 deletion tests/Eccube/Tests/Entity/DeliveryDurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DeliveryDurationTest extends EccubeTestCase
{
private $deliveryDurationRepository;

public function setUp()
protected function setUp(): void
{
parent::setUp();
$this->deliveryDurationRepository = $this->entityManager->getRepository(DeliveryDuration::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class AbstractMasterEntityTest extends EccubeTestCase
{
public function setUp()
protected function setUp(): void
{
parent::setUp();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Eccube/Tests/Entity/OrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class OrderTest extends EccubeTestCase
protected $Order;
protected $rate;

public function setUp()
protected function setUp(): void
{
parent::setUp();
$this->Customer = $this->createCustomer();
Expand Down
2 changes: 1 addition & 1 deletion tests/Eccube/Tests/Form/Type/AbstractTypeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class AbstractTypeTestCase extends EccubeTestCase
*/
protected $formFactory;

public function setUp()
protected function setUp(): void
{
parent::setUp();
$this->formFactory = self::$container->get('form.factory');
Expand Down
2 changes: 1 addition & 1 deletion tests/Eccube/Tests/Form/Type/AddressTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AddressTypeTest extends AbstractTypeTestCase
],
];

public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AuthenticationTypeTest extends AbstractTypeTestCase
'authentication_key' => 'abc123ABCZz',
];

public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/Eccube/Tests/Form/Type/Admin/CalendarTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CalendarTypeTest extends AbstractTypeTestCase
/** @var FormInterface */
protected $form;

public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/Eccube/Tests/Form/Type/Admin/CategoryTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CategoryTypeTest extends \Eccube\Tests\Form\Type\AbstractTypeTestCase
'name' => 'テスト家具',
];

public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CustomerSearchTypeTest extends \Eccube\Tests\Form\Type\AbstractTypeTestCas
/** @var \Symfony\Component\Form\FormInterface */
protected $form;

public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/Eccube/Tests/Form/Type/Admin/CustomerTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CustomerTypeTest extends \Eccube\Tests\Form\Type\AbstractTypeTestCase
'note' => 'note',
];

public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/Eccube/Tests/Form/Type/Admin/DeliveryFeeTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getValidTestData()
];
}

public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DeliveryTimeTypeTest extends \Eccube\Tests\Form\Type\AbstractTypeTestCase
'sort_no' => '1',
];

public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/Eccube/Tests/Form/Type/Admin/LayoutTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class LayoutTypeTest extends AbstractTypeTestCase
'Page' => 2,
];

public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
4 changes: 2 additions & 2 deletions tests/Eccube/Tests/Form/Type/Admin/LogTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class LogTypeTest extends \Eccube\Tests\Form\Type\AbstractTypeTestCase

protected $logTest;

public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand All @@ -53,7 +53,7 @@ public function setUp()
->getForm();
}

public function tearDown()
protected function tearDown(): void
{
// Delete the previously created file
@unlink($this->logTest);
Expand Down
Loading

0 comments on commit 766225d

Please sign in to comment.