Merge branch '2.7' into 2.8

* 2.7:
  Update JsonBundleReader.php
  [HttpKernel] Clean test directory on tear down
  Fix testHtml method with regexp
This commit is contained in:
Nicolas Grekas 2017-08-15 15:30:53 +02:00
commit 6434a00f10
3 changed files with 14 additions and 10 deletions

View File

@ -373,7 +373,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

@ -13,6 +13,7 @@ namespace Symfony\Component\HttpKernel\Tests;
use PHPUnit\Framework\TestCase;
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;
@ -25,6 +26,12 @@ use Symfony\Component\HttpKernel\Tests\Fixtures\FooBarBundle;
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()
));
}