Skip to content

Commit ceb1eed

Browse files
Merge branch '3.4' into 4.1
* 3.4: Bump phpunit bridge cache id [appveyor] fix create-project phpunit Fix HttpKernel Debug requirement Fix heredoc use final annotation to allow mocking the class synchronise the form builder docblock Grammar fix in exception message fix tests forward the parse error to the calling code [Debug][DebugClassLoader] Match more cases for final, deprecated and internal classes / methods extends ensure compatibility with older PHPUnit mocks [Security] Do not mix usage of password_*() functions and sodium_*() ones
2 parents 7aa47f7 + 990ea0d commit ceb1eed

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ private function parseFileToDOM($file)
380380
try {
381381
$dom = XmlUtils::loadFile($file, [$this, 'validateSchema']);
382382
} catch (\InvalidArgumentException $e) {
383-
throw new InvalidArgumentException(sprintf('Unable to parse file "%s".', $file), $e->getCode(), $e);
383+
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": %s', $file, $e->getMessage()), $e->getCode(), $e);
384384
}
385385

386386
$this->validateExtensions($dom, $file);

Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ protected function loadFile($file)
621621
try {
622622
$configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
623623
} catch (ParseException $e) {
624-
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $file), 0, $e);
624+
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: %s', $file, $e->getMessage()), 0, $e);
625625
}
626626

627627
return $this->validate($configuration, $file);

Tests/Loader/XmlFileLoaderTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function testParseFile()
6868
$this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
6969
} catch (\Exception $e) {
7070
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
71-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'parameters.ini'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
71+
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'parameters.ini'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
7272

7373
$e = $e->getPrevious();
7474
$this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
@@ -82,7 +82,7 @@ public function testParseFile()
8282
$this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD');
8383
} catch (\Exception $e) {
8484
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD');
85-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'nonvalid.xml'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
85+
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'nonvalid.xml'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
8686

8787
$e = $e->getPrevious();
8888
$this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD');
@@ -428,7 +428,7 @@ public function testExtensions()
428428
$this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
429429
} catch (\Exception $e) {
430430
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
431-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
431+
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
432432

433433
$e = $e->getPrevious();
434434
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
@@ -465,7 +465,7 @@ public function testExtensionInPhar()
465465
$this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
466466
} catch (\Exception $e) {
467467
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
468-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
468+
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
469469

470470
$e = $e->getPrevious();
471471
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
@@ -516,7 +516,7 @@ public function testDocTypeIsNotAllowed()
516516
$this->fail('->load() throws an InvalidArgumentException if the configuration contains a document type');
517517
} catch (\Exception $e) {
518518
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type');
519-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type');
519+
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type');
520520

521521
$e = $e->getPrevious();
522522
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type');

0 commit comments

Comments
 (0)