1
0
mirror of https://github.com/danog/class-finder.git synced 2024-11-30 04:29:03 +01:00

Fix tests a bit

This commit is contained in:
Daniil Gentili 2020-10-11 17:47:28 +02:00
parent d1f7671588
commit ff233b606d
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
3 changed files with 5 additions and 4 deletions

View File

@ -28,7 +28,7 @@ class FilesEntry
*/
public function knowsNamespace($namespace)
{
$classes = $this->getClassesInFile();
$classes = $this->getClassesInFile(ClassFinder::ALLOW_CLASSES | ClassFinder::ALLOW_INTERFACES | ClassFinder::ALLOW_TRAITS);
foreach($classes as $class) {
if (strpos($class, $namespace) !== false) {
@ -83,7 +83,7 @@ class FilesEntry
*
* @return array
*/
private function getClassesInFile($options = ClassFinder::ALLOW_INTERFACES | ClassFinder::ALLOW_TRAITS)
private function getClassesInFile($options)
{
// get_declared_*() returns a bunch of classes|interfaces|traits that are built into PHP. So we need a control here.
list($initialInterfaces,

View File

@ -166,7 +166,7 @@ class PSR4Namespace
* @param int $options
* @return string[]
*/
public function findClasses($namespace, $options = ClassFinder::STANDARD_MODE)
public function findClasses($namespace, $options)
{
$allowAdditional = $options & ~ClassFinder::MODE_MASK;
$options &= ClassFinder::MODE_MASK;

View File

@ -2,6 +2,7 @@
namespace HaydenPierce\ClassFinder\UnitTest\Files;
use HaydenPierce\ClassFinder\ClassFinder;
use HaydenPierce\ClassFinder\Files\FilesEntry;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;
@ -46,7 +47,7 @@ EOL
$files = new FilesEntry($tmpFilename, $this->findPHP());
$classes = $files->getClasses($namespace, 0);
$classes = $files->getClasses($namespace, ClassFinder::ALLOW_CLASSES);
$this->assertEquals($expected, $classes, 'FilesEntry should be able to determine the classes defined in a given file.');
}