lithium\tests\cases\core\LibrariesTest::testFindingClasses PHP Method

testFindingClasses() public method

Tests recursive and non-recursive searching through libraries with paths.
public testFindingClasses ( )
    public function testFindingClasses()
    {
        $result = Libraries::find('lithium', array('recursive' => true, 'path' => '/tests/cases', 'filter' => '/LibrariesTest/'));
        $this->assertIdentical(array(__CLASS__), $result);
        $result = Libraries::find('lithium', array('path' => '/tests/cases/', 'filter' => '/LibrariesTest/'));
        $this->assertIdentical(array(), $result);
        $result = Libraries::find('lithium', array('path' => '/tests/cases/core', 'filter' => '/LibrariesTest/'));
        $this->assertIdentical(array(__CLASS__), $result);
        $testApp = Libraries::get(true, 'resources') . '/tmp/tests/test_app';
        mkdir($testApp . '/tests/cases/models', 0777, true);
        Libraries::add('test_app', array('path' => $testApp));
        $body = <<<EOD
<?php
namespace test_app\\tests\\cases\\models;
class UserTest extends \\lithium\\test\\Unit {
\tpublic function testMe() {
\t\t\$this->assertTrue(true);
\t}
}
?>
EOD;
        $filepath = $testApp . '/tests/cases/models/UserTest.php';
        file_put_contents($filepath, $body);
        $count = Libraries::find('lithium', array('recursive' => true));
        $count2 = Libraries::find(true, array('recursive' => true));
        $this->assertTrue($count < $count2);
        $result = Libraries::find('foo', array('recursive' => true));
        $this->assertNull($result);
    }