1
0
mirror of https://github.com/danog/class-finder.git synced 2025-01-07 13:40:46 +01:00
class-finder/test/app1/src/FilesTest.php

56 lines
1.7 KiB
PHP
Raw Normal View History

2018-09-29 20:27:19 +02:00
<?php
namespace TestApp1;
require_once __DIR__ . '/../vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder;
class FilesTest extends \PHPUnit_Framework_TestCase
{
public function setup()
{
// Reset ClassFinder back to normal.
ClassFinder::setAppRoot(null);
}
/**
* @dataProvider classFinderDataProvider
*/
public function testClassFinder($namespace, $expected, $message)
{
try {
ClassFinder::enableFilesSupport();
2018-09-29 20:27:19 +02:00
$classes = ClassFinder::getClassesInNamespace($namespace);
} catch (\Exception $e) {
$this->assertFalse(true, 'An exception occurred: ' . $e->getMessage());
$classes = array();
}
$this->assertEquals($expected, $classes, $message);
}
public function classFinderDataProvider()
{
return array(
array(
'TestApp1\FilesClasses',
array(
'TestApp1\FilesClasses\Bam',
'TestApp1\FilesClasses\Wam',
'TestApp1\FilesClasses\Fam',
'TestApp1\FilesClasses\Cam',
'TestApp1\FilesClasses\Lam',
),
'ClassFinder should be able to find 1st party classes included from `files` listed in composer.json.'
2018-10-21 16:14:41 +02:00
),
array(
'TestApp1\FilesClasses\MoreClasses',
array(
'TestApp1\FilesClasses\MoreClasses\Pham',
'TestApp1\FilesClasses\MoreClasses\Slam'
),
'ClassFinder should be able to find 1st party classes included from `files` listed in composer.json.'
2018-09-29 20:27:19 +02:00
)
);
}
}