-
-
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.
Merge pull request #206 from gacela-project/feature/allow-optional-pr…
…oject-namespace-on-class-name-finder-rules Allow optional project namespace on class name finder rules
Showing
5 changed files
with
103 additions
and
4 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
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); | ||
} | ||
} |