forked from moodlehq/moodle-cs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make static fixes configurable (WIP)
- Loading branch information
1 parent
b86c003
commit c89163a
Showing
8 changed files
with
147 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
moodle/Tests/fixtures/phpunit/provider/static_providers_fix_test.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// phpcs:set moodle.PHPUnit.TestCaseProvider autofixStaticProviders true | ||
<?php | ||
defined('MOODLE_INTERNAL') || die(); // Make this always the 1st line in all CS fixtures. | ||
|
||
// A class with 3 methods, using all the covers options correctly. | ||
|
||
/** | ||
* @coversDefaultClass \some\namespace\one | ||
* @covers ::all() | ||
*/ | ||
class static_providers_test extends base_test { | ||
/** | ||
* @dataProvider fixable_provider | ||
*/ | ||
public function test_fixable(): void { | ||
// Nothing to test. | ||
} | ||
|
||
public function fixable_provider(): array { | ||
return []; | ||
} | ||
|
||
/** | ||
* @dataProvider unfixable_provider | ||
*/ | ||
public function test_unfixable_provider(): void { | ||
// Nothing to test. | ||
} | ||
|
||
public function unfixable_provider(): array { | ||
return $this->provider(); | ||
} | ||
|
||
/** | ||
* @dataProvider partially_fixable_provider | ||
*/ | ||
public function test_partially_fixable(): void { | ||
// Nothing to test. | ||
} | ||
|
||
public function partially_fixable_provider(): array { | ||
$this->call_something(); | ||
return $this->fixable_provider(); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
moodle/Tests/fixtures/phpunit/provider/static_providers_fix_test.php.fixed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// phpcs:set moodle.PHPUnit.TestCaseProvider autofixStaticProviders true | ||
<?php | ||
defined('MOODLE_INTERNAL') || die(); // Make this always the 1st line in all CS fixtures. | ||
|
||
// A class with 3 methods, using all the covers options correctly. | ||
|
||
/** | ||
* @coversDefaultClass \some\namespace\one | ||
* @covers ::all() | ||
*/ | ||
class static_providers_test extends base_test { | ||
/** | ||
* @dataProvider fixable_provider | ||
*/ | ||
public function test_fixable(): void { | ||
// Nothing to test. | ||
} | ||
|
||
public static function fixable_provider(): array { | ||
return []; | ||
} | ||
|
||
/** | ||
* @dataProvider unfixable_provider | ||
*/ | ||
public function test_unfixable_provider(): void { | ||
// Nothing to test. | ||
} | ||
|
||
public function unfixable_provider(): array { | ||
return $this->provider(); | ||
} | ||
|
||
/** | ||
* @dataProvider partially_fixable_provider | ||
*/ | ||
public function test_partially_fixable(): void { | ||
// Nothing to test. | ||
} | ||
|
||
public function partially_fixable_provider(): array { | ||
$this->call_something(); | ||
return self::fixable_provider(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters