merged branch stloyd/tests (PR #3941)
Commits
-------
bfc1aaf
[Tests] Use proper assertions
Discussion
----------
[Tests] Use proper assertions
* `assertEquals(false, *)` -> `assertFalse(*)`
* `assertEquals(true, *)` -> `assertTrue(*)`
* `assertEquals(null, *)` -> `assertNull(*)`
* `assertEquals(x, count(*))` -> `assertCount(x, *)`
* `assertSame(false, *)` -> `assertFalse(*)`
* `assertSame(true, *)` -> `assertTrue(*)`
* `assertSame(null, *)` -> `assertNull(*)`
![Travis CI](https://secure.travis-ci.org/stloyd/symfony.png?branch=tests)
---------------------------------------------------------------------------
by drak at 2012-04-14T08:44:16Z
This is nice, but the commit message leads one to believe bugs are beings fixed, when actually it's just about using PHPUnit shortcut/covenience methods.
This commit is contained in:
commit
8cdf49bf87
@ -37,7 +37,7 @@ class TwigExtensionTest extends TestCase
|
||||
$options = $container->getParameter('twig.options');
|
||||
$this->assertEquals(__DIR__.'/twig', $options['cache'], '->load() sets default value for cache option');
|
||||
$this->assertEquals('UTF-8', $options['charset'], '->load() sets default value for charset option');
|
||||
$this->assertEquals(false, $options['debug'], '->load() sets default value for debug option');
|
||||
$this->assertFalse($options['debug'], '->load() sets default value for debug option');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ class ClassLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
$loader = new ClassLoader();
|
||||
$this->assertFalse($loader->getUseIncludePath());
|
||||
|
||||
$this->assertEquals(null, $loader->findFile('Foo'));
|
||||
$this->assertNull($loader->findFile('Foo'));
|
||||
|
||||
$includePath = get_include_path();
|
||||
|
||||
|
@ -42,7 +42,7 @@ class UniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
$loader = new UniversalClassLoader();
|
||||
$this->assertFalse($loader->getUseIncludePath());
|
||||
|
||||
$this->assertEquals(null, $loader->findFile('Foo'));
|
||||
$this->assertNull($loader->findFile('Foo'));
|
||||
|
||||
$includePath = get_include_path();
|
||||
|
||||
|
@ -18,10 +18,10 @@ class CrawlerTest extends \PHPUnit_Framework_TestCase
|
||||
public function testConstructor()
|
||||
{
|
||||
$crawler = new Crawler();
|
||||
$this->assertEquals(0, count($crawler), '__construct() returns an empty crawler');
|
||||
$this->assertCount(0, $crawler, '__construct() returns an empty crawler');
|
||||
|
||||
$crawler = new Crawler(new \DOMNode());
|
||||
$this->assertEquals(1, count($crawler), '__construct() takes a node as a first argument');
|
||||
$this->assertCount(1, $crawler, '__construct() takes a node as a first argument');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -181,7 +181,7 @@ EOF
|
||||
|
||||
$crawler = new Crawler();
|
||||
$crawler->addContent('foo bar', 'text/plain');
|
||||
$this->assertEquals(0, count($crawler), '->addContent() does nothing if the type is not (x|ht)ml');
|
||||
$this->assertCount(0, $crawler, '->addContent() does nothing if the type is not (x|ht)ml');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,7 +252,7 @@ EOF
|
||||
{
|
||||
$crawler = new Crawler(new \DOMNode());
|
||||
$crawler->clear();
|
||||
$this->assertEquals(0, count($crawler), '->clear() removes all the nodes from the crawler');
|
||||
$this->assertCount(0, $crawler, '->clear() removes all the nodes from the crawler');
|
||||
}
|
||||
|
||||
public function testEq()
|
||||
@ -297,7 +297,7 @@ EOF
|
||||
$this->assertNotSame($nodes, $crawler, '->reduce() returns a new instance of a crawler');
|
||||
$this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $nodes, '->reduce() returns a new instance of a crawler');
|
||||
|
||||
$this->assertEquals(2, count($nodes), '->reduce() filters the nodes in the list');
|
||||
$this->assertCount(2, $nodes, '->reduce() filters the nodes in the list');
|
||||
}
|
||||
|
||||
public function testAttr()
|
||||
|
@ -36,7 +36,7 @@ class IntegerToLocalizedStringTransformerTest extends LocalizedTestCase
|
||||
{
|
||||
$transformer = new IntegerToLocalizedStringTransformer();
|
||||
|
||||
$this->assertSame(null, $transformer->reverseTransform(''));
|
||||
$this->assertNull($transformer->reverseTransform(''));
|
||||
}
|
||||
|
||||
public function testReverseTransformWithGrouping()
|
||||
|
@ -275,7 +275,7 @@ class ChoiceTypeTest extends TypeTestCase
|
||||
|
||||
$form->bind(null);
|
||||
|
||||
$this->assertSame(null, $form->getData());
|
||||
$this->assertNull($form->getData());
|
||||
$this->assertFalse($form[0]->getData());
|
||||
$this->assertFalse($form[1]->getData());
|
||||
$this->assertFalse($form[2]->getData());
|
||||
|
@ -122,7 +122,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertTrue($builder instanceof FormBuilder);
|
||||
$this->assertEquals('bar', $builder->getName());
|
||||
$this->assertEquals(null, $builder->getParent());
|
||||
$this->assertNull($builder->getParent());
|
||||
}
|
||||
|
||||
public function testCreateNamedBuilderCallsBuildFormMethods()
|
||||
|
@ -44,7 +44,7 @@ class FormUtilTest extends \PHPUnit_Framework_TestCase
|
||||
$this->markTestSkipped('PHP prior to 5.3.3 has issue with SplFixedArrays - https://bugs.php.net/bug.php?id=50481');
|
||||
}
|
||||
|
||||
$this->assertSame(true, FormUtil::isChoiceGroup(new \SplFixedArray(1)));
|
||||
$this->assertTrue(FormUtil::isChoiceGroup(new \SplFixedArray(1)));
|
||||
}
|
||||
|
||||
public function isChoiceSelectedProvider()
|
||||
|
@ -709,7 +709,7 @@ class StubIntlDateFormatterTest extends LocaleTestCase
|
||||
|
||||
$this->skipIfIntlExtensionIsNotLoaded();
|
||||
$formatter = $this->createIntlFormatter($pattern);
|
||||
$this->assertSame(false, $formatter->parse($value));
|
||||
$this->assertFalse($formatter->parse($value));
|
||||
$this->assertSame($errorMessage, intl_get_error_message());
|
||||
$this->assertSame($errorCode, intl_get_error_code());
|
||||
$this->assertSame($errorCode != 0, intl_is_failure(intl_get_error_code()));
|
||||
@ -724,7 +724,7 @@ class StubIntlDateFormatterTest extends LocaleTestCase
|
||||
$errorMessage = 'Date parsing failed: U_PARSE_ERROR';
|
||||
|
||||
$formatter = $this->createStubFormatter($pattern);
|
||||
$this->assertSame(false, $formatter->parse($value));
|
||||
$this->assertFalse($formatter->parse($value));
|
||||
$this->assertSame($errorMessage, StubIntl::getErrorMessage());
|
||||
$this->assertSame($errorCode, StubIntl::getErrorCode());
|
||||
$this->assertSame($errorCode != 0, StubIntl::isFailure(StubIntl::getErrorCode()));
|
||||
|
@ -27,7 +27,7 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$pb->add('foo')->inheritEnvironmentVariables();
|
||||
$proc = $pb->getProcess();
|
||||
|
||||
$this->assertEquals(null, $proc->getEnv(), '->inheritEnvironmentVariables() copies $_ENV');
|
||||
$this->assertNull($proc->getEnv(), '->inheritEnvironmentVariables() copies $_ENV');
|
||||
|
||||
$_ENV = $snapshot;
|
||||
}
|
||||
@ -59,7 +59,7 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$pb = new ProcessBuilder();
|
||||
$proc = $pb->add('foo')->getProcess();
|
||||
|
||||
$this->assertEquals(null, $proc->getEnv());
|
||||
$this->assertNull($proc->getEnv());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user