2012-04-13 14:11:54 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of the Symfony package.
|
|
|
|
*
|
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Nelmio\ApiDocBundle\Tests;
|
|
|
|
|
2024-06-18 00:19:53 +03:00
|
|
|
use PHPUnit\Util\ErrorHandler;
|
2012-04-13 14:11:54 +02:00
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
|
2019-04-24 12:55:08 +03:00
|
|
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
2012-04-13 14:11:54 +02:00
|
|
|
use Symfony\Component\HttpKernel\Kernel;
|
2024-06-18 12:30:31 +03:00
|
|
|
use Symfony\Component\HttpKernel\KernelInterface;
|
2012-04-13 14:11:54 +02:00
|
|
|
|
|
|
|
abstract class WebTestCase extends BaseWebTestCase
|
|
|
|
{
|
2015-10-23 10:07:45 +02:00
|
|
|
public static $container;
|
|
|
|
|
2024-06-18 00:19:53 +03:00
|
|
|
protected function setUp(): void
|
2013-11-14 14:18:00 +01:00
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
if (version_compare(Kernel::VERSION, '2.2.0', '<')) {
|
|
|
|
$this->markTestSkipped('Does not work with Symfony2 2.1 due to a "host" parameter in the `routing.yml` file');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-18 00:19:53 +03:00
|
|
|
public static function handleDeprecation($errorNumber, $message, $file, $line)
|
2013-02-15 13:33:05 +01:00
|
|
|
{
|
|
|
|
if ($errorNumber & E_USER_DEPRECATED) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2024-06-18 00:19:53 +03:00
|
|
|
return ErrorHandler::handleError($errorNumber, $message, $file, $line);
|
2013-02-15 13:33:05 +01:00
|
|
|
}
|
|
|
|
|
2024-06-18 12:30:31 +03:00
|
|
|
protected static function getKernelClass(): string
|
2012-04-13 14:11:54 +02:00
|
|
|
{
|
|
|
|
require_once __DIR__.'/Fixtures/app/AppKernel.php';
|
|
|
|
|
|
|
|
return 'Nelmio\ApiDocBundle\Tests\Functional\AppKernel';
|
|
|
|
}
|
|
|
|
|
2024-06-18 12:30:31 +03:00
|
|
|
protected static function createKernel(array $options = array()): KernelInterface
|
2012-04-13 14:11:54 +02:00
|
|
|
{
|
|
|
|
$class = self::getKernelClass();
|
|
|
|
|
|
|
|
return new $class(
|
|
|
|
'default',
|
|
|
|
isset($options['debug']) ? $options['debug'] : true
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|