Skip to content

Commit f6da5dd

Browse files
committed
fix remaining risky tests
1 parent 2c4e186 commit f6da5dd

File tree

4 files changed

+47
-15
lines changed

4 files changed

+47
-15
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,22 +166,36 @@ public function testAddTaggedGuessers()
166166
/**
167167
* @dataProvider privateTaggedServicesProvider
168168
*/
169-
public function testPrivateTaggedServices($id, $tagName, array $tagAttributes = array())
169+
public function testPrivateTaggedServices($id, $tagName, $argumentKey, $expectedArgument, array $tagAttributes = array())
170170
{
171-
$container = $this->createContainerBuilder();
171+
$formPass = new FormPass();
172+
$container = new ContainerBuilder();
172173

173174
$container->setDefinition('form.extension', $this->createExtensionDefinition());
174175
$container->register($id, 'stdClass')->setPublic(false)->addTag($tagName, $tagAttributes);
175176

176-
$container->compile();
177+
$formPass->process($container);
178+
179+
$this->assertEquals($expectedArgument, $container->getDefinition('form.extension')->getArgument($argumentKey));
177180
}
178181

179182
public function privateTaggedServicesProvider()
180183
{
181184
return array(
182-
array('my.type', 'form.type'),
183-
array('my.type_extension', 'form.type_extension', array('extended_type' => 'Symfony\Component\Form\Extension\Core\Type\FormType')),
184-
array('my.guesser', 'form.type_guesser'),
185+
array(
186+
'my.type',
187+
'form.type',
188+
0,
189+
new Reference('service_locator.c35554e29b2a3001b879847fc6a49848'),
190+
),
191+
array(
192+
'my.type_extension',
193+
'form.type_extension',
194+
1,
195+
array('Symfony\Component\Form\Extension\Core\Type\FormType' => new IteratorArgument(array(new Reference('my.type_extension')))),
196+
array('extended_type' => 'Symfony\Component\Form\Extension\Core\Type\FormType'),
197+
),
198+
array('my.guesser', 'form.type_guesser', 2, new IteratorArgument(array(new Reference('my.guesser')))),
185199
);
186200
}
187201

src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ public function testProcessIgnoresLazyServices()
126126
$container->register('b')->addArgument(new Reference('a'));
127127

128128
$this->process($container);
129+
130+
// just make sure that a lazily loaded service does not trigger a CircularReferenceException
131+
$this->addToAssertionCount(1);
129132
}
130133

131134
public function testProcessIgnoresIteratorArguments()
@@ -135,6 +138,9 @@ public function testProcessIgnoresIteratorArguments()
135138
$container->register('b')->addArgument(new IteratorArgument(array(new Reference('a'))));
136139

137140
$this->process($container);
141+
142+
// just make sure that an IteratorArgument does not trigger a CircularReferenceException
143+
$this->addToAssertionCount(1);
138144
}
139145

140146
protected function process(ContainerBuilder $container)

src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,21 +164,35 @@ public function testAddTaggedGuessers()
164164
/**
165165
* @dataProvider privateTaggedServicesProvider
166166
*/
167-
public function testPrivateTaggedServices($id, $tagName, array $tagAttributes = array())
167+
public function testPrivateTaggedServices($id, $tagName, $argumentKey, $expectedArgument, array $tagAttributes = array())
168168
{
169-
$container = $this->createContainerBuilder();
169+
$formPass = new FormPass();
170+
$container = new ContainerBuilder();
170171

171172
$container->setDefinition('form.extension', $this->createExtensionDefinition());
172173
$container->register($id, 'stdClass')->setPublic(false)->addTag($tagName, $tagAttributes);
173-
$container->compile();
174+
$formPass->process($container);
175+
176+
$this->assertEquals($expectedArgument, $container->getDefinition('form.extension')->getArgument($argumentKey));
174177
}
175178

176179
public function privateTaggedServicesProvider()
177180
{
178181
return array(
179-
array('my.type', 'form.type'),
180-
array('my.type_extension', 'form.type_extension', array('extended_type' => 'Symfony\Component\Form\Extension\Core\Type\FormType')),
181-
array('my.guesser', 'form.type_guesser'),
182+
array(
183+
'my.type',
184+
'form.type',
185+
0,
186+
new Reference('service_locator.c35554e29b2a3001b879847fc6a49848'),
187+
),
188+
array(
189+
'my.type_extension',
190+
'form.type_extension',
191+
1,
192+
array('Symfony\Component\Form\Extension\Core\Type\FormType' => new IteratorArgument(array(new Reference('my.type_extension')))),
193+
array('extended_type' => 'Symfony\Component\Form\Extension\Core\Type\FormType'),
194+
),
195+
array('my.guesser', 'form.type_guesser', 2, new IteratorArgument(array(new Reference('my.guesser')))),
182196
);
183197
}
184198

src/Symfony/Component/Security/Core/Tests/Authorization/TraceableAccessDecisionManagerTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ public function testDebugAccessDecisionManagerAliasExistsForBC()
4747
{
4848
$adm = new TraceableAccessDecisionManager(new AccessDecisionManager());
4949

50-
if (!$adm instanceof DebugAccessDecisionManager) {
51-
$this->fail('For BC, TraceableAccessDecisionManager must be an instance of DebugAccessDecisionManager');
52-
}
50+
$this->assertInstanceOf(DebugAccessDecisionManager::class, $adm, 'For BC, TraceableAccessDecisionManager must be an instance of DebugAccessDecisionManager');
5351
}
5452
}

0 commit comments

Comments
 (0)