Merge branch '3.4'

* 3.4:
  Update JsonBundleReader.php
  [HttpKernel] Clean test directory on tear down
  [Console] Remove useless http-kernel dev dep
  Fix testHtml method with regexp
  Fixed some param/return annotations in PHPDOC blocks.
  [Workflow] fixed InvalidDefinitionException message for StateMachineValidator
This commit is contained in:
Nicolas Grekas 2017-08-15 15:32:56 +02:00
commit 50b3d30e10
8 changed files with 20 additions and 18 deletions

View File

@ -19,7 +19,6 @@ use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\TypedReference;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AddConsoleCommandPassTest extends TestCase
{
@ -147,7 +146,3 @@ class AddConsoleCommandPassTest extends TestCase
class MyCommand extends Command
{
}
class ExtensionPresentBundle extends Bundle
{
}

View File

@ -22,7 +22,6 @@
},
"require-dev": {
"symfony/config": "~3.4|~4.0",
"symfony/http-kernel": "~3.4|~4.0",
"symfony/event-dispatcher": "~3.4|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/lock": "~3.4|~4.0",

View File

@ -330,7 +330,7 @@ class Container implements ResettableContainerInterface
/**
* Fetches a variable from the environment.
*
* @param string The name of the environment variable
* @param string $name The name of the environment variable
*
* @return scalar The value to use for the provided environment variable name
*

View File

@ -72,6 +72,8 @@ class Definition
/**
* Sets the tracked changes for the Definition object.
*
* @param array $changes An array of changes for this Definition
*
* @return $this
*/
public function setChanges(array $changes)
@ -402,6 +404,8 @@ class Definition
* Sets the definition templates to conditionally apply on the current definition, keyed by parent interface/class.
*
* @param $instanceof ChildDefinition[]
*
* @return $this
*/
public function setInstanceofConditionals(array $instanceof)
{

View File

@ -397,7 +397,7 @@ EOF
public function testHtml()
{
$this->assertEquals('<img alt="Bar">', $this->createTestCrawler()->filterXPath('//a[5]')->html());
$this->assertEquals('<input type="text" value="TextValue" name="TextName"><input type="submit" value="FooValue" name="FooName" id="FooId"><input type="button" value="BarValue" name="BarName" id="BarId"><button value="ButtonValue" name="ButtonName" id="ButtonId"></button>', trim($this->createTestCrawler()->filterXPath('//form[@id="FooFormId"]')->html()));
$this->assertEquals('<input type="text" value="TextValue" name="TextName"><input type="submit" value="FooValue" name="FooName" id="FooId"><input type="button" value="BarValue" name="BarName" id="BarId"><button value="ButtonValue" name="ButtonName" id="ButtonId"></button>', trim(preg_replace('~>\s+<~', '><', $this->createTestCrawler()->filterXPath('//form[@id="FooFormId"]')->html())));
try {
$this->createTestCrawler()->filterXPath('//ol')->html();

View File

@ -14,6 +14,7 @@ namespace Symfony\Component\HttpKernel\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\HttpKernel\Config\EnvParametersResource;
use Symfony\Component\HttpKernel\Kernel;
@ -26,6 +27,12 @@ use Symfony\Component\HttpKernel\Tests\Fixtures\KernelWithoutBundles;
class KernelTest extends TestCase
{
public static function tearDownAfterClass()
{
$fs = new Filesystem();
$fs->remove(__DIR__.'/Fixtures/cache');
}
public function testConstructor()
{
$env = 'test_env';

View File

@ -32,17 +32,15 @@ class JsonBundleReader implements BundleReaderInterface
if (!file_exists($fileName)) {
throw new ResourceBundleNotFoundException(sprintf(
'The resource bundle "%s/%s.json" does not exist.',
$path,
$locale
'The resource bundle "%s" does not exist.',
$fileName
));
}
if (!is_file($fileName)) {
throw new RuntimeException(sprintf(
'The resource bundle "%s/%s.json" is not a file.',
$path,
$locale
'The resource bundle "%s" is not a file.',
$fileName
));
}
@ -50,9 +48,8 @@ class JsonBundleReader implements BundleReaderInterface
if (null === $data) {
throw new RuntimeException(sprintf(
'The resource bundle "%s/%s.json" contains invalid JSON: %s',
$path,
$locale,
'The resource bundle "%s" contains invalid JSON: %s',
$fileName,
json_last_error_msg()
));
}

View File

@ -31,7 +31,7 @@ class StateMachineValidator implements DefinitionValidatorInterface
// Make sure that each transition has exactly one FROM
$froms = $transition->getFroms();
if (1 !== count($froms)) {
throw new InvalidDefinitionException(sprintf('A transition in StateMachine can only have one input. But the transition "%s" in StateMachine "%s" has %d inputs.', $transition->getName(), $name, count($transition->getTos())));
throw new InvalidDefinitionException(sprintf('A transition in StateMachine can only have one input. But the transition "%s" in StateMachine "%s" has %d inputs.', $transition->getName(), $name, count($froms)));
}
// Enforcing uniqueness of the names of transitions starting at each node