0
0
Fork 0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2025-02-21 20:56:08 +00:00
salesagility_SuiteCRM/tests/unit/phpunit/include/utils/autoloaderTest.php
2019-12-13 15:35:48 -07:00

35 lines
1.1 KiB
PHP

<?php
use SuiteCRM\Test\SuitePHPUnitFrameworkTestCase;
class SugarAutoLoaderTest extends SuitePHPUnitFrameworkTestCase
{
public function testautoload()
{
// Execute the method and test that it returns expected values
// Test with an invalid class.
$result = SugarAutoLoader::autoload('foo');
$this->assertFalse($result);
// Test with a valid class out of autoload mappings.
$result = SugarAutoLoader::autoload('SugarArray');
$this->assertFalse($result);
// Test with a valid class registered in autoload mappings.
$result = SugarAutoLoader::autoload('User');
$this->assertTrue($result);
}
public function testloadAll()
{
// Execute the method and check that it works and doesn't throw an exception.
// This method only includes file so there is no output to test.
try {
SugarAutoLoader::loadAll();
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
}
}
}