-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from DaveLiddament/feature/allow-test-tag-on-c…
…lass UPDATE allow TestTag on class
- Loading branch information
Showing
25 changed files
with
433 additions
and
129 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
tests/Rules/TestTagClassOnConstructorIngoredOnTestClassTest.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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DaveLiddament\PhpstanPhpLanguageExtensions\Tests\Rules; | ||
|
||
use DaveLiddament\PhpstanPhpLanguageExtensions\Config\TestConfig; | ||
use DaveLiddament\PhpstanPhpLanguageExtensions\Rules\TestTagNewCallRule; | ||
use DaveLiddament\PhpstanRuleTestHelper\AbstractRuleTestCase; | ||
use DaveLiddament\PhpstanRuleTestHelper\ErrorMessageFormatter; | ||
use PHPStan\Rules\Rule; | ||
|
||
/** @extends AbstractRuleTestCase<TestTagNewCallRule> */ | ||
class TestTagClassOnConstructorIngoredOnTestClassTest extends AbstractRuleTestCase | ||
{ | ||
protected function getRule(): Rule | ||
{ | ||
return new TestTagNewCallRule( | ||
$this->createReflectionProvider(), | ||
new TestConfig(TestConfig::CLASS_NAME), | ||
); | ||
} | ||
|
||
public function testMethodCall(): void | ||
{ | ||
$this->assertIssuesReported(__DIR__.'/data/testTag/testTagClassOnConstructorIgnoredInTestClass.php'); | ||
} | ||
|
||
protected function getErrorFormatter(): ErrorMessageFormatter|string | ||
{ | ||
return 'TestTagClassOnConstructorIgnoredOnTestClass\Person::__construct is a test tag and can only be called from test code'; | ||
} | ||
} |
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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DaveLiddament\PhpstanPhpLanguageExtensions\Tests\Rules; | ||
|
||
use DaveLiddament\PhpstanPhpLanguageExtensions\Config\TestConfig; | ||
use DaveLiddament\PhpstanPhpLanguageExtensions\Rules\TestTagNewCallRule; | ||
use DaveLiddament\PhpstanRuleTestHelper\AbstractRuleTestCase; | ||
use DaveLiddament\PhpstanRuleTestHelper\ErrorMessageFormatter; | ||
use PHPStan\Rules\Rule; | ||
|
||
/** @extends AbstractRuleTestCase<TestTagNewCallRule> */ | ||
class TestTagClassOnConstructorTest extends AbstractRuleTestCase | ||
{ | ||
protected function getRule(): Rule | ||
{ | ||
return new TestTagNewCallRule( | ||
$this->createReflectionProvider(), | ||
new TestConfig(TestConfig::CLASS_NAME), | ||
); | ||
} | ||
|
||
public function testMethodCall(): void | ||
{ | ||
$this->assertIssuesReported(__DIR__.'/data/testTag/testTagClassOnConstructor.php'); | ||
} | ||
|
||
protected function getErrorFormatter(): ErrorMessageFormatter|string | ||
{ | ||
return 'TestTagClassOnConstructor\Person::__construct is a test tag and can only be called from test code'; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
tests/Rules/TestTagClassOnMethodIgnoredOnTestClassTest.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,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DaveLiddament\PhpstanPhpLanguageExtensions\Tests\Rules; | ||
|
||
use DaveLiddament\PhpstanPhpLanguageExtensions\Config\TestConfig; | ||
use DaveLiddament\PhpstanPhpLanguageExtensions\Rules\TestTagMethodCallRule; | ||
use DaveLiddament\PhpstanRuleTestHelper\AbstractRuleTestCase; | ||
use PHPStan\Rules\Rule; | ||
|
||
/** @extends AbstractRuleTestCase<TestTagMethodCallRule> */ | ||
class TestTagClassOnMethodIgnoredOnTestClassTest extends AbstractRuleTestCase | ||
{ | ||
protected function getRule(): Rule | ||
{ | ||
return new TestTagMethodCallRule( | ||
$this->createReflectionProvider(), | ||
new TestConfig(TestConfig::CLASS_NAME), | ||
); | ||
} | ||
|
||
public function testMethodCall(): void | ||
{ | ||
$this->assertIssuesReported( | ||
__DIR__.'/data/testTag/testTagClassOnMethodIgnoredInTestClass.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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DaveLiddament\PhpstanPhpLanguageExtensions\Tests\Rules; | ||
|
||
use DaveLiddament\PhpstanPhpLanguageExtensions\Config\TestConfig; | ||
use DaveLiddament\PhpstanPhpLanguageExtensions\Rules\TestTagMethodCallRule; | ||
use DaveLiddament\PhpstanRuleTestHelper\AbstractRuleTestCase; | ||
use DaveLiddament\PhpstanRuleTestHelper\ErrorMessageFormatter; | ||
use PHPStan\Rules\Rule; | ||
|
||
/** @extends AbstractRuleTestCase<TestTagMethodCallRule> */ | ||
class TestTagClassOnMethodTest extends AbstractRuleTestCase | ||
{ | ||
protected function getRule(): Rule | ||
{ | ||
return new TestTagMethodCallRule( | ||
$this->createReflectionProvider(), | ||
new TestConfig(TestConfig::CLASS_NAME), | ||
); | ||
} | ||
|
||
public function testMethodCall(): void | ||
{ | ||
$this->assertIssuesReported(__DIR__.'/data/testTag/testTagClassOnMethod.php'); | ||
} | ||
|
||
protected function getErrorFormatter(): ErrorMessageFormatter|string | ||
{ | ||
return 'TestTagClassOnMethod\Person::updateName is a test tag and can only be called from test code'; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
tests/Rules/TestTagClassOnStaticIgnoredOnTestClassTest.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,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DaveLiddament\PhpstanPhpLanguageExtensions\Tests\Rules; | ||
|
||
use DaveLiddament\PhpstanPhpLanguageExtensions\Config\TestConfig; | ||
use DaveLiddament\PhpstanPhpLanguageExtensions\Rules\TestTagStaticCallRule; | ||
use DaveLiddament\PhpstanRuleTestHelper\AbstractRuleTestCase; | ||
use PHPStan\Rules\Rule; | ||
|
||
/** @extends AbstractRuleTestCase<TestTagStaticCallRule> */ | ||
class TestTagClassOnStaticIgnoredOnTestClassTest extends AbstractRuleTestCase | ||
{ | ||
protected function getRule(): Rule | ||
{ | ||
return new TestTagStaticCallRule( | ||
$this->createReflectionProvider(), | ||
new TestConfig(TestConfig::CLASS_NAME), | ||
); | ||
} | ||
|
||
public function testMethodCall(): void | ||
{ | ||
$this->assertIssuesReported(__DIR__.'/data/testTag/testTagClassOnStaticMethodIgnoredInTestClass.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,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DaveLiddament\PhpstanPhpLanguageExtensions\Tests\Rules; | ||
|
||
use DaveLiddament\PhpstanPhpLanguageExtensions\Config\TestConfig; | ||
use DaveLiddament\PhpstanPhpLanguageExtensions\Rules\TestTagStaticCallRule; | ||
use DaveLiddament\PhpstanRuleTestHelper\AbstractRuleTestCase; | ||
use PHPStan\Rules\Rule; | ||
|
||
/** @extends AbstractRuleTestCase<TestTagStaticCallRule> */ | ||
final class TestTagClassOnStaticTest extends AbstractRuleTestCase | ||
{ | ||
protected function getRule(): Rule | ||
{ | ||
return new TestTagStaticCallRule( | ||
$this->createReflectionProvider(), | ||
new TestConfig(TestConfig::CLASS_NAME), | ||
); | ||
} | ||
|
||
public function testMethodCall(): void | ||
{ | ||
$this->assertIssuesReported(__DIR__.'/data/testTag/testTagClassOnStaticMethod.php'); | ||
} | ||
|
||
protected function getErrorFormatter(): string | ||
{ | ||
return 'TestTagClassOnStaticMethod\Person::updateName is a test tag and can only be called from test code'; | ||
} | ||
} |
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
Oops, something went wrong.