Merge branch '2.5' into 2.6

* 2.5:
  [Filesystem] enforce umask while testing
  [TwigBridge] moved fixtures into their own directory
  Use $this->iniSet() in tests
This commit is contained in:
Fabien Potencier 2015-01-03 22:13:09 +01:00
commit fb23abe18d
11 changed files with 9 additions and 8 deletions

View File

@ -42,7 +42,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
$loader = new StubFilesystemLoader(array(
__DIR__.'/../../Resources/views/Form',
__DIR__,
__DIR__.'/Fixtures/templates/form',
));
$environment = new \Twig_Environment($loader, array('strict_variables' => true));

View File

@ -41,7 +41,7 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest
$loader = new StubFilesystemLoader(array(
__DIR__.'/../../Resources/views/Form',
__DIR__,
__DIR__.'/Fixtures/templates/form',
));
$environment = new \Twig_Environment($loader, array('strict_variables' => true));

View File

@ -62,17 +62,14 @@ class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase
public function testUnsilencing()
{
ob_start();
$bak = array(
ini_set('log_errors', 0),
ini_set('display_errors', 1),
);
$this->iniSet('log_errors', 0);
$this->iniSet('display_errors', 1);
// See below: this will fail with parse error
// but this should not be @-silenced.
@class_exists(__NAMESPACE__.'\TestingUnsilencing', true);
ini_set('log_errors', $bak[0]);
ini_set('display_errors', $bak[1]);
$output = ob_get_clean();
$this->assertStringMatchesFormat('%aParse error%a', $output);

View File

@ -13,6 +13,8 @@ namespace Symfony\Component\Filesystem\Tests;
class FilesystemTestCase extends \PHPUnit_Framework_TestCase
{
private $umask;
/**
* @var string $workspace
*/
@ -37,6 +39,7 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
public function setUp()
{
$this->umask = umask(0);
$this->workspace = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.time().rand(0, 1000);
mkdir($this->workspace, 0777, true);
$this->workspace = realpath($this->workspace);
@ -45,6 +48,7 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
public function tearDown()
{
$this->clean($this->workspace);
umask($this->umask);
}
/**