Skip to content

Commit 8ae1b60

Browse files
alexandre-dauboisnicolas-grekas
authored andcommitted
[Tests] Migrate data providers to static ones
1 parent fd78f92 commit 8ae1b60

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

Tests/Descriptor/AbstractDescriptorTest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,40 +51,40 @@ public function testDescribeApplication(Application $application, $expectedDescr
5151
$this->assertDescription($expectedDescription, $application);
5252
}
5353

54-
public function getDescribeInputArgumentTestData()
54+
public static function getDescribeInputArgumentTestData()
5555
{
56-
return $this->getDescriptionTestData(ObjectsProvider::getInputArguments());
56+
return static::getDescriptionTestData(ObjectsProvider::getInputArguments());
5757
}
5858

59-
public function getDescribeInputOptionTestData()
59+
public static function getDescribeInputOptionTestData()
6060
{
61-
return $this->getDescriptionTestData(ObjectsProvider::getInputOptions());
61+
return static::getDescriptionTestData(ObjectsProvider::getInputOptions());
6262
}
6363

64-
public function getDescribeInputDefinitionTestData()
64+
public static function getDescribeInputDefinitionTestData()
6565
{
66-
return $this->getDescriptionTestData(ObjectsProvider::getInputDefinitions());
66+
return static::getDescriptionTestData(ObjectsProvider::getInputDefinitions());
6767
}
6868

69-
public function getDescribeCommandTestData()
69+
public static function getDescribeCommandTestData()
7070
{
71-
return $this->getDescriptionTestData(ObjectsProvider::getCommands());
71+
return static::getDescriptionTestData(ObjectsProvider::getCommands());
7272
}
7373

74-
public function getDescribeApplicationTestData()
74+
public static function getDescribeApplicationTestData()
7575
{
76-
return $this->getDescriptionTestData(ObjectsProvider::getApplications());
76+
return static::getDescriptionTestData(ObjectsProvider::getApplications());
7777
}
7878

7979
abstract protected function getDescriptor();
8080

81-
abstract protected function getFormat();
81+
abstract protected static function getFormat();
8282

83-
protected function getDescriptionTestData(array $objects)
83+
protected static function getDescriptionTestData(array $objects)
8484
{
8585
$data = [];
8686
foreach ($objects as $name => $object) {
87-
$description = file_get_contents(sprintf('%s/../Fixtures/%s.%s', __DIR__, $name, $this->getFormat()));
87+
$description = file_get_contents(sprintf('%s/../Fixtures/%s.%s', __DIR__, $name, static::getFormat()));
8888
$data[] = [$object, $description];
8989
}
9090

Tests/Descriptor/JsonDescriptorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protected function getDescriptor()
2020
return new JsonDescriptor();
2121
}
2222

23-
protected function getFormat()
23+
protected static function getFormat()
2424
{
2525
return 'json';
2626
}

Tests/Descriptor/MarkdownDescriptorTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717

1818
class MarkdownDescriptorTest extends AbstractDescriptorTest
1919
{
20-
public function getDescribeCommandTestData()
20+
public static function getDescribeCommandTestData()
2121
{
22-
return $this->getDescriptionTestData(array_merge(
22+
return self::getDescriptionTestData(array_merge(
2323
ObjectsProvider::getCommands(),
2424
['command_mbstring' => new DescriptorCommandMbString()]
2525
));
2626
}
2727

28-
public function getDescribeApplicationTestData()
28+
public static function getDescribeApplicationTestData()
2929
{
30-
return $this->getDescriptionTestData(array_merge(
30+
return self::getDescriptionTestData(array_merge(
3131
ObjectsProvider::getApplications(),
3232
['application_mbstring' => new DescriptorApplicationMbString()]
3333
));
@@ -38,7 +38,7 @@ protected function getDescriptor()
3838
return new MarkdownDescriptor();
3939
}
4040

41-
protected function getFormat()
41+
protected static function getFormat()
4242
{
4343
return 'md';
4444
}

Tests/Descriptor/TextDescriptorTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818

1919
class TextDescriptorTest extends AbstractDescriptorTest
2020
{
21-
public function getDescribeCommandTestData()
21+
public static function getDescribeCommandTestData()
2222
{
23-
return $this->getDescriptionTestData(array_merge(
23+
return self::getDescriptionTestData(array_merge(
2424
ObjectsProvider::getCommands(),
2525
['command_mbstring' => new DescriptorCommandMbString()]
2626
));
2727
}
2828

29-
public function getDescribeApplicationTestData()
29+
public static function getDescribeApplicationTestData()
3030
{
31-
return $this->getDescriptionTestData(array_merge(
31+
return self::getDescriptionTestData(array_merge(
3232
ObjectsProvider::getApplications(),
3333
['application_mbstring' => new DescriptorApplicationMbString()]
3434
));
@@ -46,7 +46,7 @@ protected function getDescriptor()
4646
return new TextDescriptor();
4747
}
4848

49-
protected function getFormat()
49+
protected static function getFormat()
5050
{
5151
return 'txt';
5252
}

Tests/Descriptor/XmlDescriptorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protected function getDescriptor()
2020
return new XmlDescriptor();
2121
}
2222

23-
protected function getFormat()
23+
protected static function getFormat()
2424
{
2525
return 'xml';
2626
}

0 commit comments

Comments
 (0)