/** 
  * Test the autoloading function alf by loading different
  * types of classes.
  * @small
  */
 public function testAutoloading()
 {
     // default path
     $p = "src";
     // create an AutLoader with initiaization disabled
     // to set testing state first and initialize it manually
     $al = new \core\AutoLoader(false, $p);
     $al->sett(true);
     $al->load();
     // run tests/assertions for a testing state
     $this->alt($al);
     // run same tests/assertions for a non testing state
     $al->unload();
     $al->sett(false);
     $al->expand(".class.php,.include.php,.interface.php,.test.class.php,.inc,.php");
     $al->load();
     $this->alt($al);
     $al = null;
 }
Exemplo n.º 2
0
 /**
  * Test the state setting.
  * @small
  */
 public function testStateModification()
 {
     $al = new \core\AutoLoader();
     $this->assertEquals(false, $al->gett());
     $al->sett(null);
     $this->assertEquals(false, $al->gett());
     $al->sett(false);
     $this->assertEquals(false, $al->gett());
     $al->sett(true);
     $this->assertEquals(true, $al->gett());
     $al = null;
 }
Exemplo n.º 3
0
<?php

// NOTE: no need to load the phpunit autoloader or token-stream directly
//       as the autoloader below is able to load classes represented
//       by their names, e.g. Class_Name masquerades Class/Name.php as
//       phpunit/token-stream does for, e.g. PHPUnit_Framework_TestCase
// auto loading project classes
// when running build script from .. prepend src directory
// AND modify the path the autoloader should search for project classes
//   as it defaults to '.' = 'src' for the build script
require_once "@php-dir-include@/core/autoloader.class.php";
// get an AutoLoader
$al = new core\AutoLoader(false, "@php-dir-include@");
// for phpunit, token, log and test classes
$al->expand(".test.class.php,.interface.php,.php");
// initialize $al manually to expand the suffix list first
$al->load();