Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit434e3d2

Browse files
committed
Use TestTrait::assertCommandIsSuccessful() instead of TestTrait::getStatusCode() when possible
1 parentb74d1dd commit434e3d2

File tree

15 files changed

+32
-32
lines changed

15 files changed

+32
-32
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testLintFilesFromBundleDirectory()
5151
['verbosity' => OutputInterface::VERBOSITY_VERBOSE,'decorated' =>false]
5252
);
5353

54-
$this->assertEquals(0,$tester->getStatusCode(),'Returns 0 in case of success');
54+
$tester->assertCommandIsSuccessful('Returns 0 in case of success');
5555
$this->assertStringContainsString('[OK] All 0 XLIFF files contain valid syntax',trim($tester->getDisplay()));
5656
}
5757

‎src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function testLintCorrectFile()
4040
['verbosity' => OutputInterface::VERBOSITY_VERBOSE,'decorated' =>false]
4141
);
4242

43-
$this->assertEquals(0,$tester->getStatusCode(),'Returns 0 in case of success');
43+
$tester->assertCommandIsSuccessful('Returns 0 in case of success');
4444
$this->assertStringContainsString('OK',trim($tester->getDisplay()));
4545
}
4646

@@ -88,7 +88,7 @@ public function testLintFilesFromBundleDirectory()
8888
['verbosity' => OutputInterface::VERBOSITY_VERBOSE,'decorated' =>false]
8989
);
9090

91-
$this->assertEquals(0,$tester->getStatusCode(),'Returns 0 in case of success');
91+
$tester->assertCommandIsSuccessful('Returns 0 in case of success');
9292
$this->assertStringContainsString('[OK] All 0 YAML files contain valid syntax',trim($tester->getDisplay()));
9393
}
9494

‎src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function testRunOnlyWarnsOnUnregistrableCommand()
147147
$tester->run(['command' =>'fine']);
148148
$output =$tester->getDisplay();
149149

150-
$this->assertSame(0,$tester->getStatusCode());
150+
$tester->assertCommandIsSuccessful();
151151
$this->assertStringContainsString('Some commands could not be registered:',$output);
152152
$this->assertStringContainsString('throwing',$output);
153153
$this->assertStringContainsString('fine',$output);
@@ -204,7 +204,7 @@ public function testRunOnlyWarnsOnUnregistrableCommandAtTheEnd()
204204
$tester =newApplicationTester($application);
205205
$tester->run(['command' =>'list']);
206206

207-
$this->assertSame(0,$tester->getStatusCode());
207+
$tester->assertCommandIsSuccessful();
208208
$display =explode('List commands',$tester->getDisplay());
209209

210210
$this->assertStringContainsString(trim('[WARNING] Some commands could not be registered:'),trim($display[1]));

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function testClearPrivatePool()
3333
$tester =$this->createCommandTester();
3434
$tester->execute(['pools' => ['cache.private_pool']], ['decorated' =>false]);
3535

36-
$this->assertSame(0,$tester->getStatusCode(),'cache:pool:clear exits with 0 in case of success');
36+
$tester->assertCommandIsSuccessful('cache:pool:clear exits with 0 in case of success');
3737
$this->assertStringContainsString('Clearing cache pool: cache.private_pool',$tester->getDisplay());
3838
$this->assertStringContainsString('[OK] Cache was successfully cleared.',$tester->getDisplay());
3939
}
@@ -43,7 +43,7 @@ public function testClearPublicPool()
4343
$tester =$this->createCommandTester();
4444
$tester->execute(['pools' => ['cache.public_pool']], ['decorated' =>false]);
4545

46-
$this->assertSame(0,$tester->getStatusCode(),'cache:pool:clear exits with 0 in case of success');
46+
$tester->assertCommandIsSuccessful('cache:pool:clear exits with 0 in case of success');
4747
$this->assertStringContainsString('Clearing cache pool: cache.public_pool',$tester->getDisplay());
4848
$this->assertStringContainsString('[OK] Cache was successfully cleared.',$tester->getDisplay());
4949
}
@@ -53,7 +53,7 @@ public function testClearPoolWithCustomClearer()
5353
$tester =$this->createCommandTester();
5454
$tester->execute(['pools' => ['cache.pool_with_clearer']], ['decorated' =>false]);
5555

