1515use Symfony \Bundle \FrameworkBundle \Command \TranslationDebugCommand ;
1616use Symfony \Bundle \FrameworkBundle \Console \Application ;
1717use Symfony \Bundle \FrameworkBundle \Tests \Functional \Bundle \ExtensionWithoutConfigTestBundle \ExtensionWithoutConfigTestBundle ;
18+ use Symfony \Component \Console \Command \Command ;
1819use Symfony \Component \Console \Tester \CommandCompletionTester ;
1920use Symfony \Component \Console \Tester \CommandTester ;
2021use Symfony \Component \DependencyInjection \Container ;
@@ -36,7 +37,7 @@ public function testDebugMissingMessages()
3637 $ res = $ tester ->execute (['locale ' => 'en ' , 'bundle ' => 'foo ' ]);
3738
3839 $ this ->assertMatchesRegularExpression ('/missing/ ' , $ tester ->getDisplay ());
39- $ this ->assertEquals (TranslationDebugCommand::EXIT_CODE_MISSING , $ res );
40+ $ this ->assertSame (TranslationDebugCommand::EXIT_CODE_MISSING , $ res );
4041 }
4142
4243 public function testDebugUnusedMessages ()
@@ -45,7 +46,7 @@ public function testDebugUnusedMessages()
4546 $ res = $ tester ->execute (['locale ' => 'en ' , 'bundle ' => 'foo ' ]);
4647
4748 $ this ->assertMatchesRegularExpression ('/unused/ ' , $ tester ->getDisplay ());
48- $ this ->assertEquals (TranslationDebugCommand::EXIT_CODE_UNUSED , $ res );
49+ $ this ->assertSame (TranslationDebugCommand::EXIT_CODE_UNUSED , $ res );
4950 }
5051
5152 public function testDebugFallbackMessages ()
@@ -54,7 +55,7 @@ public function testDebugFallbackMessages()
5455 $ res = $ tester ->execute (['locale ' => 'fr ' , 'bundle ' => 'foo ' ]);
5556
5657 $ this ->assertMatchesRegularExpression ('/fallback/ ' , $ tester ->getDisplay ());
57- $ this ->assertEquals (TranslationDebugCommand::EXIT_CODE_FALLBACK , $ res );
58+ $ this ->assertSame (TranslationDebugCommand::EXIT_CODE_FALLBACK , $ res );
5859 }
5960
6061 public function testNoDefinedMessages ()
@@ -63,7 +64,7 @@ public function testNoDefinedMessages()
6364 $ res = $ tester ->execute (['locale ' => 'fr ' , 'bundle ' => 'test ' ]);
6465
6566 $ 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 );
6768 }
6869
6970 public function testDebugDefaultDirectory ()
@@ -74,7 +75,7 @@ public function testDebugDefaultDirectory()
7475
7576 $ this ->assertMatchesRegularExpression ('/missing/ ' , $ tester ->getDisplay ());
7677 $ this ->assertMatchesRegularExpression ('/unused/ ' , $ tester ->getDisplay ());
77- $ this ->assertEquals ($ expectedExitStatus , $ res );
78+ $ this ->assertSame ($ expectedExitStatus , $ res );
7879 }
7980
8081 public function testDebugDefaultRootDirectory ()
@@ -92,7 +93,7 @@ public function testDebugDefaultRootDirectory()
9293
9394 $ this ->assertMatchesRegularExpression ('/missing/ ' , $ tester ->getDisplay ());
9495 $ this ->assertMatchesRegularExpression ('/unused/ ' , $ tester ->getDisplay ());
95- $ this ->assertEquals ($ expectedExitStatus , $ res );
96+ $ this ->assertSame ($ expectedExitStatus , $ res );
9697 }
9798
9899 public function testDebugCustomDirectory ()
@@ -112,7 +113,7 @@ public function testDebugCustomDirectory()
112113
113114 $ this ->assertMatchesRegularExpression ('/missing/ ' , $ tester ->getDisplay ());
114115 $ this ->assertMatchesRegularExpression ('/unused/ ' , $ tester ->getDisplay ());
115- $ this ->assertEquals ($ expectedExitStatus , $ res );
116+ $ this ->assertSame ($ expectedExitStatus , $ res );
116117 }
117118
118119 public function testDebugInvalidDirectory ()
@@ -128,6 +129,22 @@ public function testDebugInvalidDirectory()
128129 $ tester ->execute (['locale ' => 'en ' , 'bundle ' => 'dir ' ]);
129130 }
130131
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+
131148 protected function setUp (): void
132149 {
133150 $ this ->fs = new Filesystem ();
0 commit comments