Skip to content

Commit a5f3f12

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: [HttpKernel] Fixed bug with purging of HTTPS URLs fix some risky tests [DI] [YamlFileLoader] change error message of a non existing file [Security] Added option to return true in the method isRememberMeRequested
2 parents 428006f + 9ff8bb1 commit a5f3f12

8 files changed

+46
-27
lines changed

Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ protected function loadFile($file)
353353
}
354354

355355
if (!file_exists($file)) {
356-
throw new InvalidArgumentException(sprintf('The service file "%s" is not valid.', $file));
356+
throw new InvalidArgumentException(sprintf('The file "%s" does not exist.', $file));
357357
}
358358

359359
if (null === $this->yamlParser) {

Tests/Compiler/CheckCircularReferencesPassTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ public function testProcessIgnoresMethodCalls()
114114
$container->register('b')->addMethodCall('setA', array(new Reference('a')));
115115

116116
$this->process($container);
117+
118+
$this->addToAssertionCount(1);
117119
}
118120

119121
protected function process(ContainerBuilder $container)

Tests/Compiler/CheckDefinitionValidityPassTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public function testProcess()
8585
$container->register('d', 'class')->setSynthetic(true);
8686

8787
$this->process($container);
88+
89+
$this->addToAssertionCount(1);
8890
}
8991

9092
public function testValidTags()
@@ -96,6 +98,8 @@ public function testValidTags()
9698
$container->register('d', 'class')->addTag('foo', array('bar' => 1.1));
9799

98100
$this->process($container);
101+
102+
$this->addToAssertionCount(1);
99103
}
100104

101105
/**

Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public function testProcess()
2828
->addArgument(new Reference('b'))
2929
;
3030
$container->register('b', '\stdClass');
31+
32+
$this->process($container);
33+
34+
$this->addToAssertionCount(1);
3135
}
3236

3337
/**

Tests/Compiler/CheckReferenceValidityPassTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public function testProcessIgnoresScopeWideningIfNonStrictReference()
3030
$container->register('b')->setScope('prototype');
3131

3232
$this->process($container);
33+
34+
$this->addToAssertionCount(1);
3335
}
3436

3537
/**
@@ -43,6 +45,8 @@ public function testProcessDetectsScopeWidening()
4345
$container->register('b')->setScope('prototype');
4446

4547
$this->process($container);
48+
49+
$this->addToAssertionCount(1);
4650
}
4751

4852
/**
@@ -58,6 +62,8 @@ public function testProcessIgnoresCrossScopeHierarchyReferenceIfNotStrict()
5862
$container->register('b')->setScope('b');
5963

6064
$this->process($container);
65+
66+
$this->addToAssertionCount(1);
6167
}
6268

6369
/**
@@ -96,6 +102,8 @@ public function testProcess()
96102
$container->register('b');
97103

98104
$this->process($container);
105+
106+
$this->addToAssertionCount(1);
99107
}
100108

101109
protected function process(ContainerBuilder $container)

Tests/Dumper/PhpDumperTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ public function testCircularReferenceAllowanceForLazyServices()
305305

306306
$dumper = new PhpDumper($container);
307307
$dumper->dump();
308+
309+
$this->addToAssertionCount(1);
308310
}
309311

310312
public function testCircularReferenceAllowanceForInlinedDefinitionsForLazyServices()
@@ -342,5 +344,7 @@ public function testCircularReferenceAllowanceForInlinedDefinitionsForLazyServic
342344

343345
$dumper->setProxyDumper(new DummyProxyDumper());
344346
$dumper->dump();
347+
348+
$this->addToAssertionCount(1);
345349
}
346350
}

Tests/Dumper/XmlDumperTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ public function testCompiledContainerCanBeDumped($containerFile)
162162
$container->compile();
163163
$dumper = new XmlDumper($container);
164164
$dumper->dump();
165+
166+
$this->addToAssertionCount(1);
165167
}
166168

167169
public function provideCompiledContainerData()

Tests/Loader/YamlFileLoaderTest.php

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,40 +33,33 @@ public static function setUpBeforeClass()
3333
require_once self::$fixturesPath.'/includes/ProjectExtension.php';
3434
}
3535

36-
public function testLoadFile()
36+
/**
37+
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
38+
* @expectedExceptionMessageRegExp /The file ".+" does not exist./
39+
*/
40+
public function testLoadUnExistFile()
3741
{
3842
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/ini'));
3943
$r = new \ReflectionObject($loader);
4044
$m = $r->getMethod('loadFile');
4145
$m->setAccessible(true);
4246

43-
try {
44-
$m->invoke($loader, 'foo.yml');
45-
$this->fail('->load() throws an InvalidArgumentException if the loaded file does not exist');
46-
} catch (\Exception $e) {
47-
$this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not exist');
48-
$this->assertEquals('The service file "foo.yml" is not valid.', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file does not exist');
49-
}
50-
51-
try {
52-
$m->invoke($loader, 'parameters.ini');
53-
$this->fail('->load() throws an InvalidArgumentException if the loaded file is not a valid YAML file');
54-
} catch (\Exception $e) {
55-
$this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file is not a valid YAML file');
56-
$this->assertEquals('The service file "parameters.ini" is not valid.', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file is not a valid YAML file');
57-
}
47+
$m->invoke($loader, 'foo.yml');
48+
}
5849

59-
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
50+
/**
51+
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
52+
* @expectedExceptionMessageRegExp /The file ".+" does not contain valid YAML./
53+
*/
54+
public function testLoadInvalidYamlFile()
55+
{
56+
$path = self::$fixturesPath.'/ini';
57+
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator($path));
58+
$r = new \ReflectionObject($loader);
59+
$m = $r->getMethod('loadFile');
60+
$m->setAccessible(true);
6061

61-
foreach (array('nonvalid1', 'nonvalid2') as $fixture) {
62-
try {
63-
$m->invoke($loader, $fixture.'.yml');
64-
$this->fail('->load() throws an InvalidArgumentException if the loaded file does not validate');
65-
} catch (\Exception $e) {
66-
$this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not validate');
67-
$this->assertStringMatchesFormat('The service file "nonvalid%d.yml" is not valid.', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file does not validate');
68-
}
69-
}
62+
$m->invoke($loader, $path.'/parameters.ini');
7063
}
7164

7265
/**
@@ -90,6 +83,8 @@ public function provideInvalidFiles()
9083
array('bad_service'),
9184
array('bad_calls'),
9285
array('bad_format'),
86+
array('nonvalid1'),
87+
array('nonvalid2'),
9388
);
9489
}
9590

0 commit comments

Comments
 (0)