Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3f31266

Browse filesBrowse files
committed
minor #23689 [ProxyManager] Cleanup fixtures (nicolas-grekas)
This PR was merged into the 2.7 branch. Discussion ---------- [ProxyManager] Cleanup fixtures | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Just noticed that these fixture files are not maintainable. And we don't need them at all in fact, let's drop them. Commits ------- 31843d6 [ProxyManager] Cleanup fixtures
2 parents a96d85e + 31843d6 commit 3f31266
Copy full SHA for 3f31266

File tree

Expand file treeCollapse file tree

4 files changed

+21
-386
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+21
-386
lines changed

‎src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Dumper/PhpDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Dumper/PhpDumperTest.php
+20-20Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,9 @@ class PhpDumperTest extends TestCase
2626
{
2727
public function testDumpContainerWithProxyService()
2828
{
29-
$container = new ContainerBuilder();
30-
31-
$container->register('foo', 'stdClass');
32-
$container->getDefinition('foo')->setLazy(true);
33-
$container->compile();
34-
35-
$dumper = new PhpDumper($container);
36-
37-
$dumper->setProxyDumper(new ProxyDumper());
38-
39-
$dumpedString = $dumper->dump();
40-
4129
$this->assertStringMatchesFormatFile(
4230
__DIR__.'/../Fixtures/php/lazy_service_structure.txt',
43-
$dumpedString,
31+
$this->dumpLazyServiceProjectServiceContainer(),
4432
'->dump() does generate proxy lazy loading logic.'
4533
);
4634
}
@@ -50,18 +38,15 @@ public function testDumpContainerWithProxyService()
5038
*/
5139
public function testDumpContainerWithProxyServiceWillShareProxies()
5240
{
53-
// detecting ProxyManager v2
54-
if (class_exists('ProxyManager\ProxyGenerator\LazyLoading\MethodGenerator\StaticProxyConstructor')) {
55-
require_once __DIR__.'/../Fixtures/php/lazy_service_with_hints.php';
56-
} else {
57-
require_once __DIR__.'/../Fixtures/php/lazy_service.php';
41+
if (!class_exists('LazyServiceProjectServiceContainer', false)) {
42+
eval('?>'.$this->dumpLazyServiceProjectServiceContainer());
5843
}
5944

6045
$container = new \LazyServiceProjectServiceContainer();
6146

62-
/* @var $proxy \stdClass_c1d194250ee2e2b7d2eab8b8212368a8 */
6347
$proxy = $container->get('foo');
64-
$this->assertInstanceOf('stdClass_c1d194250ee2e2b7d2eab8b8212368a8', $proxy);
48+
$this->assertInstanceOf('stdClass', $proxy);
49+
$this->assertInstanceOf('ProxyManager\Proxy\LazyLoadingInterface', $proxy);
6550
$this->assertSame($proxy, $container->get('foo'));
6651

6752
$this->assertFalse($proxy->isProxyInitialized());
@@ -71,4 +56,19 @@ public function testDumpContainerWithProxyServiceWillShareProxies()
7156
$this->assertTrue($proxy->isProxyInitialized());
7257
$this->assertSame($proxy, $container->get('foo'));
7358
}
59+
60+
private function dumpLazyServiceProjectServiceContainer()
61+
{
62+
$container = new ContainerBuilder();
63+
64+
$container->register('foo', 'stdClass');
65+
$container->getDefinition('foo')->setLazy(true);
66+
$container->compile();
67+
68+
$dumper = new PhpDumper($container);
69+
70+
$dumper->setProxyDumper(new ProxyDumper());
71+
72+
return $dumper->dump(array('class' => 'LazyServiceProjectServiceContainer'));
73+
}
7474
}

‎src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php
-185Lines changed: 0 additions & 185 deletions
This file was deleted.

‎src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
use %a
4-
class ProjectServiceContainer extends Container
4+
class LazyServiceProjectServiceContainer extends Container
55
{%a
66
public function getFooService($lazyLoad = true)
77
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.