8000 Remove useless parent method calls in tests by alexandre-daubois · Pull Request #58374 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Remove useless parent method calls in tests #58374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove useless parent method calls in tests
  • Loading branch information
alexandre-daubois committed Sep 24, 2024
commit b54596f6042158f0f4dab91559c8c34a121d51b7
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class DoctrineExtensionTest extends TestCase

protected function setUp(): void
{
parent::setUp();

$this->extension = $this
->getMockBuilder(AbstractDoctrineExtension::class)
->onlyMethods([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class MiddlewareTest extends TestCase

protected function setUp(): void
{
parent::setUp();

if (!interface_exists(MiddlewareInterface::class)) {
$this->markTestSkipped(\sprintf('%s needed to run this test', MiddlewareInterface::class));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ protected function getExtensions()
protected function tearDown(): void
{
\Locale::setDefault($this->defaultLocale);

parent::tearDown();
}

protected function assertWidgetMatchesXpath(FormView $view, array $vars, $xpath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class UidTest extends AbstractWebTestCase
{
protected function setUp(): void
{
parent::setUp();

self::deleteTmpDir();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public static function assertSaneContainer(Container $container)

protected function setUp(): void
{
parent::setUp();

$this->kernel = $this->createMock(KernelInterface::class);

$profiler = $this->createMock(Profiler::class);
Expand Down Expand Up @@ -88,8 +86,6 @@ protected function setUp(): void

protected function tearDown(): void
{
parent::tearDown();

$this->container = null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class TemplateManagerTest extends TestCase

protected function setUp(): void
{
parent::setUp();

$this->profiler = $this->createMock(Profiler::class);
$twigEnvironment = $this->mockTwigEnvironment();
$templates = [
Expand Down
2 changes: 0 additions & 2 deletions src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ abstract class AdapterTestCase extends CachePoolTest
{
protected function setUp(): void
{
parent::setUp();

if (!\array_key_exists('testPrune', $this->skippedTests) && !$this->createCachePool() instanceof PruneableInterface) {
$this->skippedTests['testPrune'] = 'Not a pruneable cache pool.';
}
Expand Down
2 changes: 0 additions & 2 deletions src/Symfony/Component/Cache/Tests/Psr16CacheProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ class Psr16CacheProxyTest extends SimpleCacheTest
{
protected function setUp(): void
{
parent::setUp();

try {
\assert(false === true, new \Exception());
$this->skippedTests['testGetInvalidKeys'] =
Expand Down
2 changes: 0 additions & 2 deletions src/Symfony/Component/Cache/Tests/Psr16CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class Psr16CacheTest extends SimpleCacheTest
{
protected function setUp(): void
{
parent::setUp();

if (\array_key_exists('testPrune', $this->skippedTests)) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class Psr16CacheWithExternalAdapter extends SimpleCacheTest
{
protected function setUp(): void
{
parent::setUp();

$this->skippedTests['testSetTtl'] =
$this->skippedTests['testSetMultipleTtl'] = 'The ExternalAdapter test class does not support TTLs.';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,13 @@ class GeneratedConfigTest extends TestCase

protected function setup(): void
{
parent::setup();

$this->tempDir = [];
}

protected function tearDown(): void
{
(new Filesystem())->remove($this->tempDir);
$this->tempDir = [];

parent::tearDown();
}

public static function fixtureNames()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class QuestionTest extends TestCase

protected function setUp(): void
{
parent::setUp();
$this->question = new Question('Test question');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ abstract class AbstractChoiceListTestCase extends TestCase

protected function setUp(): void
{
parent::setUp();

$this->list = $this->createChoiceList();

$choices = $this->getChoices();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class DateTimeToLocalizedStringTransformerTest extends BaseDateTimeTransformerTe

protected function setUp(): void
{
parent::setUp();

// Normalize intl. configuration settings.
if (\extension_loaded('intl')) {
$this->initialTestCaseUseException = ini_set('intl.use_exceptions', 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class DateTimeToRfc3339TransformerTest extends BaseDateTimeTransformerTestCase

protected function setUp(): void
{
parent::setUp();

$this->dateTime = new \DateTime('2010-02-03 04:05:06 UTC');
$this->dateTimeWithoutSeconds = new \DateTime('2010-02-03 04:05:00 UTC');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ protected function setUp(): void

protected function tearDown(): void
{
parent::tearDown();

\Locale::setDefault($this->defaultLocale);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ protected function setUp(): void

protected function tearDown(): void
{
parent::tearDown();

\Locale::setDefault($this->defaultLocale);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ protected function setUp(): void

protected function tearDown(): void
{
parent::tearDown();

\Locale::setDefault($this->defaultLocale);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ protected function setUp(): void

protected function tearDown(): void
{
parent::tearDown();

$_GET = [];
$_POST = [];
$_FILES = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class AutoExpireFlashBagTest extends TestCase

protected function setUp(): void
{
parent::setUp();
$this->bag = new FlashBag();
$this->array = ['new' => ['notice' => ['A previous flash message']]];
$this->bag->initialize($this->array);
Expand All @@ -36,7 +35,6 @@ protected function setUp(): void
protected function tearDown(): void
{
unset($this->bag);
parent::tearDown();
}

public function testInitialize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class FlashBagTest extends TestCase

protected function setUp(): void
{
parent::setUp();
$this->bag = new FlashBag();
$this->array = ['notice' => ['A previous flash message']];
$this->bag->initialize($this->array);
Expand All @@ -36,7 +35,6 @@ protected function setUp(): void
protected function tearDown(): void
{
unset($this->bag);
parent::tearDown();
}

public function testInitialize()
Expand Down
B41A
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ abstract protected function createRedisClient(string $host): \Redis|Relay|\Redis

protected function setUp(): void
{
parent::setUp();

if (!\extension_loaded('redis')) {
self::markTestSkipped('Extension redis required.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class MemcachedSessionHandlerTest extends TestCase

protected function setUp(): void
{
parent::setUp();

if (version_compare(phpversion('memcached'), '2.2.0', '>=') && version_compare(phpversion('memcached'), '3.0.0b1', '<')) {
$this->markTestSkipped('Tests can only be run with memcached extension 2.1.0 or lower, or 3.0.0b1 or higher');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ class MongoDbSessionHandlerTest extends TestCase

protected function setUp(): void
{
parent::setUp();

$this->manager = new Manager('mongodb://'.getenv('MONGODB_HOST'));

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ protected function tearDown(): void
if ($this->dbFile) {
@unlink($this->dbFile);
}
parent::tearDown();
}

protected function getPersistentSqliteDsn()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class MetadataBagTest extends TestCase

protected function setUp(): void
{
parent::setUp();
$this->bag = new MetadataBag();
$this->array = [MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 0];
$this->bag->initialize($this->array);
Expand Down
4 changes: 0 additions & 4 deletions src/Symfony/Component/Intl/Tests/IntlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,11 @@ class IntlTest extends TestCase

protected function setUp(): void
{
parent::setUp();

$this->defaultLocale = \Locale::getDefault();
}

protected function tearDown(): void
{
parent::tearDown();

\Locale::setDefault($this->defaultLocale);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ final class NativeTransportFactoryTest extends TestCase

public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();

$namespace = str_replace('\\Tests\\', '\\', __NAMESPACE__);

$current = static::class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ class AmqpExtIntegrationTest extends TestCase
{
protected function setUp(): void
{
parent::setUp();

if (!getenv('MESSENGER_AMQP_DSN')) {
$this->markTestSkipped('The "MESSENGER_AMQP_DSN" environment variable is required.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class CompiledUrlGeneratorDumperTest extends TestCase

protected function setUp(): void
{
parent::setUp();

$this->routeCollection = new RouteCollection();
$this->generatorDumper = new CompiledUrlGeneratorDumper($this->routeCollection);
$this->testTmpFilepath = sys_get_temp_dir().'/php_generator.'.$this->getName().'.php';
Expand All @@ -45,8 +43,6 @@ protected function setUp(): void

protected function tearDown(): void
{
parent::tearDown();

@unlink($this->testTmpFilepath);
@unlink($this->largeTestTmpFilepath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ class AttributeClassLoaderTest extends TestCase

protected function setUp(?string $env = null): void
{
parent::setUp();

$this->loader = new TraceableAttributeClassLoader($env);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ class AttributeDirectoryLoaderTest extends TestCase

protected function setUp(): void
{
parent::setUp();

$this->classLoader = new TraceableAttributeClassLoader();
$this->loader = new AttributeDirectoryLoader(new FileLocator(), $this->classLoader);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class AttributeFileLoaderTest extends TestCase

protected function setUp(): void
{
parent::setUp();

$this->classLoader = new TraceableAttributeClassLoader();
$this->loader = new AttributeFileLoader(new FileLocator(), $this->classLoader);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ class DirectoryLoaderTest extends TestCase

protected function setUp(): void
{
parent::setUp();

$locator = new FileLocator();
$this->loader = new DirectoryLoader($locator);
$resolver = new LoaderResolver([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,11 @@ class CompiledUrlMatcherDumperTest extends TestCase

protected function setUp(): void
{
parent::setUp();

$this->dumpPath = tempnam(sys_get_temp_dir(), 'sf_matcher_');
}

protected function tearDown(): void
{
parent::tearDown();

@unlink($this->dumpPath);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,6 @@ protected function setUp(): void

protected function tearDown(): void
{
parent::tearDown();

unset($_SERVER['HTTPS']);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ abstract class TranslationProviderTestCase extends TestCase

protected function setUp(): void
{
parent::setUp();
$this->defaultLocale = \Locale::getDefault();
\Locale::setDefault('en');
$this->fs = new Filesystem();
Expand All @@ -42,7 +41,6 @@ protected function tearDown(): void
{
\Locale::setDefault($this->defaultLocale);
$this->fs->remove($this->translationAppDir);
parent::tearDown();
}

protected function getProviderCollection(ProviderInterface $provider, array $providerNames = ['loco'], array $locales = ['en'], array $domains = ['messages']): TranslationProviderCollection
Expand Down
Loading
0