1
0
mirror of https://github.com/danog/class-finder.git synced 2025-01-08 14:08:31 +01:00
class-finder/test/app1/src/FilesTest.php

47 lines
1.3 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 {
$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.'
)
);
}
}