1
0
mirror of synced 2024-12-13 14:56:01 +03:00
doctrine2/tests/Doctrine/Tests/Common/ClassLoaderTest.php
2009-06-15 18:25:47 +00:00

31 lines
1.0 KiB
PHP

<?php
namespace Doctrine\Tests\Common;
use Doctrine\Common\ClassLoader;
require_once __DIR__ . '/../TestInit.php';
class ClassLoaderTest extends \Doctrine\Tests\DoctrineTestCase
{
public function testCustomFileExtensionAndNamespaceSeparator()
{
$classLoader = new \Doctrine\Common\ClassLoader();
$classLoader->setBasePath('ClassLoaderTest', __DIR__);
$classLoader->setClassFileExtension('.class.php');
$classLoader->setNamespaceSeparator('_');
$this->assertEquals($classLoader->loadClass('ClassLoaderTest_ClassA'), true);
$this->assertEquals($classLoader->loadClass('ClassLoaderTest_ClassB'), true);
}
public function testClassLoaderCheckFileExists()
{
$classLoader = new \Doctrine\Common\ClassLoader();
$classLoader->setBasePath('ClassLoaderTest', __DIR__);
$classLoader->setCheckFileExists(true);
// This would return a fatal error without check file exists true
$this->assertEquals($classLoader->loadClass('SomeInvalidClass'), false);
}
}