Skip to content

Commit ed783e1

Browse files
committed
test: refactor
1 parent 8281b11 commit ed783e1

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

tests/system/AutoReview/ComposerJsonTest.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ protected function setUp(): void
4040

4141
public function testFrameworkRequireIsTheSameWithDevRequire(): void
4242
{
43-
$this->assertSame(
44-
$this->devComposer['require'],
45-
$this->frameworkComposer['require'],
46-
'The framework\'s "require" section is not updated with the main composer.json.'
47-
);
43+
$this->checkFramework('require');
4844
}
4945

5046
public function testFrameworkRequireDevIsTheSameWithDevRequireDev(): void
@@ -72,11 +68,7 @@ public function testFrameworkRequireDevIsTheSameWithDevRequireDev(): void
7268

7369
public function testFrameworkSuggestIsTheSameWithDevSuggest(): void
7470
{
75-
$this->assertSame(
76-
$this->devComposer['suggest'],
77-
$this->frameworkComposer['suggest'],
78-
'The framework\'s "suggest" section is not updated with the main composer.json.'
79-
);
71+
$this->checkFramework('suggest');
8072
}
8173

8274
public function testStarterSuggestIsTheSameWithDevSuggest(): void
@@ -86,18 +78,23 @@ public function testStarterSuggestIsTheSameWithDevSuggest(): void
8678

8779
public function testFrameworkConfigIsTheSameWithDevSuggest(): void
8880
{
89-
$this->assertSame(
90-
$this->devComposer['config'],
91-
$this->frameworkComposer['config'],
92-
'The framework\'s "config" section is not updated with the main composer.json.'
93-
);
81+
$this->checkFramework('config');
9482
}
9583

9684
public function testStarterConfigIsTheSameWithDevSuggest(): void
9785
{
9886
$this->checkStarter('config');
9987
}
10088

89+
private function checkFramework(string $section): void
90+
{
91+
$this->assertSame(
92+
$this->devComposer[$section],
93+
$this->frameworkComposer[$section],
94+
'The framework\'s "' . $section . '" section is not updated with the main composer.json.'
95+
);
96+
}
97+
10198
private function checkStarter(string $section): void
10299
{
103100
$this->assertSame(

0 commit comments

Comments
 (0)