File tree 3 files changed +28
-0
lines changed
src/Symfony/Component/HttpKernel 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,9 @@ private function getContainerCompilerLogs()
138
138
$ logs = array ();
139
139
foreach (file ($ file , FILE_IGNORE_NEW_LINES ) as $ log ) {
140
140
$ log = explode (': ' , $ log , 2 );
141
+ if (!isset ($ log [1 ]) || !preg_match ('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?: \\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/ ' , $ log [0 ])) {
142
+ $ log = array ('Unknown Compiler Pass ' , implode (': ' , $ log ));
143
+ }
141
144
142
145
$ logs [$ log [0 ]][] = array ('message ' => $ log [1 ]);
143
146
}
Original file line number Diff line number Diff line change
1
+ Symfony\Component\DependencyInjection\Compiler\RemovePrivateAliasesPass: Removed service "Psr\Container\ContainerInterface"; reason: private alias.
2
+ Symfony\Component\DependencyInjection\Compiler\RemovePrivateAliasesPass: Removed service "Symfony\Component\DependencyInjection\ContainerInterface"; reason: private alias.
3
+ Some custom logging message
4
+ With ending :
Original file line number Diff line number Diff line change 17
17
18
18
class LoggerDataCollectorTest extends TestCase
19
19
{
20
+ public function testCollectWithUnexpectedFormat ()
21
+ {
22
+ $ logger = $ this ->getMockBuilder ('Symfony\Component\HttpKernel\Log\DebugLoggerInterface ' )->getMock ();
23
+ $ logger ->expects ($ this ->once ())->method ('countErrors ' )->will ($ this ->returnValue ('foo ' ));
24
+ $ logger ->expects ($ this ->exactly (2 ))->method ('getLogs ' )->will ($ this ->returnValue (array ()));
25
+
26
+ $ c = new LoggerDataCollector ($ logger , __DIR__ .'/ ' );
27
+ $ c ->lateCollect ();
28
+ $ compilerLogs = $ c ->getCompilerLogs ()->getValue ('message ' );
29
+
30
+ $ this ->assertSame (array (
31
+ array ('message ' => 'Removed service "Psr\Container\ContainerInterface"; reason: private alias. ' ),
32
+ array ('message ' => 'Removed service "Symfony\Component\DependencyInjection\ContainerInterface"; reason: private alias. ' ),
33
+ ), $ compilerLogs ['Symfony\Component\DependencyInjection\Compiler\RemovePrivateAliasesPass ' ]);
34
+
35
+ $ this ->assertSame (array (
36
+ array ('message ' => 'Some custom logging message ' ),
37
+ array ('message ' => 'With ending : ' ),
38
+ ), $ compilerLogs ['Unknown Compiler Pass ' ]);
39
+ }
40
+
20
41
/**
21
42
* @dataProvider getCollectTestData
22
43
*/
You can’t perform that action at this time.
0 commit comments