15
15
use Symfony \Bundle \FrameworkBundle \Command \TranslationDebugCommand ;
16
16
use Symfony \Bundle \FrameworkBundle \Console \Application ;
17
17
use Symfony \Bundle \FrameworkBundle \Tests \Functional \Bundle \ExtensionWithoutConfigTestBundle \ExtensionWithoutConfigTestBundle ;
18
+ use Symfony \Component \Console \Command \Command ;
18
19
use Symfony \Component \Console \Tester \CommandCompletionTester ;
19
20
use Symfony \Component \Console \Tester \CommandTester ;
20
21
use Symfony \Component \DependencyInjection \Container ;
@@ -36,7 +37,7 @@ public function testDebugMissingMessages()
36
37
$ res = $ tester ->execute (['locale ' => 'en ' , 'bundle ' => 'foo ' ]);
37
38
38
39
$ this ->assertMatchesRegularExpression ('/missing/ ' , $ tester ->getDisplay ());
39
- $ this ->assertEquals (TranslationDebugCommand::EXIT_CODE_MISSING , $ res );
40
+ $ this ->assertSame (TranslationDebugCommand::EXIT_CODE_MISSING , $ res );
40
41
}
41
42
42
43
public function testDebugUnusedMessages ()
@@ -45,7 +46,7 @@ public function testDebugUnusedMessages()
45
46
$ res = $ tester ->execute (['locale ' => 'en ' , 'bundle ' => 'foo ' ]);
46
47
47
48
$ this ->assertMatchesRegularExpression ('/unused/ ' , $ tester ->getDisplay ());
48
- $ this ->assertEquals (TranslationDebugCommand::EXIT_CODE_UNUSED , $ res );
49
+ $ this ->assertSame (TranslationDebugCommand::EXIT_CODE_UNUSED , $ res );
49
50
}
50
51
51
52
public function testDebugFallbackMessages ()
@@ -54,7 +55,7 @@ public function testDebugFallbackMessages()
54
55
$ res = $ tester ->execute (['locale ' => 'fr ' , 'bundle ' => 'foo ' ]);
55
56
56
57
$ this ->assertMatchesRegularExpression ('/fallback/ ' , $ tester ->getDisplay ());
57
- $ this ->assertEquals (TranslationDebugCommand::EXIT_CODE_FALLBACK , $ res );
58
+ $ this ->assertSame (TranslationDebugCommand::EXIT_CODE_FALLBACK , $ res );
58
59
}
59
60
60
61
public function testNoDefinedMessages ()
@@ -63,7 +64,7 @@ public function testNoDefinedMessages()
63
64
$ res = $ tester ->execute (['locale ' => 'fr ' , 'bundle ' => 'test ' ]);
64
65
65
66
$ this ->assertMatchesRegularExpression ('/No defined or extracted messages for locale "fr"/ ' , $ tester ->getDisplay ());
66
- $ this ->assertEquals (TranslationDebugCommand::EXIT_CODE_GENERAL_ERROR , $ res );
67
+ $ this ->assertSame (TranslationDebugCommand::EXIT_CODE_GENERAL_ERROR , $ res );
67
68
}
68
69
69
70
public function testDebugDefaultDirectory ()
@@ -74,7 +75,7 @@ public function testDebugDefaultDirectory()
74
75
75
76
$ this ->assertMatchesRegularExpression ('/missing/ ' , $ tester ->getDisplay ());
76
77
$ this ->assertMatchesRegularExpression ('/unused/ ' , $ tester ->getDisplay ());
77
- $ this ->assertEquals ($ expectedExitStatus , $ res );
78
+ $ this ->assertSame ($ expectedExitStatus , $ res );
78
79
}
79
80
80
81
public function testDebugDefaultRootDirectory ()
@@ -92,7 +93,7 @@ public function testDebugDefaultRootDirectory()
92
93
93
94
$ this ->assertMatchesRegularExpression ('/missing/ ' , $ tester ->getDisplay ());
94
95
$ this ->assertMatchesRegularExpression ('/unused/ ' , $ tester ->getDisplay ());
95
- $ this ->assertEquals ($ expectedExitStatus , $ res );
96
+ $ this ->assertSame ($ expectedExitStatus , $ res );
96
97
}
97
98
98
99
public function testDebugCustomDirectory ()
@@ -112,7 +113,7 @@ public function testDebugCustomDirectory()
112
113
113
114
$ this ->assertMatchesRegularExpression ('/missing/ ' , $ tester ->getDisplay ());
114
115
$ this ->assertMatchesRegularExpression ('/unused/ ' , $ tester ->getDisplay ());
115
- $ this ->assertEquals ($ expectedExitStatus , $ res );
116
+ $ this ->assertSame ($ expectedExitStatus , $ res );
116
117
}
117
118
118
119
public function testDebugInvalidDirectory ()
@@ -128,6 +129,22 @@ public function testDebugInvalidDirectory()
128
129
$ tester ->execute (['locale ' => 'en ' , 'bundle ' => 'dir ' ]);
129
130
}
130
131
132
+ public function testNoErrorWithOnlyMissingOptionAndNoResults ()
133
+ {
134
+ $ tester = $ this ->createCommandTester ([], ['foo ' => 'foo ' ]);
135
+ $ res = $ tester ->execute (['locale ' => 'en ' , '--only-missing ' => true ]);
136
+
137
+ $ this ->assertSame (Command::SUCCESS , $ res );
138
+ }
139
+
140
+ public function testNoErrorWithOnlyUnusedOptionAndNoResults ()
141
+ {
142
+ $ tester = $ this ->createCommandTester (['foo ' => 'foo ' ]);
143
+ $ res = $ tester ->execute (['locale ' => 'en ' , '--only-unused ' => true ]);
144
+
145
+ $ this ->assertSame (Command::SUCCESS , $ res );
146
+ }
147
+
131
148
protected function setUp (): void
132
149
{
133
150
$ this ->fs = new Filesystem ();
0 commit comments