tag');
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
index 45106f90e2..b36cc31161 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
@@ -141,7 +141,7 @@ class YamlFileLoaderTest extends TestCase
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('services6.yml');
$services = $container->getDefinitions();
- $this->assertTrue(isset($services['foo']), '->load() parses service elements');
+ $this->assertArrayHasKey('foo', $services, '->load() parses service elements');
$this->assertFalse($services['not_shared']->isShared(), '->load() parses the shared flag');
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $services['foo'], '->load() converts service element to Definition instances');
$this->assertEquals('FooClass', $services['foo']->getClass(), '->load() parses the class attribute');
@@ -159,10 +159,10 @@ class YamlFileLoaderTest extends TestCase
$this->assertEquals(array('foo', new Reference('baz')), $services['Acme\WithShortCutArgs']->getArguments(), '->load() parses short service definition');
$aliases = $container->getAliases();
- $this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses aliases');
+ $this->assertArrayHasKey('alias_for_foo', $aliases, '->load() parses aliases');
$this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases');
$this->assertTrue($aliases['alias_for_foo']->isPublic());
- $this->assertTrue(isset($aliases['another_alias_for_foo']));
+ $this->assertArrayHasKey('another_alias_for_foo', $aliases);
$this->assertEquals('foo', (string) $aliases['another_alias_for_foo']);
$this->assertFalse($aliases['another_alias_for_foo']->isPublic());
$this->assertTrue(isset($aliases['another_third_alias_for_foo']));
@@ -206,8 +206,8 @@ class YamlFileLoaderTest extends TestCase
$services = $container->getDefinitions();
$parameters = $container->getParameterBag()->all();
- $this->assertTrue(isset($services['project.service.bar']), '->load() parses extension elements');
- $this->assertTrue(isset($parameters['project.parameter.bar']), '->load() parses extension elements');
+ $this->assertArrayHasKey('project.service.bar', $services, '->load() parses extension elements');
+ $this->assertArrayHasKey('project.parameter.bar', $parameters, '->load() parses extension elements');
$this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements');
$this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements');
diff --git a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
index c787869ca7..ec8512e4ef 100644
--- a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
@@ -204,7 +204,7 @@ EOF
EOF
, 'UTF-8');
- $this->assertTrue(count(libxml_get_errors()) > 1);
+ $this->assertGreaterThan(1, libxml_get_errors());
libxml_clear_errors();
libxml_use_internal_errors($internalErrors);
diff --git a/src/Symfony/Component/DomCrawler/Tests/FormTest.php b/src/Symfony/Component/DomCrawler/Tests/FormTest.php
index 6164b1ca7c..90e87d4c00 100644
--- a/src/Symfony/Component/DomCrawler/Tests/FormTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/FormTest.php
@@ -376,15 +376,15 @@ class FormTest extends TestCase
{
$form = $this->createForm('');
unset($form['foo']);
- $this->assertFalse(isset($form['foo']), '->offsetUnset() removes a field');
+ $this->assertArrayNotHasKey('foo', $form, '->offsetUnset() removes a field');
}
public function testOffsetExists()
{
$form = $this->createForm('');
- $this->assertTrue(isset($form['foo']), '->offsetExists() return true if the field exists');
- $this->assertFalse(isset($form['bar']), '->offsetExists() return false if the field does not exist');
+ $this->assertArrayHasKey('foo', $form, '->offsetExists() return true if the field exists');
+ $this->assertArrayNotHasKey('bar', $form, '->offsetExists() return false if the field does not exist');
}
public function testGetValues()
diff --git a/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php
index 1805561492..9d5eecc547 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php
@@ -143,7 +143,7 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
$listeners = $dispatcher->getListeners();
- $this->assertTrue(isset($listeners['onEvent']));
+ $this->assertArrayHasKey('onEvent', $listeners);
$this->assertCount(1, $dispatcher->getListeners('onEvent'));
}
diff --git a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
index c84d3ac24c..9cf68c987f 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
@@ -114,8 +114,8 @@ class GenericEventTest extends TestCase
public function testOffsetIsset()
{
- $this->assertTrue(isset($this->event['name']));
- $this->assertFalse(isset($this->event['nameNotExist']));
+ $this->assertArrayHasKey('name', $this->event);
+ $this->assertArrayNotHasKey('nameNotExist', $this->event);
}
public function testHasArgument()
diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
index ea4f82d80b..1d30092956 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
@@ -26,7 +26,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->copy($sourceFilePath, $targetFilePath);
$this->assertFileExists($targetFilePath);
- $this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath));
+ $this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
}
/**
@@ -73,7 +73,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->copy($sourceFilePath, $targetFilePath);
$this->assertFileExists($targetFilePath);
- $this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath));
+ $this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
}
public function testCopyDoesNotOverrideExistingFileByDefault()
@@ -92,7 +92,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->copy($sourceFilePath, $targetFilePath);
$this->assertFileExists($targetFilePath);
- $this->assertEquals('TARGET FILE', file_get_contents($targetFilePath));
+ $this->assertStringEqualsFile($targetFilePath, 'TARGET FILE');
}
public function testCopyOverridesExistingFileIfForced()
@@ -111,7 +111,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->copy($sourceFilePath, $targetFilePath, true);
$this->assertFileExists($targetFilePath);
- $this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath));
+ $this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
}
/**
@@ -153,7 +153,7 @@ class FilesystemTest extends FilesystemTestCase
$this->assertTrue(is_dir($targetFileDirectory));
$this->assertFileExists($targetFilePath);
- $this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath));
+ $this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
}
/**
@@ -840,9 +840,9 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->remove($link);
- $this->assertTrue(!is_link($link));
- $this->assertTrue(!is_file($link));
- $this->assertTrue(!is_dir($link));
+ $this->assertFalse(is_link($link));
+ $this->assertFalse(is_file($link));
+ $this->assertFalse(is_dir($link));
}
public function testSymlinkIsOverwrittenIfPointsToDifferentTarget()
@@ -1474,7 +1474,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->dumpFile($filename, 'bar');
$this->assertFileExists($filename);
- $this->assertSame('bar', file_get_contents($filename));
+ $this->assertStringEqualsFile($filename, 'bar');
// skip mode check on Windows
if ('\\' !== DIRECTORY_SEPARATOR) {
@@ -1491,7 +1491,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->dumpFile($filename, 'bar');
$this->assertFileExists($filename);
- $this->assertSame('bar', file_get_contents($filename));
+ $this->assertStringEqualsFile($filename, 'bar');
}
public function testDumpFileWithFileScheme()
@@ -1506,7 +1506,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->dumpFile($filename, 'bar');
$this->assertFileExists($filename);
- $this->assertSame('bar', file_get_contents($filename));
+ $this->assertStringEqualsFile($filename, 'bar');
}
public function testDumpFileWithZlibScheme()
@@ -1518,7 +1518,7 @@ class FilesystemTest extends FilesystemTestCase
// Zlib stat uses file:// wrapper so remove scheme
$this->assertFileExists(str_replace($scheme, '', $filename));
- $this->assertSame('bar', file_get_contents($filename));
+ $this->assertStringEqualsFile($filename, 'bar');
}
public function testAppendToFile()
@@ -1535,7 +1535,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->appendToFile($filename, 'bar');
$this->assertFileExists($filename);
- $this->assertSame('foobar', file_get_contents($filename));
+ $this->assertStringEqualsFile($filename, 'foobar');
// skip mode check on Windows
if ('\\' !== DIRECTORY_SEPARATOR) {
@@ -1557,7 +1557,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->appendToFile($filename, 'bar');
$this->assertFileExists($filename);
- $this->assertSame('foobar', file_get_contents($filename));
+ $this->assertStringEqualsFile($filename, 'foobar');
}
public function testAppendToFileWithZlibScheme()
@@ -1567,12 +1567,12 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->dumpFile($filename, 'foo');
// Zlib stat uses file:// wrapper so remove it
- $this->assertSame('foo', file_get_contents(str_replace($scheme, '', $filename)));
+ $this->assertStringEqualsFile(str_replace($scheme, '', $filename), 'foo');
$this->filesystem->appendToFile($filename, 'bar');
$this->assertFileExists($filename);
- $this->assertSame('foobar', file_get_contents($filename));
+ $this->assertStringEqualsFile($filename, 'foobar');
}
public function testAppendToFileCreateTheFileIfNotExists()
@@ -1593,7 +1593,7 @@ class FilesystemTest extends FilesystemTestCase
}
$this->assertFileExists($filename);
- $this->assertSame('bar', file_get_contents($filename));
+ $this->assertStringEqualsFile($filename, 'bar');
}
public function testDumpKeepsExistingPermissionsWhenOverwritingAnExistingFile()
diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php
index acdd004d42..bcf1b8c4f9 100644
--- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php
+++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php
@@ -308,12 +308,12 @@ class CompoundFormTest extends AbstractFormTest
$this->form[] = $child;
- $this->assertTrue(isset($this->form['foo']));
+ $this->assertArrayHasKey('foo', $this->form);
$this->assertSame($child, $this->form['foo']);
unset($this->form['foo']);
- $this->assertFalse(isset($this->form['foo']));
+ $this->assertArrayNotHasKey('foo', $this->form);
}
public function testCountable()
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
index 15e08ae96f..192d38f1a9 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
@@ -196,7 +196,7 @@ class ChoiceTypeTest extends BaseTypeTest
'choices' => $this->choices,
));
- $this->assertTrue(isset($form['placeholder']));
+ $this->assertArrayHasKey('placeholder', $form);
$this->assertCount(count($this->choices) + 1, $form, 'Each choice should become a new field');
}
@@ -209,7 +209,7 @@ class ChoiceTypeTest extends BaseTypeTest
'choices' => $this->choices,
));
- $this->assertFalse(isset($form['placeholder']));
+ $this->assertArrayNotHasKey('placeholder', $form);
$this->assertCount(count($this->choices), $form, 'Each choice should become a new field');
}
@@ -222,7 +222,7 @@ class ChoiceTypeTest extends BaseTypeTest
'choices' => $this->choices,
));
- $this->assertFalse(isset($form['placeholder']));
+ $this->assertArrayNotHasKey('placeholder', $form);
$this->assertCount(count($this->choices), $form, 'Each choice should become a new field');
}
@@ -238,7 +238,7 @@ class ChoiceTypeTest extends BaseTypeTest
),
));
- $this->assertFalse(isset($form['placeholder']));
+ $this->assertArrayNotHasKey('placeholder', $form);
$this->assertCount(2, $form, 'Each choice should become a new field');
}
@@ -295,7 +295,7 @@ class ChoiceTypeTest extends BaseTypeTest
'placeholder' => 'Select an option',
));
- $this->assertTrue(isset($form['placeholder']), 'Placeholder should be set');
+ $this->assertArrayHasKey('placeholder', $form, 'Placeholder should be set');
$this->assertCount(3, $form, 'Each choice should become a new field, placeholder included');
$view = $form->createView();
@@ -319,7 +319,7 @@ class ChoiceTypeTest extends BaseTypeTest
'placeholder' => 'Select an option',
));
- $this->assertTrue(isset($form['placeholder']), 'Placeholder should be set');
+ $this->assertArrayHasKey('placeholder', $form, 'Placeholder should be set');
$this->assertCount(3, $form, 'Each choice should become a new field, placeholder included');
$view = $form->createView();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
index 977cb8cf43..ffeace3038 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
@@ -49,7 +49,7 @@ class CollectionTypeTest extends BaseTypeTest
$form->setData(array('foo@baz.com'));
$this->assertInstanceOf('Symfony\Component\Form\Form', $form[0]);
- $this->assertFalse(isset($form[1]));
+ $this->assertArrayNotHasKey(1, $form);
$this->assertCount(1, $form);
$this->assertEquals('foo@baz.com', $form[0]->getData());
$formAttrs0 = $form[0]->getConfig()->getOption('attr');
@@ -271,7 +271,7 @@ class CollectionTypeTest extends BaseTypeTest
));
$data = $form->getData();
- $this->assertFalse(isset($data['__name__']));
+ $this->assertArrayNotHasKey('__name__', $data);
}
public function testGetDataDoesNotContainsPrototypeNameAfterDataAreSet()
@@ -284,7 +284,7 @@ class CollectionTypeTest extends BaseTypeTest
$form->setData(array('foobar.png'));
$data = $form->getData();
- $this->assertFalse(isset($data['__name__']));
+ $this->assertArrayNotHasKey('__name__', $data);
}
public function testPrototypeNameOption()
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
index cf55d7d1db..d80e85021b 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
@@ -419,7 +419,7 @@ class DateTimeTypeTest extends BaseTypeTest
))
->createView();
- $this->assertFalse(isset($view->vars['type']));
+ $this->assertArrayNotHasKey('type', $view->vars);
}
public function testDontPassHtml5TypeIfNotHtml5Format()
@@ -430,7 +430,7 @@ class DateTimeTypeTest extends BaseTypeTest
))
->createView();
- $this->assertFalse(isset($view->vars['type']));
+ $this->assertArrayNotHasKey('type', $view->vars);
}
public function testDontPassHtml5TypeIfNotSingleText()
@@ -440,7 +440,7 @@ class DateTimeTypeTest extends BaseTypeTest
))
->createView();
- $this->assertFalse(isset($view->vars['type']));
+ $this->assertArrayNotHasKey('type', $view->vars);
}
public function testDateTypeChoiceErrorsBubbleUp()
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
index 326c34c8c7..02ef678511 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
@@ -678,7 +678,7 @@ class DateTypeTest extends BaseTypeTest
))
->createView();
- $this->assertFalse(isset($view->vars['date_pattern']));
+ $this->assertArrayNotHasKey('date_pattern', $view->vars);
}
public function testDatePatternFormatWithQuotedStrings()
@@ -826,7 +826,7 @@ class DateTypeTest extends BaseTypeTest
))
->createView();
- $this->assertFalse(isset($view->vars['type']));
+ $this->assertArrayNotHasKey('type', $view->vars);
}
public function testDontPassHtml5TypeIfNotHtml5Format()
@@ -837,7 +837,7 @@ class DateTypeTest extends BaseTypeTest
))
->createView();
- $this->assertFalse(isset($view->vars['type']));
+ $this->assertArrayNotHasKey('type', $view->vars);
}
public function testDontPassHtml5TypeIfNotSingleText()
@@ -847,7 +847,7 @@ class DateTypeTest extends BaseTypeTest
))
->createView();
- $this->assertFalse(isset($view->vars['type']));
+ $this->assertArrayNotHasKey('type', $view->vars);
}
public function provideCompoundWidgets()
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
index 369ebc0f6c..95e43d8c0f 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
@@ -536,7 +536,7 @@ class TimeTypeTest extends BaseTypeTest
));
$view = $form->createView();
- $this->assertFalse(isset($view->vars['type']));
+ $this->assertArrayNotHasKey('type', $view->vars);
}
public function testPassDefaultPlaceholderToViewIfNotRequired()
diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
index 0e7261cc2e..6432ac6889 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
@@ -72,7 +72,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
))
->createView();
- $this->assertTrue(isset($view['csrf']));
+ $this->assertArrayHasKey('csrf', $view);
}
public function testNoCsrfProtectionByDefaultIfCompoundButNotRoot()
@@ -89,7 +89,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
->get('form')
->createView();
- $this->assertFalse(isset($view['csrf']));
+ $this->assertArrayNotHasKey('csrf', $view);
}
public function testNoCsrfProtectionByDefaultIfRootButNotCompound()
@@ -101,7 +101,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
))
->createView();
- $this->assertFalse(isset($view['csrf']));
+ $this->assertArrayNotHasKey('csrf', $view);
}
public function testCsrfProtectionCanBeDisabled()
@@ -114,7 +114,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
))
->createView();
- $this->assertFalse(isset($view['csrf']));
+ $this->assertArrayNotHasKey('csrf', $view);
}
public function testGenerateCsrfToken()
@@ -357,7 +357,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
->createView()
->vars['prototype'];
- $this->assertFalse(isset($prototypeView['csrf']));
+ $this->assertArrayNotHasKey('csrf', $prototypeView);
$this->assertCount(1, $prototypeView);
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php
index 31377dec3e..88d5169cd7 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php
@@ -96,7 +96,7 @@ class ViolationPathTest extends TestCase
$path = new ViolationPath($string);
$this->assertSame($slicedPath, $path->__toString());
- $this->assertSame(count($entries), count($path->getElements()));
+ $this->assertCount(count($entries), $path->getElements());
$this->assertSame(count($entries), $path->getLength());
foreach ($entries as $index => $entry) {
diff --git a/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php b/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php
index fe922e9239..8ce3f8fc82 100644
--- a/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php
+++ b/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php
@@ -91,14 +91,14 @@ class OrderedHashMapTest extends TestCase
$map = new OrderedHashMap();
$map['first'] = 1;
- $this->assertTrue(isset($map['first']));
+ $this->assertArrayHasKey('first', $map);
}
public function testIssetReturnsFalseForNonExisting()
{
$map = new OrderedHashMap();
- $this->assertFalse(isset($map['first']));
+ $this->assertArrayNotHasKey('first', $map);
}
public function testIssetReturnsFalseForNull()
@@ -106,7 +106,7 @@ class OrderedHashMapTest extends TestCase
$map = new OrderedHashMap();
$map['first'] = null;
- $this->assertFalse(isset($map['first']));
+ $this->assertArrayNotHasKey('first', $map);
}
public function testUnset()
diff --git a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php
index 1acf593086..6d19ceb009 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php
@@ -200,6 +200,6 @@ class HeaderBagTest extends TestCase
$headers = array('foo' => 'bar', 'HELLO' => 'WORLD');
$headerBag = new HeaderBag($headers);
- $this->assertEquals(count($headers), count($headerBag));
+ $this->assertCount(count($headers), $headerBag);
}
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php
index 5311a0d803..ab908d8d37 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php
@@ -179,7 +179,7 @@ class ParameterBagTest extends TestCase
$parameters = array('foo' => 'bar', 'hello' => 'world');
$bag = new ParameterBag($parameters);
- $this->assertEquals(count($parameters), count($bag));
+ $this->assertCount(count($parameters), $bag);
}
public function testGetBoolean()
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
index 7ed6ccc070..ce8553590d 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
@@ -175,10 +175,10 @@ class ResponseHeaderBagTest extends TestCase
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
- $this->assertTrue(isset($cookies['foo.bar']['/path/foo']['foo']));
- $this->assertTrue(isset($cookies['foo.bar']['/path/bar']['foo']));
- $this->assertTrue(isset($cookies['bar.foo']['/path/bar']['foo']));
- $this->assertTrue(isset($cookies['']['/']['foo']));
+ $this->assertArrayHasKey('foo', $cookies['foo.bar']['/path/foo']);
+ $this->assertArrayHasKey('foo', $cookies['foo.bar']['/path/bar']);
+ $this->assertArrayHasKey('foo', $cookies['bar.foo']['/path/bar']);
+ $this->assertArrayHasKey('foo', $cookies['']['/']);
}
public function testRemoveCookie()
@@ -191,19 +191,19 @@ class ResponseHeaderBagTest extends TestCase
$this->assertTrue($bag->has('set-cookie'));
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
- $this->assertTrue(isset($cookies['foo.bar']['/path/foo']));
+ $this->assertArrayHasKey('/path/foo', $cookies['foo.bar']);
$bag->removeCookie('foo', '/path/foo', 'foo.bar');
$this->assertTrue($bag->has('set-cookie'));
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
- $this->assertFalse(isset($cookies['foo.bar']['/path/foo']));
+ $this->assertArrayNotHasKey('/path/foo', $cookies['foo.bar']);
$bag->removeCookie('bar', '/path/bar', 'foo.bar');
$this->assertFalse($bag->has('set-cookie'));
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
- $this->assertFalse(isset($cookies['foo.bar']));
+ $this->assertArrayNotHasKey('foo.bar', $cookies);
}
public function testRemoveCookieWithNullRemove()
@@ -213,11 +213,11 @@ class ResponseHeaderBagTest extends TestCase
$bag->setCookie(new Cookie('bar', 'foo', 0));
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
- $this->assertTrue(isset($cookies['']['/']));
+ $this->assertArrayHasKey('/', $cookies['']);
$bag->removeCookie('foo', null);
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
- $this->assertFalse(isset($cookies['']['/']['foo']));
+ $this->assertArrayNotHasKey('foo', $cookies['']['/']);
$bag->removeCookie('bar', null);
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php
index c1d9d12a65..f8becec5a9 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php
@@ -74,8 +74,8 @@ class ServerBagTest extends TestCase
// Username and passwords should not be set as the header is bogus
$headers = $bag->getHeaders();
- $this->assertFalse(isset($headers['PHP_AUTH_USER']));
- $this->assertFalse(isset($headers['PHP_AUTH_PW']));
+ $this->assertArrayNotHasKey('PHP_AUTH_USER', $headers);
+ $this->assertArrayNotHasKey('PHP_AUTH_PW', $headers);
}
public function testHttpBasicAuthWithPhpCgiRedirect()
@@ -118,8 +118,8 @@ class ServerBagTest extends TestCase
// Username and passwords should not be set as the header is bogus
$headers = $bag->getHeaders();
- $this->assertFalse(isset($headers['PHP_AUTH_USER']));
- $this->assertFalse(isset($headers['PHP_AUTH_PW']));
+ $this->assertArrayNotHasKey('PHP_AUTH_USER', $headers);
+ $this->assertArrayNotHasKey('PHP_AUTH_PW', $headers);
}
public function testHttpDigestAuthWithPhpCgiRedirect()
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php
index 655c26a9c2..724a0b9844 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php
@@ -181,6 +181,6 @@ class AttributeBagTest extends TestCase
public function testCount()
{
- $this->assertEquals(count($this->array), count($this->bag));
+ $this->assertCount(count($this->array), $this->bag);
}
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
index f1442e8edb..8fb8b42228 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
@@ -227,7 +227,7 @@ class NativeSessionStorageTest extends TestCase
$this->assertFalse($storage->isStarted());
$key = $storage->getMetadataBag()->getStorageKey();
- $this->assertFalse(isset($_SESSION[$key]));
+ $this->assertArrayNotHasKey($key, $_SESSION);
$storage->start();
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
index b8b98386c3..958dc0bc08 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
@@ -75,9 +75,9 @@ class PhpBridgeSessionStorageTest extends TestCase
$this->assertFalse($storage->isStarted());
$key = $storage->getMetadataBag()->getStorageKey();
- $this->assertFalse(isset($_SESSION[$key]));
+ $this->assertArrayNotHasKey($key, $_SESSION);
$storage->start();
- $this->assertTrue(isset($_SESSION[$key]));
+ $this->assertArrayHasKey($key, $_SESSION);
}
public function testClear()
diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php
index e642e3c337..fc4b92b533 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php
@@ -35,7 +35,7 @@ class DumpDataCollectorTest extends TestCase
$this->assertSame(1, $collector->getDumpsCount());
$dump = $collector->getDumps('html');
- $this->assertTrue(isset($dump[0]['data']));
+ $this->assertArrayHasKey('data', $dump[0]);
$dump[0]['data'] = preg_replace('/^.*?request('GET', '/');
$this->assertHttpKernelIsNotCalled();
$this->assertEquals(200, $this->response->getStatusCode());
- $this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2);
- $this->assertTrue($this->response->headers->get('Age') > 0);
+ $this->assertLessThan(2, strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')));
+ $this->assertGreaterThan(0, $this->response->headers->get('Age'));
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
$this->assertTraceContains('fresh');
$this->assertTraceNotContains('store');
@@ -554,8 +554,8 @@ class HttpCacheTest extends HttpCacheTestCase
$this->request('GET', '/');
$this->assertHttpKernelIsNotCalled();
$this->assertEquals(200, $this->response->getStatusCode());
- $this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2);
- $this->assertTrue($this->response->headers->get('Age') > 0);
+ $this->assertLessThan(2, strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')));
+ $this->assertGreaterThan(0, $this->response->headers->get('Age'));
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
$this->assertTraceContains('fresh');
$this->assertTraceNotContains('store');
@@ -618,8 +618,8 @@ class HttpCacheTest extends HttpCacheTestCase
$this->request('GET', '/');
$this->assertHttpKernelIsNotCalled();
$this->assertEquals(200, $this->response->getStatusCode());
- $this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2);
- $this->assertTrue($this->response->headers->get('Age') > 0);
+ $this->assertLessThan(2, strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')));
+ $this->assertGreaterThan(0, $this->response->headers->get('Age'));
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
$this->assertTraceContains('fresh');
$this->assertTraceNotContains('store');
@@ -793,7 +793,7 @@ class HttpCacheTest extends HttpCacheTestCase
$this->request('GET', '/');
$this->assertHttpKernelIsCalled();
$this->assertEquals(200, $this->response->getStatusCode());
- $this->assertTrue($this->response->headers->get('Age') <= 1);
+ $this->assertLessThanOrEqual(1, $this->response->headers->get('Age'));
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
$this->assertTraceContains('stale');
$this->assertTraceNotContains('fresh');
@@ -831,7 +831,7 @@ class HttpCacheTest extends HttpCacheTestCase
$this->assertEquals(200, $this->response->getStatusCode());
$this->assertNotNull($this->response->headers->get('Last-Modified'));
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
- $this->assertTrue($this->response->headers->get('Age') <= 1);
+ $this->assertLessThanOrEqual(1, $this->response->headers->get('Age'));
$this->assertEquals('Hello World', $this->response->getContent());
$this->assertTraceContains('stale');
$this->assertTraceContains('valid');
@@ -881,7 +881,7 @@ class HttpCacheTest extends HttpCacheTestCase
$this->assertEquals(200, $this->response->getStatusCode());
$this->assertNotNull($this->response->headers->get('ETag'));
$this->assertNotNull($this->response->headers->get('X-Content-Digest'));
- $this->assertTrue($this->response->headers->get('Age') <= 1);
+ $this->assertLessThanOrEqual(1, $this->response->headers->get('Age'));
$this->assertEquals('Hello World', $this->response->getContent());
$this->assertTraceContains('stale');
$this->assertTraceContains('valid');
diff --git a/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php b/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php
index 253a4c91bd..84ec19f70d 100644
--- a/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php
@@ -36,7 +36,7 @@ class UriSignerTest extends TestCase
$this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar')));
$this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&0=integer')));
- $this->assertTrue($signer->sign('http://example.com/foo?foo=bar&bar=foo') === $signer->sign('http://example.com/foo?bar=foo&foo=bar'));
+ $this->assertSame($signer->sign('http://example.com/foo?foo=bar&bar=foo'), $signer->sign('http://example.com/foo?bar=foo&foo=bar'));
}
public function testCheckWithDifferentArgSeparator()
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
index cfffd2b7cc..3e992db42a 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
@@ -36,7 +36,7 @@ class IntlBundleReaderTest extends TestCase
$this->assertInstanceOf('\ArrayAccess', $data);
$this->assertSame('Bar', $data['Foo']);
- $this->assertFalse(isset($data['ExistsNot']));
+ $this->assertArrayNotHasKey('ExistsNot', $data);
}
public function testReadFollowsAlias()
@@ -46,7 +46,7 @@ class IntlBundleReaderTest extends TestCase
$this->assertInstanceOf('\ArrayAccess', $data);
$this->assertSame('Bar', $data['Foo']);
- $this->assertFalse(isset($data['ExistsNot']));
+ $this->assertArrayNotHasKey('ExistsNot', $data);
}
public function testReadDoesNotFollowFallback()
@@ -60,9 +60,9 @@ class IntlBundleReaderTest extends TestCase
$this->assertInstanceOf('\ArrayAccess', $data);
$this->assertSame('Bam', $data['Baz']);
- $this->assertFalse(isset($data['Foo']));
+ $this->assertArrayNotHasKey('Foo', $data);
$this->assertNull($data['Foo']);
- $this->assertFalse(isset($data['ExistsNot']));
+ $this->assertArrayNotHasKey('ExistsNot', $data);
}
public function testReadDoesNotFollowFallbackAlias()
@@ -76,9 +76,9 @@ class IntlBundleReaderTest extends TestCase
$this->assertInstanceOf('\ArrayAccess', $data);
$this->assertSame('Bam', $data['Baz'], 'data from the aliased locale can be accessed');
- $this->assertFalse(isset($data['Foo']));
+ $this->assertArrayNotHasKey('Foo', $data);
$this->assertNull($data['Foo']);
- $this->assertFalse(isset($data['ExistsNot']));
+ $this->assertArrayNotHasKey('ExistsNot', $data);
}
/**
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
index 2b6e6c4169..dd0cf9cd87 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
@@ -35,7 +35,7 @@ class JsonBundleReaderTest extends TestCase
$this->assertInternalType('array', $data);
$this->assertSame('Bar', $data['Foo']);
- $this->assertFalse(isset($data['ExistsNot']));
+ $this->assertArrayNotHasKey('ExistsNot', $data);
}
/**
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
index 954e2f0423..f6adae9b7d 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
@@ -35,7 +35,7 @@ class PhpBundleReaderTest extends TestCase
$this->assertInternalType('array', $data);
$this->assertSame('Bar', $data['Foo']);
- $this->assertFalse(isset($data['ExistsNot']));
+ $this->assertArrayNotHasKey('ExistsNot', $data);
}
/**
diff --git a/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php b/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
index bbaecfcbd6..f13bf36c96 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
@@ -34,8 +34,8 @@ class RingBufferTest extends TestCase
$this->buffer[0] = 'foo';
$this->buffer['bar'] = 'baz';
- $this->assertTrue(isset($this->buffer[0]));
- $this->assertTrue(isset($this->buffer['bar']));
+ $this->assertArrayHasKey(0, $this->buffer);
+ $this->assertArrayHasKey('bar', $this->buffer);
$this->assertSame('foo', $this->buffer[0]);
$this->assertSame('baz', $this->buffer['bar']);
}
@@ -46,8 +46,8 @@ class RingBufferTest extends TestCase
$this->buffer['bar'] = 'baz';
$this->buffer[2] = 'bam';
- $this->assertTrue(isset($this->buffer['bar']));
- $this->assertTrue(isset($this->buffer[2]));
+ $this->assertArrayHasKey('bar', $this->buffer);
+ $this->assertArrayHasKey(2, $this->buffer);
$this->assertSame('baz', $this->buffer['bar']);
$this->assertSame('bam', $this->buffer[2]);
}
@@ -62,14 +62,14 @@ class RingBufferTest extends TestCase
public function testQueryNonExisting()
{
- $this->assertFalse(isset($this->buffer['foo']));
+ $this->assertArrayNotHasKey('foo', $this->buffer);
}
public function testUnsetNonExistingSucceeds()
{
unset($this->buffer['foo']);
- $this->assertFalse(isset($this->buffer['foo']));
+ $this->assertArrayNotHasKey('foo', $this->buffer);
}
/**
@@ -86,7 +86,7 @@ class RingBufferTest extends TestCase
public function testQueryOverwritten()
{
- $this->assertFalse(isset($this->buffer[0]));
+ $this->assertArrayNotHasKey(0, $this->buffer);
}
public function testUnsetOverwrittenSucceeds()
@@ -97,6 +97,6 @@ class RingBufferTest extends TestCase
unset($this->buffer[0]);
- $this->assertFalse(isset($this->buffer[0]));
+ $this->assertArrayNotHasKey(0, $this->buffer);
}
}
diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
index b95e039dc3..fb15b1843b 100644
--- a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
+++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
@@ -1504,12 +1504,12 @@ class OptionsResolverTest extends TestCase
});
$this->resolver->setDefault('lazy2', function (Options $options) {
- Assert::assertTrue(isset($options['default1']));
- Assert::assertTrue(isset($options['default2']));
- Assert::assertTrue(isset($options['required']));
- Assert::assertTrue(isset($options['lazy1']));
- Assert::assertTrue(isset($options['lazy2']));
- Assert::assertFalse(isset($options['defined']));
+ Assert::assertArrayHasKey('default1', $options);
+ Assert::assertArrayHasKey('default2', $options);
+ Assert::assertArrayHasKey('required', $options);
+ Assert::assertArrayHasKey('lazy1', $options);
+ Assert::assertArrayHasKey('lazy2', $options);
+ Assert::assertArrayNotHasKey('defined', $options);
Assert::assertSame(0, $options['default1']);
Assert::assertSame(42, $options['default2']);
diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php
index e304d88e95..a38287bcd9 100644
--- a/src/Symfony/Component/Process/Tests/ProcessTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessTest.php
@@ -571,7 +571,7 @@ class ProcessTest extends TestCase
{
$process = $this->getProcess('echo foo');
$process->run();
- $this->assertTrue(strlen($process->getOutput()) > 0);
+ $this->assertGreaterThan(0, strlen($process->getOutput()));
}
public function testGetExitCodeIsNullOnStart()
diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
index aaa352d22c..acb9eddb34 100644
--- a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
+++ b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
@@ -96,10 +96,10 @@ EOF;
$code = rtrim($this->compileRoutes($this->getRoutes(), $supportsRedirections), "\n");
return <<context;
\$request = \$this->request;
@@ -362,7 +362,7 @@ EOF;
if ($hasTrailingSlash) {
$code .= <<redirect(\$pathinfo.'/', '$name'));
+ return array_replace(\$ret, \$this->redirect(\$rawPathinfo.'/', '$name'));
}
@@ -377,7 +377,7 @@ EOF;
$code .= <<redirect(\$pathinfo, '$name', key(\$requiredSchemes)));
+ return array_replace(\$ret, \$this->redirect(\$rawPathinfo, '$name', key(\$requiredSchemes)));
}
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher0.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher0.php
index 0fa8ea45e0..839c7d1372 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher0.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher0.php
@@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$this->context = $context;
}
- public function match($pathinfo)
+ public function match($rawPathinfo)
{
$allow = array();
- $pathinfo = rawurldecode($pathinfo);
+ $pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php
index 51fd29e862..5d7dca8e55 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php
@@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$this->context = $context;
}
- public function match($pathinfo)
+ public function match($rawPathinfo)
{
$allow = array();
- $pathinfo = rawurldecode($pathinfo);
+ $pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php
index fa1a1a8db4..49ce082a81 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php
@@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$this->context = $context;
}
- public function match($pathinfo)
+ public function match($rawPathinfo)
{
$allow = array();
- $pathinfo = rawurldecode($pathinfo);
+ $pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
@@ -84,7 +84,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/test/baz3' === $trimmedPathinfo) {
$ret = array('_route' => 'baz3');
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'baz3'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'baz3'));
}
return $ret;
@@ -96,7 +96,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if (preg_match('#^/test/(?P[^/]++)/?$#s', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'baz4'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'baz4'));
}
return $ret;
@@ -180,7 +180,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/multi/hey' === $trimmedPathinfo) {
$ret = array('_route' => 'hey');
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'hey'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'hey'));
}
return $ret;
@@ -327,7 +327,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'secure');
$requiredSchemes = array ( 'https' => 0,);
if (!isset($requiredSchemes[$scheme])) {
- return array_replace($ret, $this->redirect($pathinfo, 'secure', key($requiredSchemes)));
+ return array_replace($ret, $this->redirect($rawPathinfo, 'secure', key($requiredSchemes)));
}
return $ret;
@@ -338,7 +338,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'nonsecure');
$requiredSchemes = array ( 'http' => 0,);
if (!isset($requiredSchemes[$scheme])) {
- return array_replace($ret, $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes)));
+ return array_replace($ret, $this->redirect($rawPathinfo, 'nonsecure', key($requiredSchemes)));
}
return $ret;
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php
index c982a45434..ae54956312 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php
@@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$this->context = $context;
}
- public function match($pathinfo)
+ public function match($rawPathinfo)
{
$allow = array();
- $pathinfo = rawurldecode($pathinfo);
+ $pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher4.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher4.php
index 6aefd69382..50da489fb2 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher4.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher4.php
@@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$this->context = $context;
}
- public function match($pathinfo)
+ public function match($rawPathinfo)
{
$allow = array();
- $pathinfo = rawurldecode($pathinfo);
+ $pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher5.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher5.php
index c7ee2806b8..51be5b0bc8 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher5.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher5.php
@@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$this->context = $context;
}
- public function match($pathinfo)
+ public function match($rawPathinfo)
{
$allow = array();
- $pathinfo = rawurldecode($pathinfo);
+ $pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
@@ -58,7 +58,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/a/44' === $trimmedPathinfo) {
$ret = array('_route' => 'a_fourth');
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'a_fourth'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_fourth'));
}
return $ret;
@@ -68,7 +68,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/a/55' === $trimmedPathinfo) {
$ret = array('_route' => 'a_fifth');
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'a_fifth'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_fifth'));
}
return $ret;
@@ -78,7 +78,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/a/66' === $trimmedPathinfo) {
$ret = array('_route' => 'a_sixth');
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'a_sixth'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_sixth'));
}
return $ret;
@@ -96,7 +96,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/nested/group/a' === $trimmedPathinfo) {
$ret = array('_route' => 'nested_a');
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'nested_a'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_a'));
}
return $ret;
@@ -106,7 +106,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/nested/group/b' === $trimmedPathinfo) {
$ret = array('_route' => 'nested_b');
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'nested_b'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_b'));
}
return $ret;
@@ -116,7 +116,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/nested/group/c' === $trimmedPathinfo) {
$ret = array('_route' => 'nested_c');
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'nested_c'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_c'));
}
return $ret;
@@ -129,7 +129,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/slashed/group' === $trimmedPathinfo) {
$ret = array('_route' => 'slashed_a');
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'slashed_a'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_a'));
}
return $ret;
@@ -139,7 +139,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/slashed/group/b' === $trimmedPathinfo) {
$ret = array('_route' => 'slashed_b');
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'slashed_b'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_b'));
}
return $ret;
@@ -149,7 +149,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/slashed/group/c' === $trimmedPathinfo) {
$ret = array('_route' => 'slashed_c');
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'slashed_c'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_c'));
}
return $ret;
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher6.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher6.php
index bb9d80b551..933525699c 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher6.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher6.php
@@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$this->context = $context;
}
- public function match($pathinfo)
+ public function match($rawPathinfo)
{
$allow = array();
- $pathinfo = rawurldecode($pathinfo);
+ $pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher7.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher7.php
index 42d5778b5a..bceee6f3a3 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher7.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher7.php
@@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$this->context = $context;
}
- public function match($pathinfo)
+ public function match($rawPathinfo)
{
$allow = array();
- $pathinfo = rawurldecode($pathinfo);
+ $pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
@@ -35,7 +35,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/trailing/simple/no-methods' === $trimmedPathinfo) {
$ret = array('_route' => 'simple_trailing_slash_no_methods');
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'simple_trailing_slash_no_methods'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_no_methods'));
}
return $ret;
@@ -50,7 +50,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'simple_trailing_slash_GET_method');
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'simple_trailing_slash_GET_method'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_GET_method'));
}
return $ret;
@@ -66,7 +66,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'simple_trailing_slash_HEAD_method');
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'simple_trailing_slash_HEAD_method'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_HEAD_method'));
}
return $ret;
@@ -91,7 +91,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P[^/]++)/?$#s', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ());
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'regex_trailing_slash_no_methods'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_no_methods'));
}
return $ret;
@@ -106,7 +106,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'regex_trailing_slash_GET_method'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_GET_method'));
}
return $ret;
@@ -122,7 +122,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());
if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($pathinfo.'/', 'regex_trailing_slash_HEAD_method'));
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_HEAD_method'));
}
return $ret;
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
index 8b32e0cd3d..4365394d23 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
@@ -13,11 +13,39 @@ namespace Symfony\Component\Routing\Tests\Matcher\Dumper;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
+use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface;
+use Symfony\Component\Routing\Matcher\UrlMatcher;
+use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
class PhpMatcherDumperTest extends TestCase
{
+ /**
+ * @var string
+ */
+ private $matcherClass;
+
+ /**
+ * @var string
+ */
+ private $dumpPath;
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->matcherClass = uniqid('ProjectUrlMatcher');
+ $this->dumpPath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_matcher.'.$this->matcherClass.'.php';
+ }
+
+ protected function tearDown()
+ {
+ parent::tearDown();
+
+ @unlink($this->dumpPath);
+ }
+
/**
* @expectedException \LogicException
*/
@@ -36,6 +64,23 @@ class PhpMatcherDumperTest extends TestCase
$dumper->dump();
}
+ public function testRedirectPreservesUrlEncoding()
+ {
+ $collection = new RouteCollection();
+ $collection->add('foo', new Route('/foo:bar/'));
+
+ $class = $this->generateDumpedMatcher($collection, true);
+
+ $matcher = $this->getMockBuilder($class)
+ ->setMethods(array('redirect'))
+ ->setConstructorArgs(array(new RequestContext()))
+ ->getMock();
+
+ $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/', 'foo');
+
+ $matcher->match('/foo%3Abar');
+ }
+
/**
* @dataProvider getRouteCollections
*/
@@ -384,4 +429,31 @@ class PhpMatcherDumperTest extends TestCase
array($trailingSlashCollection, 'url_matcher7.php', array('base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher')),
);
}
+
+ /**
+ * @param $dumper
+ */
+ private function generateDumpedMatcher(RouteCollection $collection, $redirectableStub = false)
+ {
+ $options = array('class' => $this->matcherClass);
+
+ if ($redirectableStub) {
+ $options['base_class'] = '\Symfony\Component\Routing\Tests\Matcher\Dumper\RedirectableUrlMatcherStub';
+ }
+
+ $dumper = new PhpMatcherDumper($collection);
+ $code = $dumper->dump($options);
+
+ file_put_contents($this->dumpPath, $code);
+ include $this->dumpPath;
+
+ return $this->matcherClass;
+ }
+}
+
+abstract class RedirectableUrlMatcherStub extends UrlMatcher implements RedirectableUrlMatcherInterface
+{
+ public function redirect($path, $route, $scheme = null)
+ {
+ }
}
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
index ddd2133e96..3c84c35209 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
@@ -98,4 +98,14 @@ class RedirectableUrlMatcherTest extends TestCase
;
$this->assertEquals(array('_route' => 'foo', 'bar' => 'baz', 'redirect' => 'value'), $matcher->match('/foo/baz'));
}
+
+ public function testRedirectPreservesUrlEncoding()
+ {
+ $coll = new RouteCollection();
+ $coll->add('foo', new Route('/foo:bar/'));
+
+ $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext()));
+ $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/');
+ $matcher->match('/foo%3Abar');
+ }
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
index ca28d53c5c..e3e1c447af 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
@@ -61,9 +61,9 @@ class AuthorizationCheckerTest extends TestCase
->will($this->returnValue(true));
// first run the token has not been re-authenticated yet, after isGranted is called, it should be equal
- $this->assertFalse($newToken === $this->tokenStorage->getToken());
+ $this->assertNotSame($newToken, $this->tokenStorage->getToken());
$this->assertTrue($this->authorizationChecker->isGranted('foo'));
- $this->assertTrue($newToken === $this->tokenStorage->getToken());
+ $this->assertSame($newToken, $this->tokenStorage->getToken());
}
/**
@@ -90,7 +90,7 @@ class AuthorizationCheckerTest extends TestCase
->method('decide')
->will($this->returnValue($decide));
$this->tokenStorage->setToken($token);
- $this->assertTrue($decide === $this->authorizationChecker->isGranted('ROLE_FOO'));
+ $this->assertSame($decide, $this->authorizationChecker->isGranted('ROLE_FOO'));
}
public function isGrantedProvider()
diff --git a/src/Symfony/Component/Templating/Tests/Helper/HelperTest.php b/src/Symfony/Component/Templating/Tests/Helper/HelperTest.php
index 8921ff19c8..dec9082efc 100644
--- a/src/Symfony/Component/Templating/Tests/Helper/HelperTest.php
+++ b/src/Symfony/Component/Templating/Tests/Helper/HelperTest.php
@@ -20,7 +20,7 @@ class HelperTest extends TestCase
{
$helper = new ProjectTemplateHelper();
$helper->setCharset('ISO-8859-1');
- $this->assertTrue('ISO-8859-1' === $helper->getCharset(), '->setCharset() sets the charset set related to this helper');
+ $this->assertSame('ISO-8859-1', $helper->getCharset(), '->setCharset() sets the charset set related to this helper');
}
}
diff --git a/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php
index b4bf42b572..c889d21817 100644
--- a/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php
+++ b/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php
@@ -23,7 +23,7 @@ class CacheLoaderTest extends TestCase
public function testConstructor()
{
$loader = new ProjectTemplateLoader($varLoader = new ProjectTemplateLoaderVar(), sys_get_temp_dir());
- $this->assertTrue($loader->getLoader() === $varLoader, '__construct() takes a template loader as its first argument');
+ $this->assertSame($loader->getLoader(), $varLoader, '__construct() takes a template loader as its first argument');
$this->assertEquals(sys_get_temp_dir(), $loader->getDir(), '__construct() takes a directory where to store the cache as its second argument');
}
diff --git a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
index c7418d392f..8889ae12ac 100644
--- a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
+++ b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
@@ -65,7 +65,7 @@ class PhpEngineTest extends TestCase
$engine[$foo] = 'bar';
$this->assertEquals($foo, $engine->get('bar'), '->set() takes an alias as a second argument');
- $this->assertTrue(isset($engine['bar']));
+ $this->assertArrayHasKey('bar', $engine);
try {
$engine->get('foobar');
@@ -75,7 +75,7 @@ class PhpEngineTest extends TestCase
$this->assertEquals('The helper "foobar" is not defined.', $e->getMessage(), '->get() throws an InvalidArgumentException if the helper is not defined');
}
- $this->assertTrue(isset($engine['bar']));
+ $this->assertArrayHasKey('bar', $engine);
$this->assertTrue($engine->has('foo'), '->has() returns true if the helper exists');
$this->assertFalse($engine->has('foobar'), '->has() returns false if the helper does not exist');
}
diff --git a/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php b/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php
index 1631b7aadb..f0e6afe20d 100644
--- a/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php
+++ b/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php
@@ -89,16 +89,16 @@ class ConstraintViolationListTest extends TestCase
$this->list[] = $violation;
$this->assertSame($violation, $this->list[0]);
- $this->assertTrue(isset($this->list[0]));
+ $this->assertArrayHasKey(0, $this->list);
unset($this->list[0]);
- $this->assertFalse(isset($this->list[0]));
+ $this->assertArrayNotHasKey(0, $this->list);
$this->list[10] = $violation;
$this->assertSame($violation, $this->list[10]);
- $this->assertTrue(isset($this->list[10]));
+ $this->assertArrayHasKey(10, $this->list);
}
public function testToString()