Skip to content

Commit

Permalink
Merge branch '4.4'
Browse files Browse the repository at this point in the history
* 4.4:
  Replace warning by isolated test
  Fix deprecation in 4.4 branche
  • Loading branch information
nicolas-grekas committed Aug 8, 2019
2 parents 3483e62 + 6888e70 commit 742b6b8
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;

use PHPUnit\Framework\Warning;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\Cache\Adapter\NullAdapter;
Expand All @@ -21,12 +20,11 @@

class ValidatorCacheWarmerTest extends TestCase
{
/**
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
*/
public function testWarmUp()
{
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}

$validatorBuilder = new ValidatorBuilder();
$validatorBuilder->addXmlMapping(__DIR__.'/../Fixtures/Validation/Resources/person.xml');
$validatorBuilder->addYamlMapping(__DIR__.'/../Fixtures/Validation/Resources/author.yml');
Expand Down
7 changes: 3 additions & 4 deletions src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,11 @@ public function testPrune()
$this->assertTrue($this->isPruned($cache, 'qux'));
}

/**
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
*/
public function testSavingObject()
{
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}

parent::testSavingObject();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Config\Tests\Resource;

use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
use Symfony\Component\Config\Resource\ClassExistenceResource;
use Symfony\Component\Config\Tests\Fixtures\BadParent;
use Symfony\Component\Config\Tests\Fixtures\Resource\ConditionalClass;
Expand Down Expand Up @@ -76,23 +75,22 @@ public function testExistsKo()
}
}

/**
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
*/
public function testBadParentWithTimestamp()
{
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}

$res = new ClassExistenceResource(BadParent::class, false);
$this->assertTrue($res->isFresh(time()));
}

/**
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
*/
public function testBadParentWithNoTimestamp()
{
$this->expectException('ReflectionException');
$this->expectExceptionMessage('Class Symfony\Component\Config\Tests\Fixtures\MissingParent not found');
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}

$res = new ClassExistenceResource(BadParent::class, false);
$res->isFresh(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;

use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Symfony\Component\Config\FileLocator;
Expand Down Expand Up @@ -350,12 +349,11 @@ public function testClassNotFoundThrowsException()
}
}

/**
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
*/
public function testParentClassNotFoundThrowsException()
{
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}

$container = new ContainerBuilder();

$aDefinition = $container->register('a', __NAMESPACE__.'\BadParentTypeHintedArgument');
Expand Down Expand Up @@ -627,12 +625,11 @@ public function getCreateResourceTests()
];
}

/**
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
*/
public function testIgnoreServiceWithClassNotExisting()
{
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}

$container = new ContainerBuilder();

$container->register('class_not_exist', __NAMESPACE__.'\OptionalServiceClass');
Expand Down Expand Up @@ -833,12 +830,11 @@ public function testExceptionWhenAliasExists()
}
}

/**
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
*/
public function testExceptionWhenAliasDoesNotExist()
{
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}

$container = new ContainerBuilder();

// multiple I instances... but no IInterface alias
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ public function testUnusedBinding()
$pass->process($container);
}

/**
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
*/
public function testMissingParent()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$this->expectExceptionMessage('A binding is configured for an argument named "$quz" for service "Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists", but no corresponding argument has been found. It may be unused and should be removed, or it may have a typo.');
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}

$container = new ContainerBuilder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Dumper;

use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
use Psr\Container\ContainerInterface;
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
use Symfony\Component\Config\FileLocator;
Expand Down Expand Up @@ -1099,12 +1098,11 @@ public function testInlineSelfRef()
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_inline_self_ref.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Inline_Self_Ref']));
}

/**
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
*/
public function testHotPathOptimizations()
{
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}

$container = include self::$fixturesPath.'/containers/container_inline_requires.php';
$container->setParameter('inline_requires', true);
$container->compile();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader;

use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
use Psr\Container\ContainerInterface as PsrContainerInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
Expand Down Expand Up @@ -107,12 +106,11 @@ public function testRegisterClasses()
);
}

/**
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
*/
public function testRegisterClassesWithExclude()
{
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}

$container = new ContainerBuilder();
$container->setParameter('other_dir', 'OtherDir');
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
Expand Down Expand Up @@ -140,12 +138,11 @@ public function testRegisterClassesWithExclude()
);
}

/**
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
*/
public function testRegisterClassesWithExcludeAsArray()
{
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}

$container = new ContainerBuilder();
$container->setParameter('sub_dir', 'Sub');
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
Expand All @@ -163,12 +160,11 @@ public function testRegisterClassesWithExcludeAsArray()
$this->assertFalse($container->has(DeeperBaz::class));
}

/**
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
*/
public function testNestedRegisterClasses()
{
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}

$container = new ContainerBuilder();
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));

Expand All @@ -195,12 +191,11 @@ public function testNestedRegisterClasses()
$this->assertFalse($alias->isPrivate());
}

/**
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
*/
public function testMissingParentClass()
{
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}

$container = new ContainerBuilder();
$container->setParameter('bad_classes_dir', 'BadClasses');
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public function testRecursionInArguments()

$flattened = FlattenException::createFromThrowable($exception);
$trace = $flattened->getTrace();
$this->assertContains('*DEEP NESTED ARRAY*', serialize($trace));
$this->assertStringContainsString('*DEEP NESTED ARRAY*', serialize($trace));
}

public function testTooBigArray()
Expand All @@ -329,8 +329,8 @@ public function testTooBigArray()

$serializeTrace = serialize($trace);

$this->assertContains('*SKIPPED over 10000 entries*', $serializeTrace);
$this->assertNotContains('*value1*', $serializeTrace);
$this->assertStringContainsString('*SKIPPED over 10000 entries*', $serializeTrace);
$this->assertStringNotContainsString('*value1*', $serializeTrace);
}

public function testAnonymousClass()
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Mime/Tests/Crypto/SMimeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function iterableToString(iterable $iterable): string
protected function assertMessageHeaders(Message $message, RawMessage $originalMessage): void
{
$messageString = $message->toString();
self::assertNotContains('Bcc: ', $messageString, '', true);
self::assertStringNotContainsString('Bcc: ', $messageString, '', true);

if (!$originalMessage instanceof Message) {
return;
Expand All @@ -67,7 +67,7 @@ protected function assertMessageHeaders(Message $message, RawMessage $originalMe

if ($originalMessage->getHeaders()->has('Subject')) {
self::assertEquals($originalMessage->getHeaders()->get('Subject'), $message->getPreparedHeaders()->get('Subject'));
self::assertContains('Subject:', $messageString, '', true);
self::assertStringContainsString('Subject:', $messageString, '', true);
}
}
}
3 changes: 0 additions & 3 deletions src/Symfony/Component/VarExporter/Tests/VarExporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ public function provideFailingSerialization()
*/
public function testExport(string $testName, $value, bool $staticValueExpected = false)
{
if (\PHP_VERSION_ID >= 70400 && 'datetime' === $testName) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78383.');
}
if (\PHP_VERSION_ID >= 70400 && \in_array($testName, ['spl-object-storage', 'array-object-custom', 'array-iterator', 'array-object', 'final-array-iterator'])) {
throw new Warning('PHP 7.4 breaks this test.');
}
Expand Down

0 comments on commit 742b6b8

Please sign in to comment.