minor #32969 Use assertContainsEquals when needed (jderusse)
This PR was merged into the 3.4 branch.
Discussion
----------
Use assertContainsEquals when needed
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #32844
| License | MIT
| Doc PR | NA
This PR replaces deprecated paramèter `$checkForObjectIdentity` of methods `assertContains` by the dedicated method `assertContainsEquals`
Commits
-------
f842e59685
Use assert assertContainsEquals when needed
This commit is contained in:
commit
443e923c7b
@ -85,7 +85,7 @@ class MergeExtensionConfigurationPassTest extends TestCase
|
|||||||
$pass = new MergeExtensionConfigurationPass();
|
$pass = new MergeExtensionConfigurationPass();
|
||||||
$pass->process($container);
|
$pass->process($container);
|
||||||
|
|
||||||
$this->assertContains(new FileResource(__FILE__), $container->getResources(), '', false, false);
|
$this->assertContainsEquals(new FileResource(__FILE__), $container->getResources());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testOverriddenEnvsAreMerged()
|
public function testOverriddenEnvsAreMerged()
|
||||||
|
@ -32,11 +32,11 @@ class CountryTypeTest extends BaseTypeTest
|
|||||||
->createView()->vars['choices'];
|
->createView()->vars['choices'];
|
||||||
|
|
||||||
// Don't check objects for identity
|
// Don't check objects for identity
|
||||||
$this->assertContains(new ChoiceView('DE', 'DE', 'Germany'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('DE', 'DE', 'Germany'), $choices);
|
||||||
$this->assertContains(new ChoiceView('GB', 'GB', 'United Kingdom'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('GB', 'GB', 'United Kingdom'), $choices);
|
||||||
$this->assertContains(new ChoiceView('US', 'US', 'United States'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('US', 'US', 'United States'), $choices);
|
||||||
$this->assertContains(new ChoiceView('FR', 'FR', 'France'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('FR', 'FR', 'France'), $choices);
|
||||||
$this->assertContains(new ChoiceView('MY', 'MY', 'Malaysia'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('MY', 'MY', 'Malaysia'), $choices);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUnknownCountryIsNotIncluded()
|
public function testUnknownCountryIsNotIncluded()
|
||||||
|
@ -31,9 +31,9 @@ class CurrencyTypeTest extends BaseTypeTest
|
|||||||
$choices = $this->factory->create(static::TESTED_TYPE)
|
$choices = $this->factory->create(static::TESTED_TYPE)
|
||||||
->createView()->vars['choices'];
|
->createView()->vars['choices'];
|
||||||
|
|
||||||
$this->assertContains(new ChoiceView('EUR', 'EUR', 'Euro'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('EUR', 'EUR', 'Euro'), $choices);
|
||||||
$this->assertContains(new ChoiceView('USD', 'USD', 'US Dollar'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('USD', 'USD', 'US Dollar'), $choices);
|
||||||
$this->assertContains(new ChoiceView('SIT', 'SIT', 'Slovenian Tolar'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('SIT', 'SIT', 'Slovenian Tolar'), $choices);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitNull($expected = null, $norm = null, $view = null)
|
public function testSubmitNull($expected = null, $norm = null, $view = null)
|
||||||
|
@ -31,11 +31,11 @@ class LanguageTypeTest extends BaseTypeTest
|
|||||||
$choices = $this->factory->create(static::TESTED_TYPE)
|
$choices = $this->factory->create(static::TESTED_TYPE)
|
||||||
->createView()->vars['choices'];
|
->createView()->vars['choices'];
|
||||||
|
|
||||||
$this->assertContains(new ChoiceView('en', 'en', 'English'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('en', 'en', 'English'), $choices);
|
||||||
$this->assertContains(new ChoiceView('en_GB', 'en_GB', 'British English'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('en_GB', 'en_GB', 'British English'), $choices);
|
||||||
$this->assertContains(new ChoiceView('en_US', 'en_US', 'American English'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('en_US', 'en_US', 'American English'), $choices);
|
||||||
$this->assertContains(new ChoiceView('fr', 'fr', 'French'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('fr', 'fr', 'French'), $choices);
|
||||||
$this->assertContains(new ChoiceView('my', 'my', 'Burmese'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('my', 'my', 'Burmese'), $choices);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMultipleLanguagesIsNotIncluded()
|
public function testMultipleLanguagesIsNotIncluded()
|
||||||
@ -43,7 +43,7 @@ class LanguageTypeTest extends BaseTypeTest
|
|||||||
$choices = $this->factory->create(static::TESTED_TYPE, 'language')
|
$choices = $this->factory->create(static::TESTED_TYPE, 'language')
|
||||||
->createView()->vars['choices'];
|
->createView()->vars['choices'];
|
||||||
|
|
||||||
$this->assertNotContains(new ChoiceView('mul', 'mul', 'Mehrsprachig'), $choices, '', false, false);
|
$this->assertNotContainsEquals(new ChoiceView('mul', 'mul', 'Mehrsprachig'), $choices);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitNull($expected = null, $norm = null, $view = null)
|
public function testSubmitNull($expected = null, $norm = null, $view = null)
|
||||||
|
@ -31,9 +31,9 @@ class LocaleTypeTest extends BaseTypeTest
|
|||||||
$choices = $this->factory->create(static::TESTED_TYPE)
|
$choices = $this->factory->create(static::TESTED_TYPE)
|
||||||
->createView()->vars['choices'];
|
->createView()->vars['choices'];
|
||||||
|
|
||||||
$this->assertContains(new ChoiceView('en', 'en', 'English'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('en', 'en', 'English'), $choices);
|
||||||
$this->assertContains(new ChoiceView('en_GB', 'en_GB', 'English (United Kingdom)'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('en_GB', 'en_GB', 'English (United Kingdom)'), $choices);
|
||||||
$this->assertContains(new ChoiceView('zh_Hant_HK', 'zh_Hant_HK', 'Chinese (Traditional, Hong Kong SAR China)'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('zh_Hant_HK', 'zh_Hant_HK', 'Chinese (Traditional, Hong Kong SAR China)'), $choices);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitNull($expected = null, $norm = null, $view = null)
|
public function testSubmitNull($expected = null, $norm = null, $view = null)
|
||||||
|
@ -23,10 +23,10 @@ class TimezoneTypeTest extends BaseTypeTest
|
|||||||
->createView()->vars['choices'];
|
->createView()->vars['choices'];
|
||||||
|
|
||||||
$this->assertArrayHasKey('Africa', $choices);
|
$this->assertArrayHasKey('Africa', $choices);
|
||||||
$this->assertContains(new ChoiceView('Africa/Kinshasa', 'Africa/Kinshasa', 'Kinshasa'), $choices['Africa'], '', false, false);
|
$this->assertContainsEquals(new ChoiceView('Africa/Kinshasa', 'Africa/Kinshasa', 'Kinshasa'), $choices['Africa']);
|
||||||
|
|
||||||
$this->assertArrayHasKey('America', $choices);
|
$this->assertArrayHasKey('America', $choices);
|
||||||
$this->assertContains(new ChoiceView('America/New_York', 'America/New_York', 'New York'), $choices['America'], '', false, false);
|
$this->assertContainsEquals(new ChoiceView('America/New_York', 'America/New_York', 'New York'), $choices['America']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitNull($expected = null, $norm = null, $view = null)
|
public function testSubmitNull($expected = null, $norm = null, $view = null)
|
||||||
@ -70,6 +70,6 @@ class TimezoneTypeTest extends BaseTypeTest
|
|||||||
$choices = $this->factory->create(static::TESTED_TYPE, null, ['regions' => \DateTimeZone::EUROPE])
|
$choices = $this->factory->create(static::TESTED_TYPE, null, ['regions' => \DateTimeZone::EUROPE])
|
||||||
->createView()->vars['choices'];
|
->createView()->vars['choices'];
|
||||||
|
|
||||||
$this->assertContains(new ChoiceView('Europe/Amsterdam', 'Europe/Amsterdam', 'Amsterdam'), $choices, '', false, false);
|
$this->assertContainsEquals(new ChoiceView('Europe/Amsterdam', 'Europe/Amsterdam', 'Amsterdam'), $choices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,8 +208,8 @@ class UserAuthenticationProviderTest extends TestCase
|
|||||||
|
|
||||||
$this->assertInstanceOf('Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken', $authToken);
|
$this->assertInstanceOf('Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken', $authToken);
|
||||||
$this->assertSame($user, $authToken->getUser());
|
$this->assertSame($user, $authToken->getUser());
|
||||||
$this->assertContains(new Role('ROLE_FOO'), $authToken->getRoles(), '', false, false);
|
$this->assertContainsEquals(new Role('ROLE_FOO'), $authToken->getRoles());
|
||||||
$this->assertContains($switchUserRole, $authToken->getRoles(), '', false, false);
|
$this->assertContainsEquals($switchUserRole, $authToken->getRoles());
|
||||||
$this->assertEquals('foo', $authToken->getCredentials());
|
$this->assertEquals('foo', $authToken->getCredentials());
|
||||||
$this->assertEquals(['foo' => 'bar'], $authToken->getAttributes(), '->authenticate() copies token attributes');
|
$this->assertEquals(['foo' => 'bar'], $authToken->getAttributes(), '->authenticate() copies token attributes');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user