Boilerplate to use a Directus Instance to Build a Custom Website, Content will be Manage by Directus
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.1 KiB

5 years ago
  1. <?php
  2. /**
  3. * Flight: An extensible micro-framework.
  4. *
  5. * @copyright Copyright (c) 2012, Mike Cao <mike@mikecao.com>
  6. * @license MIT, http://flightphp.com/license
  7. */
  8. require_once 'vendor/autoload.php';
  9. require_once __DIR__.'/../flight/autoload.php';
  10. class AutoloadTest extends PHPUnit_Framework_TestCase
  11. {
  12. /**
  13. * @var \flight\Engine
  14. */
  15. private $app;
  16. function setUp() {
  17. $this->app = new \flight\Engine();
  18. $this->app->path(__DIR__.'/classes');
  19. }
  20. // Autoload a class
  21. function testAutoload(){
  22. $this->app->register('user', 'User');
  23. $loaders = spl_autoload_functions();
  24. $user = $this->app->user();
  25. $this->assertTrue(sizeof($loaders) > 0);
  26. $this->assertTrue(is_object($user));
  27. $this->assertEquals('User', get_class($user));
  28. }
  29. // Check autoload failure
  30. function testMissingClass(){
  31. $test = null;
  32. $this->app->register('test', 'NonExistentClass');
  33. if (class_exists('NonExistentClass')) {
  34. $test = $this->app->test();
  35. }
  36. $this->assertEquals(null, $test);
  37. }
  38. }