-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
72 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\Component\Resource\Tests\Dummy; | ||
|
||
final class DummyClassOne | ||
{ | ||
} |
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,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\Component\Resource\Tests\Dummy; | ||
|
||
final class DummyClassTwo | ||
{ | ||
} |
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,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\Component\Resource\Tests\Dummy; | ||
|
||
trait TraitPass | ||
{ | ||
} |
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,42 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Reflection; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Sylius\Component\Resource\Reflection\ClassReflection; | ||
use Sylius\Component\Resource\Tests\Dummy\DummyClassOne; | ||
use Sylius\Component\Resource\Tests\Dummy\DummyClassTwo; | ||
use Sylius\Component\Resource\Tests\Dummy\TraitPass; | ||
|
||
final class ClassReflectionTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function it_returns_resource_classes_from_a_directory(): void | ||
{ | ||
$resources = ClassReflection::getResourcesByPath(dirname(__FILE__).'/../Dummy'); | ||
|
||
$this->assertSame($resources, [ | ||
DummyClassOne::class, | ||
DummyClassTwo::class, | ||
]); | ||
} | ||
|
||
/** @test */ | ||
public function it_excludes_traits(): void | ||
{ | ||
$resources = ClassReflection::getResourcesByPath(dirname(__FILE__).'/../Dummy'); | ||
|
||
$this->assertNotContains(TraitPass::class, $resources); | ||
} | ||
} |