Skip to content

Commit 62dcf52

Browse files
authored
Merge pull request #600 from deguif/review-tests
Review tests
2 parents 5a9de1a + 765b7f1 commit 62dcf52

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+138
-136
lines changed

Tests/DependencyInjection/Compiler/MountDumpersPassTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void
2323
/**
2424
* @test
2525
*/
26-
public function ifCompilerPassCollectsServicesByArgumentTheseWillExist()
26+
public function ifCompilerPassCollectsServicesByArgumentTheseWillExist(): void
2727
{
2828
$collectingService = new Definition();
2929
$this->setDefinition('jms_translation.file_writer', $collectingService);

Tests/DependencyInjection/Compiler/MountExtractorsPassTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void
2323
/**
2424
* @test
2525
*/
26-
public function ifCompilerPassCollectsServicesByArgumentTheseWillExist()
26+
public function ifCompilerPassCollectsServicesByArgumentTheseWillExist(): void
2727
{
2828
$collectingService = new Definition();
2929
$this->setDefinition('jms_translation.extractor_manager', $collectingService);

Tests/DependencyInjection/Compiler/MountFileVisitorsPassTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void
2323
/**
2424
* @test
2525
*/
26-
public function ifCompilerPassCollectsServicesByArgumentTheseWillExist()
26+
public function ifCompilerPassCollectsServicesByArgumentTheseWillExist(): void
2727
{
2828
$collectingService = new Definition();
2929
$this->setDefinition('jms_translation.extractor.file_extractor', $collectingService);

Tests/DependencyInjection/Compiler/MountLoadersPassTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void
2323
/**
2424
* @test
2525
*/
26-
public function ifCompilerPassCollectsServicesByArgumentTheseWillExist()
26+
public function ifCompilerPassCollectsServicesByArgumentTheseWillExist(): void
2727
{
2828
$collectingService = new Definition();
2929
$this->setDefinition('jms_translation.loader_manager', $collectingService);

Tests/DependencyInjection/JMSTranslationExtensionTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ protected function getContainerExtensions(): array
2222
/**
2323
* @test
2424
*/
25-
public function defaultParametersAfterLoading()
25+
public function defaultParametersAfterLoading(): void
2626
{
2727
$this->load();
2828

@@ -32,7 +32,7 @@ public function defaultParametersAfterLoading()
3232
/**
3333
* @test
3434
*/
35-
public function basicParametersAfterLoading()
35+
public function basicParametersAfterLoading(): void
3636
{
3737
$locales = ['en', 'fr', 'es'];
3838
$this->load(['source_language' => 'fr', 'locales' => $locales]);

Tests/Functional/AppKernel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function registerBundles(): iterable
6969
];
7070
}
7171

72-
public function registerContainerConfiguration(LoaderInterface $loader)
72+
public function registerContainerConfiguration(LoaderInterface $loader): void
7373
{
7474
$loader->load($this->fwConfig);
7575
if ($this->config) {

Tests/Functional/Command/BaseCommandTestCase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
abstract class BaseCommandTestCase extends BaseTestCase
2727
{
28-
protected function getApp(array $options = [])
28+
protected function getApp(array $options = []): Application
2929
{
3030
$kernel = $this->createKernel($options);
3131
$kernel->boot();

Tests/Functional/Command/ExtractCommandTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
class ExtractCommandTest extends BaseCommandTestCase
2727
{
28-
public function testExtract()
28+
public function testExtract(): void
2929
{
3030
$input = new ArgvInput([
3131
'app/console',
@@ -58,7 +58,7 @@ public function testExtract()
5858
$this->assertTrue(isset($files['messages']['en']));
5959
}
6060

61-
public function testExtractDryRun()
61+
public function testExtractDryRun(): void
6262
{
6363
$input = new ArgvInput([
6464
'app/console',

Tests/Functional/Command/Output.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Output extends AbstractOutput
2626
{
2727
private $content = '';
2828

29-
public function doWrite($content, $newline)
29+
public function doWrite($content, $newline): void
3030
{
3131
$this->content .= $content;
3232

Tests/Functional/Controller/ApiControllerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
class ApiControllerTest extends BaseTestCase
1515
{
16-
public function testUpdateAction()
16+
public function testUpdateAction(): void
1717
{
1818
// Start application
1919
$client = static::createClient(['config' => 'test_updating_translations.yml']);

Tests/Functional/Controller/TranslateControllerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
class TranslateControllerTest extends BaseTestCase
1313
{
14-
public function testIndexAction()
14+
public function testIndexAction(): void
1515
{
1616
$client = static::createClient();
1717
$crawler = $client->request('GET', '/_trans/');

Tests/Functional/ServiceInstantiationTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protected function setUp(): void
2020
static::createClient();
2121
}
2222

23-
public function provider()
23+
public static function provider(): array
2424
{
2525
return [
2626
['jms_translation.updater', Updater::class],
@@ -32,7 +32,7 @@ public function provider()
3232
/**
3333
* @dataProvider provider
3434
*/
35-
public function testServiceExists($serviceId, $class)
35+
public function testServiceExists(string $serviceId, string $class): void
3636
{
3737
$container = static::$kernel->getContainer();
3838
$this->assertTrue($container->has($serviceId));

Tests/Functional/TranslationTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class TranslationTest extends BaseTestCase
1010
{
11-
public function testTranschoiceWhenTranslationNotYetExtracted()
11+
public function testTranschoiceWhenTranslationNotYetExtracted(): void
1212
{
1313
$isSf5 = version_compare(Kernel::VERSION, '5.0.0') >= 0;
1414

Tests/Model/FileSourceTest.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,31 @@
2626

2727
class FileSourceTest extends TestCase
2828
{
29-
public function testGetPath()
29+
public function testGetPath(): void
3030
{
3131
$r = new FileSource('foo');
3232
$this->assertEquals('foo', $r->getPath());
3333
}
3434

35-
public function testGetLine()
35+
public function testGetLine(): void
3636
{
3737
$r = new FileSource('foo');
3838
$this->assertNull($r->getLine());
3939
}
4040

41-
public function testGetLineWhenSet()
41+
public function testGetLineWhenSet(): void
4242
{
4343
$r = new FileSource('foo', 2);
4444
$this->assertEquals(2, $r->getLine());
4545
}
4646

47-
public function testGetColumn()
47+
public function testGetColumn(): void
4848
{
4949
$r = new FileSource('foo');
5050
$this->assertNull($r->getColumn());
5151
}
5252

53-
public function testGetColumnWhenSet()
53+
public function testGetColumnWhenSet(): void
5454
{
5555
$r = new FileSource('foo', 1, 2);
5656
$this->assertEquals(2, $r->getColumn());
@@ -59,13 +59,13 @@ public function testGetColumnWhenSet()
5959
/**
6060
* @dataProvider getEqualityTests
6161
*/
62-
public function testEquals($r1, $r2, $expected)
62+
public function testEquals($r1, $r2, $expected): void
6363
{
6464
$this->assertSame($expected, $r1->equals($r2));
6565
$this->assertSame($expected, $r2->equals($r1));
6666
}
6767

68-
public function getEqualityTests()
68+
public function getEqualityTests(): array
6969
{
7070
$tests = [];
7171

@@ -122,12 +122,12 @@ public function getEqualityTests()
122122
/**
123123
* @dataProvider getToStringTests
124124
*/
125-
public function testToString($r, $expected)
125+
public function testToString(FileSource $r, string $expected): void
126126
{
127127
$this->assertEquals($expected, (string) $r);
128128
}
129129

130-
public function getToStringTests()
130+
public static function getToStringTests(): array
131131
{
132132
$tests = [];
133133

Tests/Model/Message/XliffMessageTest.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
class XliffMessageTest extends MessageTest
3030
{
31-
public function testSetIsApproved()
31+
public function testSetIsApproved(): void
3232
{
3333
$message = new XliffMessage('foo');
3434
$this->assertFalse($message->isApproved());
@@ -38,7 +38,7 @@ public function testSetIsApproved()
3838
$this->assertFalse($message->isApproved());
3939
}
4040

41-
public function testHasState()
41+
public function testHasState(): void
4242
{
4343
$message = new XliffMessage('foo');
4444
$this->assertTrue($message->hasState());
@@ -50,7 +50,7 @@ public function testHasState()
5050
$this->assertTrue($message->hasState());
5151
}
5252

53-
public function testGetSetState()
53+
public function testGetSetState(): void
5454
{
5555
$message = new XliffMessage('foo');
5656
$this->assertEquals(XliffMessage::STATE_NEW, $message->getState());
@@ -62,7 +62,7 @@ public function testGetSetState()
6262
$this->assertEquals(XliffMessage::STATE_NEW, $message->getState());
6363
}
6464

65-
public function testSetIsNew()
65+
public function testSetIsNew(): void
6666
{
6767
$message = new XliffMessage('foo');
6868
$this->assertTrue($message->isNew());
@@ -78,7 +78,7 @@ public function testSetIsNew()
7878
$this->assertFalse($message->isNew());
7979
}
8080

81-
public function testisWritable()
81+
public function testisWritable(): void
8282
{
8383
$message = new XliffMessage('foo');
8484
$this->assertTrue($message->isWritable());
@@ -92,7 +92,7 @@ public function testisWritable()
9292
$this->assertTrue($message->isWritable());
9393
}
9494

95-
public function testGetNotes()
95+
public function testGetNotes(): void
9696
{
9797
$message = new XliffMessage('foo');
9898
$this->assertEquals([], $message->getNotes());
@@ -104,7 +104,7 @@ public function testGetNotes()
104104
$this->assertSame($notes, $message->getNotes());
105105
}
106106

107-
public function testMerge()
107+
public function testMerge(): void
108108
{
109109
$messageWrite = new XliffMessage('foo');
110110
$messageWrite->setDesc('foo');
@@ -160,7 +160,7 @@ public function testMerge()
160160
$this->assertEquals(XliffMessage::STATE_TRANSLATED, $message7->getState());
161161
}
162162

163-
public function testMergeExisting()
163+
public function testMergeExisting(): void
164164
{
165165
$scannedMessage = new XliffMessage('foo');
166166
$scannedMessage->setDesc('foo');
@@ -219,7 +219,7 @@ public function testMergeExisting()
219219
$this->assertEquals(XliffMessage::STATE_TRANSLATED, $scannedMessage4->getState());
220220
}
221221

222-
public function testMergeScanned()
222+
public function testMergeScanned(): void
223223
{
224224
$existingMessage = new XliffMessage('foo');
225225
$existingMessage->setLocaleString('bar');

Tests/Model/MessageCatalogueTest.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
class MessageCatalogueTest extends TestCase
2929
{
30-
public function testAdd()
30+
public function testAdd(): void
3131
{
3232
$catalogue = new MessageCatalogue();
3333
$catalogue->add($m = new Message('foo'));
@@ -36,7 +36,7 @@ public function testAdd()
3636
$this->assertEquals(['foo' => $m], $catalogue->getDomain('messages')->all());
3737
}
3838

39-
public function testGet()
39+
public function testGet(): void
4040
{
4141
$catalogue = new MessageCatalogue();
4242
$catalogue->add($message = Message::create('foo'));
@@ -45,15 +45,15 @@ public function testGet()
4545
$this->assertSame($message, $catalogue->get('foo'));
4646
}
4747

48-
public function testGetThrowsExceptionWhenMessageDoesNotExist()
48+
public function testGetThrowsExceptionWhenMessageDoesNotExist(): void
4949
{
5050
$this->expectException(\InvalidArgumentException::class);
5151

5252
$catalogue = new MessageCatalogue();
5353
$catalogue->getDomain('foo');
5454
}
5555

56-
public function testGetSetLocale()
56+
public function testGetSetLocale(): void
5757
{
5858
$catalogue = new MessageCatalogue();
5959
$this->assertNull($catalogue->getLocale());
@@ -62,7 +62,7 @@ public function testGetSetLocale()
6262
$this->assertEquals('en', $catalogue->getLocale());
6363
}
6464

65-
public function testHasDomain()
65+
public function testHasDomain(): void
6666
{
6767
$catalogue = new MessageCatalogue();
6868
$this->assertFalse($catalogue->hasDomain('messages'));
@@ -71,7 +71,7 @@ public function testHasDomain()
7171
$this->assertTrue($catalogue->hasDomain('messages'));
7272
}
7373

74-
public function testGetDomain()
74+
public function testGetDomain(): void
7575
{
7676
$catalogue = new MessageCatalogue();
7777
$catalogue->add(new Message('foo'));
@@ -81,15 +81,15 @@ public function testGetDomain()
8181
$this->assertEquals(['foo'], array_keys($col->all()));
8282
}
8383

84-
public function testGetDomainWhenDomainDoesNotExist()
84+
public function testGetDomainWhenDomainDoesNotExist(): void
8585
{
8686
$this->expectException(\InvalidArgumentException::class);
8787

8888
$catalogue = new MessageCatalogue();
8989
$catalogue->getDomain('messages');
9090
}
9191

92-
public function testGetDomains()
92+
public function testGetDomains(): void
9393
{
9494
$cat = new MessageCatalogue();
9595
$cat->add(new Message('foo'));
@@ -99,7 +99,7 @@ public function testGetDomains()
9999
$this->assertInstanceOf(MessageCollection::class, $domains['foo']);
100100
}
101101

102-
public function testMerge()
102+
public function testMerge(): void
103103
{
104104
$cat = new MessageCatalogue();
105105
$cat->add(new Message('foo', 'foo'));

0 commit comments

Comments
 (0)