--- /dev/null
+<?php
+
+class Project_Test extends PHPUnit_Framework_TestCase
+{
+ public function testApps()
+ {
+ $apps = IPF_Project::getInstance()->appList();
+ $this->assertEquals(array('IPF_Session', 'IPF_Auth', 'IPF_Admin'), array_keys($apps));
+ }
+
+ public function testMiddlewares()
+ {
+ $middlewares = array();
+ $middleware = $this->callMethod(IPF_Project::getInstance(), 'chainMiddlewares');
+ while ($middleware != null) {
+ $middlewares[] = $middleware;
+ $middleware = $this->getProperty($middleware, 'next');
+ }
+
+ $this->assertEquals(array(
+ 'IPF_Error_Middleware',
+ 'IPF_Middleware_Common',
+ 'IPF_Session_Middleware',
+ 'IPF_Dispatch_Middleware',
+ ), array_map('get_class', $middlewares));
+ }
+
+ protected function getProperty($obj, $property)
+ {
+ $cls = new ReflectionClass($obj);
+ $property = $cls->getProperty($property);
+ $property->setAccessible(true);
+ return $property->getValue($obj);
+ }
+
+ protected function callMethod($obj, $method, $args=array())
+ {
+ $cls = new ReflectionClass($obj);
+ $method = $cls->getMethod($method);
+ $method->setAccessible(true);
+ return $method->invokeArgs($obj, $args);
+ }
+}
+
<?php
-
$here = dirname(__FILE__);
-$ipf_path = $here . '/../../..';
-$project_path = $here . '/../project';
-
-require $ipf_path . '/ipf.php';
-return IPF::setUp($project_path, $here, $ipf_path . '/vendor'); // && IPF_Project::getInstance()->run();
-
+$project_root = $here . '/..';
+require_once $project_root . '/../../vendor/autoload.php';
+IPF::configure($project_root, $here);
+IPF_Project::getInstance();
<?php
-
-$project_root = dirname(__FILE__).DIRECTORY_SEPARATOR.'..';
-
-$set = array();
-$set['dsn'] = 'mysql://fake:fake@localhost/fake';
-
-$set['tmp'] = $project_root . '/tmp';
-
-$set['secret_key'] = '123456';
-
-$set['debug'] = true;
-
-$set['applications'] = array(
- 'IPF_Session',
- 'IPF_Auth',
- 'IPF_Admin',
-);
-
-$set['middlewares'] = array(
- 'IPF_Middleware_Common',
- 'IPF_Session_Middleware',
+return array(
+ 'database' => array(
+ 'driver' => 'mysql',
+ 'host' => 'localhost',
+ 'database' => 'fake',
+ 'username' => 'fake',
+ 'password' => 'fake',
+ ),
+
+ 'secret_key' => '123456',
+
+ 'debug' => true,
+
+ 'applications' => array(
+ 'IPF_Session',
+ 'IPF_Auth',
+ 'IPF_Admin',
+ ),
+
+ 'middlewares' => array(
+ 'IPF_Middleware_Common',
+ 'IPF_Session_Middleware',
+ ),
+
+ 'urls' => array(
+ array('expr' => '/robots.txt', 'func' => 'no_function_given'),
+ ),
);
-$set['urls'] = array();
-
-return $set;
-