Skip to content

Commit fedf5f9

Browse files
Updates for test deprecations
1 parent 833a8a1 commit fedf5f9

File tree

14 files changed

+32
-122
lines changed

14 files changed

+32
-122
lines changed
File renamed without changes.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/composer.lock
22
/vendor/
3-
/tests/Fixtures/var/
3+
/var/

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ language: php
22

33
matrix:
44
include:
5-
- php: 7.4snapshot
5+
- php: 7.4
66
env: COMPOSER_FLAGS="--prefer-lowest"
7-
- php: 7.4snapshot
8-
- php: 7.4snapshot
7+
- php: 7.4
8+
- php: 8.0
9+
- php: 8.1
910
env: PHPUNIT_FLAGS="--coverage-text"
1011
- php: nightly
1112
fast_finish: true

phpunit.xml.dist

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
32
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
43
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/8.4/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
65
colors="true"
76
bootstrap="vendor/autoload.php"
87
>
@@ -19,11 +18,11 @@
1918
</testsuite>
2019
</testsuites>
2120

22-
<filter>
23-
<whitelist>
21+
<coverage>
22+
<include>
2423
<directory>src</directory>
25-
</whitelist>
26-
</filter>
24+
</include>
25+
</coverage>
2726

2827
<listeners>
2928
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>

tests/DataFixtures/TestFixtures.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Camelot\DoctrinePostgres\Tests\Fixtures\App\Entity\JsonEntity;
88
use Doctrine\Bundle\FixturesBundle\Fixture;
9-
use Doctrine\Common\Persistence\ObjectManager;
9+
use Doctrine\Persistence\ObjectManager;
1010

1111
final class TestFixtures extends Fixture
1212
{

tests/Fixtures/App/Kernel.php

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,55 +5,24 @@
55
namespace Camelot\DoctrinePostgres\Tests\Fixtures\App;
66

77
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
8-
use Symfony\Component\Config\Loader\LoaderInterface;
9-
use Symfony\Component\Config\Resource\FileResource;
10-
use Symfony\Component\DependencyInjection\ContainerBuilder;
118
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
12-
use Symfony\Component\Routing\RouteCollectionBuilder;
139

1410
class Kernel extends BaseKernel
1511
{
1612
use MicroKernelTrait;
1713

18-
private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
19-
20-
public function registerBundles(): iterable
21-
{
22-
$contents = require $this->getProjectDir() . '/App/config/bundles.php';
23-
foreach ($contents as $class => $envs) {
24-
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
25-
yield new $class();
26-
}
27-
}
28-
}
29-
3014
public function getProjectDir(): string
3115
{
32-
return \dirname(__DIR__);
16+
return __DIR__;
3317
}
3418

35-
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
19+
public function getCacheDir(): string
3620
{
37-
$container->addResource(new FileResource($this->getProjectDir() . '/App/config/bundles.php'));
38-
$container->setParameter('container.dumper.inline_class_loader', true);
39-
$confDir = $this->getProjectDir() . '/App/config';
40-
41-
$loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob');
42-
$loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob');
43-
$loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob');
44-
$loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob');
45-
}
46-
47-
protected function configureRoutes(RouteCollectionBuilder $routes): void
48-
{
49-
$confDir = $this->getProjectDir() . '/App/config';
50-
51-
$routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob');
52-
$routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob');
53-
$routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob');
21+
return $this->getProjectDir().'/../../../var/cache/'.$this->environment;
5422
}
5523

56-
protected function build(ContainerBuilder $container): void
24+
public function getLogDir(): string
5725
{
26+
return $this->getProjectDir().'/../../../var/log';
5827
}
5928
}

tests/Fixtures/App/Repository/JsonEntityRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Camelot\DoctrinePostgres\Tests\Fixtures\App\Entity\JsonEntity;
88
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
9-
use Doctrine\Common\Persistence\ManagerRegistry;
9+
use Doctrine\Persistence\ManagerRegistry;
1010

1111
/**
1212
* @method JsonEntity|null find($id, $lockMode = null, $lockVersion = null)

tests/Fixtures/App/bin/console

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,12 @@
33

44
use Camelot\DoctrinePostgres\Tests\Fixtures\App\Kernel;
55
use Symfony\Bundle\FrameworkBundle\Console\Application;
6-
use Symfony\Component\Console\Input\ArgvInput;
7-
use Symfony\Component\Debug\Debug;
86

9-
if (\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) === false) {
10-
echo 'Warning: The console should be invoked via the CLI version of PHP, not the ' . \PHP_SAPI . ' SAPI' . \PHP_EOL;
11-
}
7+
require_once dirname(__DIR__, 4).'/vendor/autoload_runtime.php';
128

13-
set_time_limit(0);
9+
return function (array $context) {
10+
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
1411

15-
require \dirname(__DIR__) . '/../../../vendor/autoload.php';
12+
return new Application($kernel);
13+
};
1614

17-
if (!class_exists(Application::class)) {
18-
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
19-
}
20-
21-
$input = new ArgvInput();
22-
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
23-
putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
24-
}
25-
26-
if ($input->hasParameterOption('--no-debug', true)) {
27-
putenv('APP_DEBUG=' . $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
28-
}
29-
30-
require \dirname(__DIR__) . '/config/bootstrap.php';
31-
32-
if ($_SERVER['APP_DEBUG']) {
33-
umask(0000);
34-
35-
if (class_exists(Debug::class)) {
36-
Debug::enable();
37-
}
38-
}
39-
40-
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
41-
$application = new Application($kernel);
42-
$application->run($input);

tests/Fixtures/App/config/bootstrap.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

tests/Fixtures/App/config/packages/doctrine.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ doctrine:
1010
TestAppBundle:
1111
is_bundle: false
1212
type: annotation
13-
dir: '%kernel.project_dir%/App/Entity'
13+
dir: '%kernel.project_dir%/Entity'
1414
prefix: 'Camelot\DoctrinePostgres\Tests\Fixtures\App\Entity'
1515
alias: TestAppBundle

0 commit comments

Comments
 (0)