56-
$this->assertSame(0,$tester->getStatusCode(),'cache:pool:clear exits with 0 in case of success');
56+
$tester->assertCommandIsSuccessful('cache:pool:clear exits with 0 in case of success');
5757
$this->assertStringContainsString('Clearing cache pool: cache.pool_with_clearer',$tester->getDisplay());
5858
$this->assertStringContainsString('[OK] Cache was successfully cleared.',$tester->getDisplay());
5959
}
@@ -63,7 +63,7 @@ public function testCallClearer()
6363
$tester =$this->createCommandTester();
6464
$tester->execute(['pools' => ['cache.app_clearer']], ['decorated' =>false]);
6565

66-
$this->assertSame(0,$tester->getStatusCode(),'cache:pool:clear exits with 0 in case of success');
66+
$tester->assertCommandIsSuccessful('cache:pool:clear exits with 0 in case of success');
6767
$this->assertStringContainsString('Calling cache clearer: cache.app_clearer',$tester->getDisplay());
6868
$this->assertStringContainsString('[OK] Cache was successfully cleared.',$tester->getDisplay());
6969
}

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolListCommandTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function testListPools()
3030
$tester =$this->createCommandTester(['cache.app','cache.system']);
3131
$tester->execute([]);
3232

33-
$this->assertSame(0,$tester->getStatusCode(),'cache:pool:list exits with 0 in case of success');
33+
$tester->assertCommandIsSuccessful('cache:pool:list exits with 0 in case of success');
3434
$this->assertStringContainsString('cache.app',$tester->getDisplay());
3535
$this->assertStringContainsString('cache.system',$tester->getDisplay());
3636
}
@@ -40,7 +40,7 @@ public function testEmptyList()
4040
$tester =$this->createCommandTester([]);
4141
$tester->execute([]);
4242

43-
$this->assertSame(0,$tester->getStatusCode(),'cache:pool:list exits with 0 in case of success');
43+
$tester->assertCommandIsSuccessful('cache:pool:list exits with 0 in case of success');
4444
}
4545

4646
privatefunctioncreateCommandTester(array$poolNames)

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function testGetDeprecation()
161161
$tester =newApplicationTester($application);
162162
$tester->run(['command' =>'debug:container','--deprecations' =>true]);
163163

164-
$this->assertSame(0,$tester->getStatusCode());
164+
$tester->assertCommandIsSuccessful();
165165
$this->assertStringContainsString('Symfony\Bundle\FrameworkBundle\Controller\Controller',$tester->getDisplay());
166166
$this->assertStringContainsString('/home/hamza/projet/contrib/sf/vendor/symfony/framework-bundle/Controller/Controller.php',$tester->getDisplay());
167167
}
@@ -181,7 +181,7 @@ public function testGetDeprecationNone()
181181
$tester =newApplicationTester($application);
182182
$tester->run(['command' =>'debug:container','--deprecations' =>true]);
183183

184-
$this->assertSame(0,$tester->getStatusCode());
184+
$tester->assertCommandIsSuccessful();
185185
$this->assertStringContainsString('[OK] There are no deprecations in the logs!',$tester->getDisplay());
186186
}
187187

@@ -199,7 +199,7 @@ public function testGetDeprecationNoFile()
199199
$tester =newApplicationTester($application);
200200
$tester->run(['command' =>'debug:container','--deprecations' =>true]);
201201

202-
$this->assertSame(0,$tester->getStatusCode());
202+
$tester->assertCommandIsSuccessful();
203203
$this->assertStringContainsString('[WARNING] The deprecation file does not exist',$tester->getDisplay());
204204
}
205205

