Skip to content

Commit 0a81dc9

Browse files
committed
refactor: remove legacy code
1 parent 0e8344c commit 0a81dc9

File tree

14 files changed

+8
-169
lines changed

14 files changed

+8
-169
lines changed

Tests/Functional/BaseTestCase.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,12 @@ class BaseTestCase extends WebTestCase
2828
{
2929
protected static function createKernel(array $options = []): KernelInterface
3030
{
31-
$isSf5 = version_compare(Kernel::VERSION, '5.0.0') >= 0;
32-
33-
$default = $isSf5 ? 'default_sf5.yml' : 'default.yml';
34-
3531
if (version_compare(Kernel::VERSION, '6.0.0') >= 0) {
3632
$conf = 'framework_sf6.yml';
37-
} elseif (version_compare(Kernel::VERSION, '5.0.0') >= 0) {
38-
$conf = 'framework.yml';
3933
} else {
4034
$conf = 'framework.yml';
4135
}
4236

43-
return new AppKernel($conf, $options['config'] ?? $default);
37+
return new AppKernel($conf, $options['config'] ?? 'default.yml');
4438
}
4539
}

Tests/Functional/Controller/ApiControllerTest.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace JMS\TranslationBundle\Tests\Functional\Controller;
66

77
use JMS\TranslationBundle\Tests\Functional\BaseTestCase;
8-
use Symfony\Component\HttpKernel\Kernel;
98
use Symfony\Component\Yaml\Yaml;
109

1110
/**
@@ -19,10 +18,8 @@ public function testUpdateAction()
1918
$client = static::createClient(['config' => 'test_updating_translations.yml']);
2019
$outputDir = $client->getContainer()->getParameter('translation_output_dir');
2120

22-
$isSf4 = version_compare(Kernel::VERSION, '4.0.0') >= 0;
23-
2421
// Add a file
25-
$file = $isSf4 ? $outputDir . '/navigation.en.yaml' : $outputDir . '/navigation.en.yml';
22+
$file = $outputDir . '/navigation.en.yaml';
2623
$written = file_put_contents($file, 'main.home: Home');
2724
$this->assertTrue($written !== false && $written > 0);
2825

@@ -35,13 +32,7 @@ public function testUpdateAction()
3532
// Verify that the file has new content
3633
$array = Yaml::parse($fileContent);
3734

38-
if ($isSf4) {
39-
$this->assertTrue(isset($array['main.home']), print_r($array, true));
40-
$this->assertEquals('Away', $array['main.home']);
41-
} else {
42-
$this->assertTrue(isset($array['main']));
43-
$this->assertTrue(isset($array['main']['home']));
44-
$this->assertEquals('Away', $array['main']['home']);
45-
}
35+
$this->assertTrue(isset($array['main.home']), print_r($array, true));
36+
$this->assertEquals('Away', $array['main.home']);
4637
}
4738
}

Tests/Functional/Fixture/TestBundle/Controller/AppleController.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,4 @@ public function viewAction()
2222
{
2323
return ['nbApples' => 5];
2424
}
25-
26-
/**
27-
* @Route("/view_sf5")
28-
* @Template("@Test/Apple/view_sf5.html.twig")
29-
*/
30-
public function viewsf5Action()
31-
{
32-
return ['nbApples' => 5];
33-
}
3425
}

Tests/Functional/Fixture/TestBundle/Resources/views/Apple/view.html.twig

Lines changed: 0 additions & 7 deletions
This file was deleted.

Tests/Functional/Fixture/TestBundle/Resources/views/Apple/view_sf5.html.twig

Lines changed: 0 additions & 2 deletions
This file was deleted.

Tests/Functional/TranslationTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,15 @@
44

55
namespace JMS\TranslationBundle\Tests\Functional;
66

7-
use Symfony\Component\HttpKernel\Kernel;
8-
97
class TranslationTest extends BaseTestCase
108
{
119
public function testTranschoiceWhenTranslationNotYetExtracted()
1210
{
13-
$isSf5 = version_compare(Kernel::VERSION, '5.0.0') >= 0;
14-
15-
$url = $isSf5 ? '/apples/view_sf5' : '/apples/view';
1611
$client = $this->createClient();
17-
$client->request('GET', $url);
12+
$client->request('GET', '/apples/view');
1813
$response = $client->getResponse();
1914

2015
$this->assertEquals(200, $response->getStatusCode(), $response->getContent());
21-
$expected = $isSf5 ? "There are 5 apples\n" : "There are 5 apples\n\nThere are 5 apples\n";
22-
$this->assertEquals($expected, $response->getContent());
16+
$this->assertEquals("There are 5 apples\n", $response->getContent());
2317
}
2418
}

Tests/Functional/config/default.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

Tests/Functional/config/default_sf5.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

Tests/Translation/Extractor/File/TwigFileExtractorTest.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
use Symfony\Bridge\Twig\Extension\FormExtension;
3333
use Symfony\Bridge\Twig\Extension\RoutingExtension;
3434
use Symfony\Bridge\Twig\Extension\TranslationExtension as SymfonyTranslationExtension;
35-
use Symfony\Component\HttpKernel\Kernel;
3635
use Symfony\Component\Routing\Generator\UrlGenerator;
3736
use Symfony\Component\Routing\RequestContext;
3837
use Symfony\Component\Routing\RouteCollection;
@@ -45,12 +44,6 @@ class TwigFileExtractorTest extends TestCase
4544
{
4645
public function testExtractSimpleTemplateInSF5()
4746
{
48-
$isSF5 = version_compare(Kernel::VERSION, '5.0.0') >= 0;
49-
50-
if (! $isSF5) {
51-
$this->markTestSkipped('Test only available with Symfony 5+');
52-
}
53-
5447
$expected = new MessageCatalogue();
5548
$fileSourceFactory = $this->getFileSourceFactory();
5649
$fixtureSplInfo = new \SplFileInfo(__DIR__ . '/Fixture/simple_template_sf5.html.twig');
@@ -104,12 +97,6 @@ public function testExtractSimpleTemplateInSF5()
10497

10598
public function testExtractSimpleTemplate()
10699
{
107-
$isSF5 = version_compare(Kernel::VERSION, '5.0.0') >= 0;
108-
109-
if ($isSF5) {
110-
$this->markTestSkipped('Test only available with Symfony < 5');
111-
}
112-
113100
$expected = new MessageCatalogue();
114101
$fileSourceFactory = $this->getFileSourceFactory();
115102
$fixtureSplInfo = new \SplFileInfo(__DIR__ . '/Fixture/simple_template.html.twig');

Tests/Twig/Fixture/simple_template.html.twig

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)