From b0df3a7eb9afd93bf07f875cc429cc05b1b7d12b Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Sun, 16 Oct 2016 22:09:25 +0200 Subject: [PATCH] PHP CS Fixer: use php_unit_dedicate_assert --- .php_cs | 1 + .../Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php | 2 +- .../Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php | 4 ++-- .../Extension/Validator/Type/BaseValidatorExtensionTest.php | 4 ++-- .../Component/OptionsResolver/Tests/LegacyOptionsTest.php | 4 ++-- .../Component/Translation/Tests/Dumper/FileDumperTest.php | 4 ++-- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.php_cs b/.php_cs index 6043614819..5a702adb3a 100644 --- a/.php_cs +++ b/.php_cs @@ -6,6 +6,7 @@ return Symfony\CS\Config\Config::create() ->fixers(array( 'long_array_syntax', 'php_unit_construct', + 'php_unit_dedicate_assert', )) ->finder( Symfony\CS\Finder\DefaultFinder::create() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php index a8741124fd..2d422b0292 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php @@ -30,7 +30,7 @@ class ProfilerTest extends WebTestCase $client->enableProfiler(); $crawler = $client->request('GET', '/profiler'); $profile = $client->getProfile(); - $this->assertTrue(is_object($profile)); + $this->assertInternalType('object', $profile); $client->request('GET', '/profiler'); $this->assertFalse($client->getProfile()); diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php index 0b04f81af0..b51e619a9d 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php @@ -28,7 +28,7 @@ class NewCacheWamingTest extends \PHPUnit_Framework_TestCase $warmer->enableOptionalWarmers(); $warmer->warmUp($kernel->getCacheDir()); - $this->assertTrue(file_exists($kernel->getCacheDir().'/twig')); + $this->assertFileExists($kernel->getCacheDir().'/twig'); } public function testCacheIsNotWarmedWhenTemplatingIsDisabled() @@ -40,7 +40,7 @@ class NewCacheWamingTest extends \PHPUnit_Framework_TestCase $warmer->enableOptionalWarmers(); $warmer->warmUp($kernel->getCacheDir()); - $this->assertFalse(file_exists($kernel->getCacheDir().'/twig')); + $this->assertFileNotExists($kernel->getCacheDir().'/twig'); } protected function setUp() diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/BaseValidatorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/BaseValidatorExtensionTest.php index 6a15bbfa9e..01f20c4127 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/BaseValidatorExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/BaseValidatorExtensionTest.php @@ -58,7 +58,7 @@ abstract class BaseValidatorExtensionTest extends TypeTestCase 'validation_groups' => array($this, 'testValidationGroupsCanBeSetToCallback'), )); - $this->assertTrue(is_callable($form->getConfig()->getOption('validation_groups'))); + $this->assertInternalType('callable', $form->getConfig()->getOption('validation_groups')); } public function testValidationGroupsCanBeSetToClosure() @@ -67,7 +67,7 @@ abstract class BaseValidatorExtensionTest extends TypeTestCase 'validation_groups' => function (FormInterface $form) { }, )); - $this->assertTrue(is_callable($form->getConfig()->getOption('validation_groups'))); + $this->assertInternalType('callable', $form->getConfig()->getOption('validation_groups')); } abstract protected function createForm(array $options = array()); diff --git a/src/Symfony/Component/OptionsResolver/Tests/LegacyOptionsTest.php b/src/Symfony/Component/OptionsResolver/Tests/LegacyOptionsTest.php index b65a09002e..fb4d25b5bc 100644 --- a/src/Symfony/Component/OptionsResolver/Tests/LegacyOptionsTest.php +++ b/src/Symfony/Component/OptionsResolver/Tests/LegacyOptionsTest.php @@ -275,7 +275,7 @@ class LegacyOptionsTest extends \PHPUnit_Framework_TestCase }); $resolved = $this->options->resolve(); - $this->assertTrue(is_callable($resolved['foo'])); + $this->assertInternalType('callable', $resolved['foo']); } public function testOverloadCannotBeEvaluatedLazilyWithoutFirstParamTypeHint() @@ -287,7 +287,7 @@ class LegacyOptionsTest extends \PHPUnit_Framework_TestCase }); $resolved = $this->options->resolve(); - $this->assertTrue(is_callable($resolved['foo'])); + $this->assertInternalType('callable', $resolved['foo']); } public function testRemoveOptionAndNormalizer() diff --git a/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php index 9682089092..bb2d9166ef 100644 --- a/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php +++ b/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php @@ -30,7 +30,7 @@ class FileDumperTest extends \PHPUnit_Framework_TestCase $dumper = new ConcreteFileDumper(); $dumper->dump($catalogue, array('path' => $tempDir)); - $this->assertTrue(file_exists($backupFile)); + $this->assertFileExists($backupFile); @unlink($file); @unlink($backupFile); @@ -49,7 +49,7 @@ class FileDumperTest extends \PHPUnit_Framework_TestCase $dumper->setRelativePathTemplate('test/translations/%domain%.%locale%.%extension%'); $dumper->dump($catalogue, array('path' => $tempDir)); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); @unlink($file); @rmdir($translationsDir);