Skip to content

Commit 65ee6c9

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Revert "bug symfony#38063 [FrameworkBundle] generate preload.php in src/ to make opcache.preload predictable (nicolas-grekas)" [PhpUnitBridge] Fix class_alias() for PHPUnit\Framework\Error\Error
2 parents 8065ab4 + c4015ed commit 65ee6c9

File tree

5 files changed

+41
-23
lines changed

5 files changed

+41
-23
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\PhpUnit\Tests;
13+
14+
use PHPUnit\Framework\TestCase;
15+
16+
class BootstrapTest extends TestCase
17+
{
18+
/**
19+
* @requires PHPUnit < 6.0
20+
*/
21+
public function testAliasingOfErrorClasses()
22+
{
23+
$this->assertInstanceOf(
24+
\PHPUnit_Framework_Error::class,
25+
new \PHPUnit\Framework\Error\Error('message', 0, __FILE__, __LINE__)
26+
);
27+
$this->assertInstanceOf(
28+
\PHPUnit_Framework_Error_Deprecated::class,
29+
new \PHPUnit\Framework\Error\Deprecated('message', 0, __FILE__, __LINE__)
30+
);
31+
$this->assertInstanceOf(
32+
\PHPUnit_Framework_Error_Notice::class,
33+
new \PHPUnit\Framework\Error\Notice('message', 0, __FILE__, __LINE__)
34+
);
35+
$this->assertInstanceOf(
36+
\PHPUnit_Framework_Error_Warning::class,
37+
new \PHPUnit\Framework\Error\Warning('message', 0, __FILE__, __LINE__)
38+
);
39+
}
40+
}

src/Symfony/Bridge/PhpUnit/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
'PHPUnit_Framework_Constraint_TraversableContains',
5757
'PHPUnit_Framework_Constraint_TraversableContainsOnly',
5858

59-
'PHPUnit_Framework_Error',
6059
'PHPUnit_Framework_Error_Deprecated',
6160
'PHPUnit_Framework_Error_Notice',
6261
'PHPUnit_Framework_Error_Warning',
@@ -100,6 +99,7 @@ class_alias('PHPUnit_Framework_Constraint_And', 'PHPUnit\Framework\Constraint\Lo
10099
class_alias('PHPUnit_Framework_Constraint_Not', 'PHPUnit\Framework\Constraint\LogicalNot');
101100
class_alias('PHPUnit_Framework_Constraint_Or', 'PHPUnit\Framework\Constraint\LogicalOr');
102101
class_alias('PHPUnit_Framework_Constraint_Xor', 'PHPUnit\Framework\Constraint\LogicalXor');
102+
class_alias('PHPUnit_Framework_Error', 'PHPUnit\Framework\Error\Error');
103103
}
104104

105105
// Detect if we need to serialize deprecations to a file.

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
175175
}
176176
}
177177

178-
$kernelDir = \dirname((new \ReflectionObject($kernel))->getFileName());
179-
$preloadFile = $fs->makePathRelative(\dirname($containerFile, 2), $kernelDir);
180-
$preloadFile .= substr_replace(basename($containerFile), '.preload', -4, 0);
181-
$preloadFile = var_export('/'.$preloadFile, true);
182-
@file_put_contents($kernelDir.'/.preload.php', <<<EOPHP
183-
<?php
184-
185-
if (file_exists(__DIR__.$preloadFile)) {
186-
require __DIR__.$preloadFile;
187-
}
188-
189-
EOPHP
190-
);
191-
192178
if ($output->isVerbose()) {
193179
$io->comment('Finished');
194180
}

src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ protected function setUp(): void
3838
protected function tearDown(): void
3939
{
4040
$this->fs->remove($this->kernel->getProjectDir());
41-
$this->fs->remove(__DIR__.'/Fixture/.preload.php');
4241
}
4342

4443
public function testCacheIsFreshAfterCacheClearedWithWarmup()
@@ -83,7 +82,5 @@ public function testCacheIsFreshAfterCacheClearedWithWarmup()
8382
$containerRef = new \ReflectionClass(require $containerFile);
8483
$containerFile = str_replace('tes_'.\DIRECTORY_SEPARATOR, 'test'.\DIRECTORY_SEPARATOR, $containerRef->getFileName());
8584
$this->assertMatchesRegularExpression(sprintf('/\'kernel.container_class\'\s*=>\s*\'%s\'/', $containerClass), file_get_contents($containerFile), 'kernel.container_class is properly set on the dumped container');
86-
87-
$this->assertFileEquals(__DIR__.'/Fixture/preload.php.expected', __DIR__.'/Fixture/.preload.php');
8885
}
8986
}

src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/preload.php.expected

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

0 commit comments

Comments
 (0)