‎src/Symfony/Bundle/FrameworkBundle/composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"doctrine/persistence":"^1.3|^2.0",
3939
"symfony/asset":"^5.3|^6.0",
4040
"symfony/browser-kit":"^5.4|^6.0",
41-
"symfony/console":"^5.2|^6.0",
41+
"symfony/console":"^5.4|^6.0",
4242
"symfony/css-selector":"^4.4|^5.0|^6.0",
4343
"symfony/dom-crawler":"^4.4|^5.0|^6.0",
4444
"symfony/dotenv":"^5.1|^6.0",

‎src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ public function testSetInputs()
8282
$tester->setInputs(['I1','I2','I3']);
8383
$tester->run(['command' =>'foo']);
8484

85-
$this->assertSame(0,$tester->getStatusCode());
85+
$tester->assertCommandIsSuccessful();
8686
$this->assertEquals('Q1Q2Q3',$tester->getDisplay(true));
8787
}
8888

8989
publicfunctiontestGetStatusCode()
9090
{
91-
$this->assertSame(0,$this->tester->getStatusCode(),'->getStatusCode() returns the status code');
91+
$this->tester->assertCommandIsSuccessful('->getStatusCode() returns the status code');
9292
}
9393

9494
publicfunctiontestErrorOutput()

‎src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function testGetDisplayWithoutCallingExecuteBefore()
7979

8080
publicfunctiontestGetStatusCode()
8181
{
82-
$this->assertSame(0,$this->tester->getStatusCode(),'->getStatusCode() returns the status code');
82+
$this->tester->assertCommandIsSuccessful('->getStatusCode() returns the status code');
8383
}
8484

8585
publicfunctiontestGetStatusCodeWithoutCallingExecuteBefore()
@@ -129,7 +129,7 @@ public function testCommandWithInputs()
129129
$tester->setInputs(['Bobby','Fine','France']);
130130
$tester->execute([]);
131131

132-
$this->assertEquals(0,$tester->getStatusCode());
132+
$tester->assertCommandIsSuccessful();
133133
$this->assertEquals(implode('',$questions),$tester->getDisplay(true));
134134
}
135135

@@ -154,7 +154,7 @@ public function testCommandWithDefaultInputs()
154154
$tester->setInputs(['','','']);
155155
$tester->execute([]);
156156

157-
$this->assertEquals(0,$tester->getStatusCode());
157+
$tester->assertCommandIsSuccessful();
158158
$this->assertEquals(implode('',$questions),$tester->getDisplay(true));
159159
}
160160

@@ -227,7 +227,7 @@ public function testSymfonyStyleCommandWithInputs()
227227
$tester->setInputs(['Bobby','Fine','France']);
228228
$tester->execute([]);
229229

230-
$this->assertEquals(0,$tester->getStatusCode());
230+
$tester->assertCommandIsSuccessful();
231231
}
232232

233233
publicfunctiontestErrorOutput()

‎src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testDebugDateTimeType()
7171
$tester =$this->createCommandTester();
7272
$tester->execute(['class' =>'DateTime'], ['decorated' =>false,'interactive' =>false]);
7373

74-
$this->assertEquals(0,$tester->getStatusCode(),'Returns 0 in case of success');
74+
$tester->assertCommandIsSuccessful('Returns 0 in case of success');
7575
$this->assertStringContainsString('Symfony\Component\Form\Extension\Core\Type\DateTimeType (Block prefix: "datetime")',$tester->getDisplay());
7676
}
7777

@@ -123,7 +123,7 @@ public function testDebugAmbiguousFormTypeInteractive()
123123
$tester->setInputs([0]);
124124
$tester->execute(['class' =>'AmbiguousType'], ['decorated' =>false,'interactive' =>true]);
125125

126-
$this->assertEquals(0,$tester->getStatusCode(),'Returns 0 in case of success');
126+
$tester->assertCommandIsSuccessful('Returns 0 in case of success');
127127
$output =$tester->getDisplay(true);
128128
$this->assertStringMatchesFormat(<<<TXT
129129

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp