8000 [Tests] Use proper assertions · cbaudoux/symfony@bfc1aaf · GitHub
[go: up one dir, main page]

Skip to content

Commit bfc1aaf

Browse files
committed
[Tests] Use proper assertions
1 parent d2fd9ce commit bfc1aaf

File tree

10 files changed

+16
-16
lines changed

10 files changed

+16
-16
lines changed

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testLoadEmptyConfiguration()
3737
$options = $container->getParameter('twig.options');
3838
$this->assertEquals(__DIR__.'/twig', $options['cache'], '->load() sets default value for cache option');
3939
$this->assertEquals('UTF-8', $options['charset'], '->load() sets default value for charset option');
40-
$this->assertEquals(false, $options['debug'], '->load() sets default value for debug option');
40+
$this->assertFalse($options['debug'], '->load() sets default value for debug option');
4141
}
4242

4343
/**

src/Symfony/Component/ClassLoader/Tests/ClassLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testUseIncludePath()
4242
$loader = new ClassLoader();
4343
$this->assertFalse($loader->getUseIncludePath());
4444

45-
$this->assertEquals(null, $loader->findFile('Foo'));
45+
$this->assertNull($loader->findFile('Foo'));
4646

4747
$includePath = get_include_path();
4848

src/Symfony/Component/ClassLoader/Tests/UniversalClassLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testUseIncludePath()
4242
$loader = new UniversalClassLoader();
4343
$this->assertFalse($loader->getUseIncludePath());
4444

45-
$this->assertEquals(null, $loader->findFile('Foo'));
45+
$this->assertNull($loader->findFile('Foo'));
4646

4747
$includePath = get_include_path();
4848

src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ class CrawlerTest extends \PHPUnit_Framework_TestCase
1818
public function testConstructor()
1919
{
2020
$crawler = new Crawler();
21-
$this->assertEquals(0, count($crawler), '__construct() returns an empty crawler');
21+
$this->assertCount(0, $crawler, '__construct() returns an empty crawler');
2222

2323
$crawler = new Crawler(new \DOMNode());
24-
$this->assertEquals(1, count($crawler), '__construct() takes a node as a first argument');
24+
$this->assertCount(1, $crawler, '__construct() takes a node as a first argument');
2525
}
2626

2727
/**
@@ -181,7 +181,7 @@ public function testAddContent()
181181

182182
$crawler = new Crawler();
183183
$crawler->addContent('foo bar', 'text/plain');
184-
$this->assertEquals(0, count($crawler), '->addContent() does nothing if the type is not (x|ht)ml');
184+
$this->assertCount(0, $crawler, '->addContent() does nothing if the type is not (x|ht)ml');
185185
}
186186

187187
/**
@@ -252,7 +252,7 @@ public function testClear()
252252
{
253253
$crawler = new Crawler(new \DOMNode());
254254
$crawler->clear();
255-
$this->assertEquals(0, count($crawler), '->clear() removes all the nodes from the crawler');
255+
$this->assertCount(0, $crawler, '->clear() removes all the nodes from the crawler');
256256
}
257257

258258
public function testEq()
@@ -297,7 +297,7 @@ public function testReduce()
297297
$this->assertNotSame($nodes, $crawler, '->reduce() returns a new instance of a crawler');
298298
$this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $nodes, '->reduce() returns a new instance of a crawler');
299299

300-
$this->assertEquals(2, count($nodes), '->reduce() filters the nodes in the list');
300+
$this->assertCount(2, $nodes, '->reduce() filters the nodes in the list');
301301
}
302302

303303
public function testAttr()

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testReverseTransform_empty()
3636
{
3737
$transformer = new IntegerToLocalizedStringTransformer();
3838

39-
$this->assertSame(null, $transformer->reverseTransform(''));
39+
$this->assertNull($transformer->reverseTransform(''));
4040
}
4141

4242
public function testReverseTransformWithGrouping()

src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public function testBindSingleExpandedNothingChecked()
275275

276276
$form->bind(null);
277277

278-
$this->assertSame(null, $form->getData());
278+
$this->assertNull($form->getData());
279279
$this->assertFalse($form[0]->getData());
280280
$this->assertFalse($form[1]->getData());
281281
$this->assertFalse($form[2]->getData());

src/Symfony/Component/Form/Tests/FormFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function testCreateNamedBuilder()
122122

123123
$this->assertTrue($builder instanceof FormBuilder);
124124
$this->assertEquals('bar', $builder->getName());
125-
$this->assertEquals(null, $builder->getParent());
125+
$this->assertNull($builder->getParent());
126126
}
127127

128128
public function testCreateNamedBuilderCallsBuildFormMethods()

src/Symfony/Component/Form/Tests/Util/FormUtilTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testIsChoiceGroupPart2()
4444
$this->markTestSkipped('PHP prior to 5.3.3 has issue with SplFixedArrays - https://bugs.php.net/bug.php?id=50481');
4545
}
4646

47-
$this->assertSame(true, FormUtil::isChoiceGroup(new \SplFixedArray(1)));
47+
$this->assertTrue(FormUtil::isChoiceGroup(new \SplFixedArray(1)));
4848
}
4949

5050
public function isChoiceSelectedProvider()

src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ public function testParseErrorIntl($pattern, $value)
709709

710710
$this->skipIfIntlExtensionIsNotLoaded();
711711
$formatter = $this->createIntlFormatter($pattern);
712-
$this->assertSame(false, $formatter->parse($value));
712+
$this->assertFalse($formatter->parse($value));
713713
$this->assertSame($errorMessage, intl_get_error_message());
714714
$this->assertSame($errorCode, intl_get_error_code());
715715
$this->assertSame($errorCode != 0, intl_is_failure(intl_get_error_code()));
@@ -724,7 +724,7 @@ public function testParseErrorStub($pattern, $value)
724724
$errorMessage = 'Date parsing failed: U_PARSE_ERROR';
725725

726726
$formatter = $this->createStubFormatter($pattern);
727-
$this->assertSame(false, $formatter->parse($value));
727+
$this->assertFalse($formatter->parse($value));
728728
$this->assertSame($errorMessage, StubIntl::getErrorMessage());
729729
$this->assertSame($errorCode, StubIntl::getErrorCode());
730730
$this->assertSame($errorCode != 0, StubIntl::isFailure(StubIntl::getErrorCode()));

src/Symfony/Component/Process/Tests/ProcessBuilderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function shouldInheritEnvironmentVars()
2727
$pb->add('foo')->inheritEnvironmentVariables();
2828
$proc = $pb->getProcess();
2929

30-
$this->assertEquals(null, $proc->getEnv(), '->inheritEnvironmentVariables() copies $_ENV');
30+
$this->assertNull($proc->getEnv(), '->inheritEnvironmentVariables() copies $_ENV');
3131

3232
$_ENV = $snapshot;
3333
}
@@ -59,7 +59,7 @@ public function shouldInheritEnvironmentVarsByDefault()
5959
$pb = new ProcessBuilder();
6060
$proc = $pb->add('foo')->getProcess();
6161

62-
$this->assertEquals(null, $proc->getEnv());
62+
$this->assertNull($proc->getEnv());
6363
}
6464

6565
/**

0 commit comments

Comments
 (0)
0