-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for ClassNameFinder rules
- Loading branch information
1 parent
5c3cfb5
commit 144e57e
Showing
2 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
tests/Unit/Framework/ClassResolver/ClassNameFinder/Rule/FinderRuleWithModulePrefixTest.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,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace GacelaTest\Unit\Framework\ClassResolver\ClassNameFinder\Rule; | ||
|
||
use Gacela\Framework\ClassResolver\ClassInfo; | ||
use Gacela\Framework\ClassResolver\ClassNameFinder\Rule\FinderRuleWithModulePrefix; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class FinderRuleWithModulePrefixTest extends TestCase | ||
{ | ||
private FinderRuleWithModulePrefix $rule; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->rule = new FinderRuleWithModulePrefix(); | ||
} | ||
|
||
public function test_build_without_project_namespace(): void | ||
{ | ||
$projectNamespace = ''; | ||
$resolvableType = 'Factory'; | ||
$classInfo = ClassInfo::from($this); | ||
|
||
$actual = $this->rule->buildClassCandidate($projectNamespace, $resolvableType, $classInfo); | ||
|
||
self::assertSame('\Rule\RuleFactory', $actual); | ||
} | ||
|
||
public function test_build_with_project_namespace(): void | ||
{ | ||
$projectNamespace = 'App'; | ||
$resolvableType = 'Factory'; | ||
$classInfo = ClassInfo::from($this); | ||
|
||
$actual = $this->rule->buildClassCandidate($projectNamespace, $resolvableType, $classInfo); | ||
|
||
self::assertSame('\App\Rule\RuleFactory', $actual); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...s/Unit/Framework/ClassResolver/ClassNameFinder/Rule/FinderRuleWithoutModulePrefixTest.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,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace GacelaTest\Unit\Framework\ClassResolver\ClassNameFinder\Rule; | ||
|
||
use Gacela\Framework\ClassResolver\ClassInfo; | ||
use Gacela\Framework\ClassResolver\ClassNameFinder\Rule\FinderRuleWithoutModulePrefix; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class FinderRuleWithoutModulePrefixTest extends TestCase | ||
{ | ||
private FinderRuleWithoutModulePrefix $rule; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->rule = new FinderRuleWithoutModulePrefix(); | ||
} | ||
|
||
public function test_build_without_project_namespace(): void | ||
{ | ||
$projectNamespace = ''; | ||
$resolvableType = 'Factory'; | ||
$classInfo = ClassInfo::from($this); | ||
|
||
$actual = $this->rule->buildClassCandidate($projectNamespace, $resolvableType, $classInfo); | ||
|
||
self::assertSame('\Rule\Factory', $actual); | ||
} | ||
|
||
public function test_build_with_project_namespace(): void | ||
{ | ||
$projectNamespace = 'App'; | ||
$resolvableType = 'Factory'; | ||
$classInfo = ClassInfo::from($this); | ||
|
||
$actual = $this->rule->buildClassCandidate($projectNamespace, $resolvableType, $classInfo); | ||
|
||
self::assertSame('\App\Rule\Factory', $actual); | ||
} | ||
} |