Browse Source

added benchmark config and deployment files

dracony 12 years ago
parent
commit
38a8b03023

+ 16 - 0
php-phpixie/benchmark_config

@@ -0,0 +1,16 @@
+{
+  "framework": "phpixie",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "json_url": "/json",
+      "db_url": "/db",
+      "query_url": "/queries?queries=",
+      "fortune_url": "/fortunes",
+      "update_url": "/updates?queries=",
+      "plaintext_url": "/plaintext",
+      "port": 8080,
+      "sort": 27
+    }
+  }]
+}

+ 125 - 0
php-phpixie/deploy/nginx.conf

@@ -0,0 +1,125 @@
+#user  nobody;
+worker_processes  8;
+
+#error_log  logs/error.log;
+#error_log  logs/error.log  notice;
+#error_log  logs/error.log  info;
+
+#pid        logs/nginx.pid;
+
+
+events {
+    worker_connections  1024;
+}
+
+
+http {
+    include       /usr/local/nginx/conf/mime.types;
+    default_type  application/octet-stream;
+
+    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+    #                  '$status $body_bytes_sent "$http_referer" '
+    #                  '"$http_user_agent" "$http_x_forwarded_for"';
+
+    #access_log  logs/access.log  main;
+
+    sendfile        on;
+    #tcp_nopush     on;
+
+    #keepalive_timeout  0;
+    keepalive_timeout  65;
+
+    #gzip  on;
+
+    server {
+        listen       8080;
+        server_name  localhost;
+
+        #charset koi8-r;
+
+        #access_log  logs/host.access.log  main;
+
+        #location / {
+        #    root   html;
+        #    index  index.html index.htm;
+        #}
+
+        #error_page  404              /404.html;
+
+        # redirect server error pages to the static page /50x.html
+        #
+        #error_page   500 502 503 504  /50x.html;
+        #location = /50x.html {
+        #    root   html;
+        #}
+
+        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
+        #
+        #location ~ \.php$ {
+        #    proxy_pass   http://127.0.0.1;
+        #}
+
+        root /home/ubuntu/FrameworkBenchmarks/php-phpixie/web/;
+        index  index.php;
+
+        location / {
+            try_files $uri $uri/ /index.php?$uri&$args;
+        }
+
+        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
+        #
+        location ~ \.php$ {
+            try_files $uri =404;
+            fastcgi_pass   127.0.0.1:9001;
+            fastcgi_index  index.php;
+#            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
+            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
+            include        /usr/local/nginx/conf/fastcgi_params;
+        }
+
+        # deny access to .htaccess files, if Apache's document root
+        # concurs with nginx's one
+        #
+        #location ~ /\.ht {
+        #    deny  all;
+        #}
+    }
+
+
+    # another virtual host using mix of IP-, name-, and port-based configuration
+    #
+    #server {
+    #    listen       8000;
+    #    listen       somename:8080;
+    #    server_name  somename  alias  another.alias;
+
+    #    location / {
+    #        root   html;
+    #        index  index.html index.htm;
+    #    }
+    #}
+
+
+    # HTTPS server
+    #
+    #server {
+    #    listen       443;
+    #    server_name  localhost;
+
+    #    ssl                  on;
+    #    ssl_certificate      cert.pem;
+    #    ssl_certificate_key  cert.key;
+
+    #    ssl_session_timeout  5m;
+
+    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
+    #    ssl_ciphers  HIGH:!aNULL:!MD5;
+    #    ssl_prefer_server_ciphers   on;
+
+    #    location / {
+    #        root   html;
+    #        index  index.html index.htm;
+    #    }
+    #}
+
+}

+ 9 - 0
php-phpixie/deploy/php-phpixie

@@ -0,0 +1,9 @@
+<VirtualHost *:8080>
+  Alias /php-phpixie/ "/home/ubuntu/FrameworkBenchmarks/php-phpixie/web/"
+  <Directory /home/ubuntu/FrameworkBenchmarks/php-phpixie/web/>
+          Options Indexes FollowSymLinks MultiViews
+          #AllowOverride None
+          Order allow,deny
+          allow from all
+  </Directory>
+</VirtualHost>

+ 26 - 0
php-phpixie/setup.py

@@ -0,0 +1,26 @@
+import subprocess
+import sys
+import setup_util
+from os.path import expanduser
+
+home = expanduser("~")
+
+def start(args):
+  setup_util.replace_text("php-phpixie/assets/config/db.php", "localhost", "" + args.database_host + "")
+  setup_util.replace_text("php-phpixie/deploy/php-phpixie", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-phpixie/deploy/php-phpixie", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-phpixie/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+
+  try:
+    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-phpixie/deploy/php-fpm.pid", shell=True)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-phpixie/deploy/nginx.conf", shell=True)
+    return 0
+  except subprocess.CalledProcessError:
+    return 1
+def stop():
+  try:
+    subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True)
+    subprocess.call("sudo kill -QUIT $( cat php-phpixie/deploy/php-fpm.pid )", shell=True)
+    return 0
+  except subprocess.CalledProcessError:
+    return 1

+ 1 - 1
php-phpixie/vendor/autoload.php

@@ -4,4 +4,4 @@
 
 require_once __DIR__ . '/composer' . '/autoload_real.php';
 
-return ComposerAutoloaderInit1b6a9162cab34b0e1ddecb1e4d71f50a::getLoader();
+return ComposerAutoloaderInit5a349656fca0a335c592c1118b32872c::getLoader();

+ 1 - 0
php-phpixie/vendor/composer/autoload_classmap.php

@@ -20,6 +20,7 @@ return array(
     'PHPixie\\DB\\Query' => $vendorDir . '/phpixie/db/classes/PHPixie/DB/Query.php',
     'PHPixie\\DB\\Result' => $vendorDir . '/phpixie/db/classes/PHPixie/DB/Result.php',
     'PHPixie\\Debug' => $vendorDir . '/phpixie/core/classes/PHPixie/Debug.php',
+    'PHPixie\\Exception\\PageNotFound' => $vendorDir . '/phpixie/core/classes/PHPixie/Exception/PageNotFound.php',
     'PHPixie\\ORM' => $vendorDir . '/phpixie/orm/classes/PHPixie/ORM.php',
     'PHPixie\\ORM\\Extension' => $vendorDir . '/phpixie/orm/classes/PHPixie/ORM/Extension.php',
     'PHPixie\\ORM\\Extension\\Nested' => $vendorDir . '/phpixie/orm/classes/PHPixie/ORM/Extension/Nested.php',

+ 3 - 3
php-phpixie/vendor/composer/autoload_real.php

@@ -2,7 +2,7 @@
 
 // autoload_real.php generated by Composer
 
-class ComposerAutoloaderInit1b6a9162cab34b0e1ddecb1e4d71f50a
+class ComposerAutoloaderInit5a349656fca0a335c592c1118b32872c
 {
     private static $loader;
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit1b6a9162cab34b0e1ddecb1e4d71f50a
             return self::$loader;
         }
 
-        spl_autoload_register(array('ComposerAutoloaderInit1b6a9162cab34b0e1ddecb1e4d71f50a', 'loadClassLoader'), true, true);
+        spl_autoload_register(array('ComposerAutoloaderInit5a349656fca0a335c592c1118b32872c', 'loadClassLoader'), true, true);
         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
-        spl_autoload_unregister(array('ComposerAutoloaderInit1b6a9162cab34b0e1ddecb1e4d71f50a', 'loadClassLoader'));
+        spl_autoload_unregister(array('ComposerAutoloaderInit5a349656fca0a335c592c1118b32872c', 'loadClassLoader'));
 
         $vendorDir = dirname(__DIR__);
         $baseDir = dirname($vendorDir);

+ 12 - 12
php-phpixie/vendor/composer/installed.json

@@ -6,18 +6,18 @@
         "source": {
             "type": "git",
             "url": "https://github.com/dracony/PHPixie-Core.git",
-            "reference": "387a6d25ca3c73ff8503263db75c7664a69975ca"
+            "reference": "11092a22456ecb30f488fc246def5a16ffa47abf"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/dracony/PHPixie-Core/zipball/387a6d25ca3c73ff8503263db75c7664a69975ca",
-            "reference": "387a6d25ca3c73ff8503263db75c7664a69975ca",
+            "url": "https://api.github.com/repos/dracony/PHPixie-Core/zipball/11092a22456ecb30f488fc246def5a16ffa47abf",
+            "reference": "11092a22456ecb30f488fc246def5a16ffa47abf",
             "shasum": ""
         },
         "require": {
             "php": ">=5.3.0"
         },
-        "time": "2013-05-16 08:42:00",
+        "time": "2013-07-17 12:57:49",
         "type": "library",
         "extra": {
             "branch-alias": {
@@ -54,18 +54,18 @@
         "source": {
             "type": "git",
             "url": "https://github.com/dracony/PHPixie-DB.git",
-            "reference": "8d6fd658171ec046375b409167941462850ff8f4"
+            "reference": "4a3706193b0064a18d5c3115e6f1831c9f14de2e"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/dracony/PHPixie-DB/zipball/8d6fd658171ec046375b409167941462850ff8f4",
-            "reference": "8d6fd658171ec046375b409167941462850ff8f4",
+            "url": "https://api.github.com/repos/dracony/PHPixie-DB/zipball/4a3706193b0064a18d5c3115e6f1831c9f14de2e",
+            "reference": "4a3706193b0064a18d5c3115e6f1831c9f14de2e",
             "shasum": ""
         },
         "require": {
             "phpixie/core": "2.*@dev"
         },
-        "time": "2013-05-11 19:35:58",
+        "time": "2013-06-22 22:25:03",
         "type": "library",
         "extra": {
             "branch-alias": {
@@ -105,18 +105,18 @@
         "source": {
             "type": "git",
             "url": "https://github.com/dracony/PHPixie-ORM.git",
-            "reference": "b081caf676e2af832c6856c44ec4695a10064d83"
+            "reference": "c6c379b9efd17e021a9659f01ed2f75027e3a2fc"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/dracony/PHPixie-ORM/zipball/b081caf676e2af832c6856c44ec4695a10064d83",
-            "reference": "b081caf676e2af832c6856c44ec4695a10064d83",
+            "url": "https://api.github.com/repos/dracony/PHPixie-ORM/zipball/c6c379b9efd17e021a9659f01ed2f75027e3a2fc",
+            "reference": "c6c379b9efd17e021a9659f01ed2f75027e3a2fc",
             "shasum": ""
         },
         "require": {
             "phpixie/db": "2.*@dev"
         },
-        "time": "2013-06-04 14:52:37",
+        "time": "2013-07-15 23:35:57",
         "type": "library",
         "extra": {
             "branch-alias": {

+ 4 - 2
php-phpixie/vendor/phpixie/core/README.md

@@ -91,13 +91,15 @@ class Controller
 	 *
 	 * @param string    $action Name of the action to execute.
 	 * @return void
-	 * @throws \Exception If the specified action doesn't exist
+	 * @throws \PHPixie\Exception\PageNotFound If the specified action doesn't exist
 	 */
 	public function run($action)
 	{
 		$action = 'action_'.$action;
+		
 		if (!method_exists($this, $action))
-			throw new \Exception("Method {$action} doesn't exist in ".get_class($this), 404);
+			throw new \PHPixie\Exception\PageNotFound("Method {$action} doesn't exist in ".get_class($this));
+			
 		$this->execute = true;
 		$this->before();
 		if ($this->execute)

+ 16 - 64
php-phpixie/vendor/phpixie/core/classes/PHPixie/Debug.php

@@ -37,56 +37,34 @@ class Debug
 	}
 	
 	/**
-	 * Displays the error page. If you have 'silent_errors' enabled in
-	 * core.php config file, a small message will be shown instead.
+	 * Displays the error page. If you set $display_errors to false
+	 * only a small error message will be displayed.
 	 *
 	 * @param \Exception $exception Exception to display
 	 * @return void
 	 */
-	public function render_error($exception)
+	public function render_exception_page($exception)
 	{
 		if (ob_get_length() > 0)
-		{
 			ob_end_clean();
-		}
 
-		if ($exception->getCode() == 404)
-		{
+		$status = '503 Service Temporarily Unavailable';
+		
+		if ($exception instanceof \PHPixie\Exception\PageNotFound)
 			$status = '404 Not Found';
-		}
-		else
-		{
-			$status = '503 Service Temporarily Unavailable';
-		}
-
+			
 		header($_SERVER["SERVER_PROTOCOL"].' '.$status);
 		header("Status: {$status}");
 
-		if (!$this->display_errors)
-		{
+		if (!$this->display_errors) {
 			echo $status;
-			return;
+		}else{
+			$view = $this->pixie->view('debug');
+			$view->exception = $exception;
+			$view->log = $this->logged;
+			echo $view->render();
 		}
-
-		$view = $this->pixie->view('debug');
-		$view->exception = $exception;
-		$view->log = $this->logged;
-		echo $view->render();
-	}
-
-	/**
-	 * Catches errors and exceptions and sends them
-	 * to the configured handler if one is present,
-	 * otherwise render_error() will be called.
-	 *
-	 * @param \Exception $exception Caught exception
-	 * @return void
-	 */
-	public function onError($exception)
-	{
-		set_exception_handler(array($this, 'internalException'));
-		set_error_handler(array($this, 'internalError'), E_ALL);
-		$this->render_error($exception);
+		
 	}
 
 	/**
@@ -99,36 +77,11 @@ class Debug
 	 * @return void
 	 * @throws \ErrorException Throws converted exception to be immediately caught
 	 */
-	public function errorHandler($errno, $errstr, $errfile, $errline)
+	public function error_handler($errno, $errstr, $errfile, $errline)
 	{
 		throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
 	}
 
-	/**
-	 * Handles exceptions that occurred while inside the error handler. Prevents recursion.
-	 *
-	 * @param \Exception  $exception Caught exception
-	 * @return void
-	 */
-	public function internalException($exception)
-	{
-		echo $exception->getMessage().' in '.$exception->getFile().' on line '.$exception->getLine();
-	}
-
-	/**
-	 * Handles errors that occurred while inside the error handler. Prevents recursion.
-	 *
-	 * @param string        $errno   Error number
-	 * @param string        $errstr  Error message
-	 * @param string        $errfile File in which the error occurred
-	 * @param string        $errline Line at which the error occurred
-	 * @return void
-	 */
-	public function internalError($errno, $errstr, $errfile, $errline)
-	{
-		echo $errstr.' in '.$errfile.' on line '.$errline;
-	}
-
 	/**
 	 * Initializes the error handler
 	 *
@@ -136,8 +89,7 @@ class Debug
 	 */
 	public function init()
 	{
-		set_exception_handler(array($this, 'onError'));
-		set_error_handler(array($this, 'errorHandler'), E_ALL);
+		set_error_handler(array($this, 'error_handler'), E_ALL);
 	}
 
 	/**

+ 9 - 0
php-phpixie/vendor/phpixie/core/classes/PHPixie/Exception/PageNotFound.php

@@ -0,0 +1,9 @@
+<?php
+
+namespace PHPixie\Exception;
+
+/**
+ * This exception is throw when none of the routes matched
+ * or the specified controller or action wasn't found.
+ */
+class PageNotFound extends \Exception {}

+ 34 - 3
php-phpixie/vendor/phpixie/core/classes/PHPixie/Pixie.php

@@ -13,7 +13,7 @@ namespace PHPixie;
  * @property-read \PHPixie\Config $config Configuration handler
  * @property-read \PHPixie\Debug $debug Error handler and logger
  * @property-read \PHPixie\Router $router Router
- * @property-read \PHPixie\Session $config Session handler
+ * @property-read \PHPixie\Session $session Session handler
  */
 
  class Pixie {
@@ -89,10 +89,12 @@ namespace PHPixie;
 	 *
 	 * @param string $class Controller class
 	 * @return \PHPixie\Controller
+	 * @throw  \PHPixie\Exception\PageNotFound If the controller class is not found
 	 */
 	public function controller($class) {
 		if (!class_exists($class))
-			throw new \Exception("Class {$class} doesn't exist", 404);
+			throw new \PHPixie\Exception\PageNotFound("Class {$class} doesn't exist");
+			
 		return new $class($this);
 	}
 	
@@ -170,7 +172,6 @@ namespace PHPixie;
 	 * @param boolean $return_all If 'true' returns all mathced files as array,
 	 *                            otherwise returns the first file found
 	 * @return mixed  Full path to the file or False if it is not found
-	 * @static
 	 */
 	public function find_file($subfolder, $name, $extension = 'php', $return_all = false)
 	{
@@ -209,6 +210,36 @@ namespace PHPixie;
 		return $this->request($route_data['route'], $_SERVER['REQUEST_METHOD'], $_POST, $_GET, $route_data['params'], $_SERVER);
 	}
 	
+	/**
+	 * Processes HTTP request, executes it and sends back the response.
+	 *
+	 * @return void
+	 */
+	public function handle_http_request() {
+		try {
+		
+			$request =  $this->http_request();
+			$response = $request->execute();
+			$response->send_headers()->send_body();
+			
+		}catch (\Exception $e) {
+			$this->handle_exception($e);
+		}
+		
+	}
+	
+	/**
+	 * Exception handler. By default displays the error page.
+	 * If you want your exceptions to be handled in a specific way
+	 * you should override this method.
+	 *
+	 * @param \Exception $exception Exception to handle
+	 * @return void
+	 */
+	public function handle_exception($exception) {
+		$this->debug->render_exception_page($exception);
+	}
+	
 	/**
 	 * Bootstraps the project
 	 *

+ 8 - 6
php-phpixie/vendor/phpixie/core/classes/PHPixie/Request.php

@@ -65,9 +65,9 @@ class Router {
 	 * @param string   $uri Request URI
 	 * @param string   $method Request method
 	 * @return array Array containing route and matched parameters
-	 * @throws \Exception If no route matches the URI
-	 * @throws \Exception If route matched but no Controller was defined for it
-	 * @throws \Exception If route matched but no action was defined for it
+	 * @throws \PHPixie\Exception\PageNotFound If no route matches the URI
+	 * @throws \PHPixie\Exception\PageNotFound If route matched but no Controller was defined for it
+	 * @throws \PHPixie\Exception\PageNotFound If route matched but no action was defined for it
 	 */
 	public function match($uri, $method = 'GET')
 	{
@@ -112,14 +112,16 @@ class Router {
 			}
 		}
 		if ($matched == false)
-			throw new \Exception('No route matched your request', 404);
+			throw new \PHPixie\Exception\PageNotFound('No route matched your request');
 			
 		$route = $this->routes[$matched];
 		$params = array_merge($route->defaults, $data);
+		
 		if (!isset($params['controller']))
-			throw new \Exception("Route {$matched} matched, but no controller was defined for this route", 404);
+			throw new \PHPixie\Exception\PageNotFound("Route {$matched} matched, but no controller was defined for this route");
+			
 		if (!isset($params['action']))
-			throw new \Exception("Route {$matched} matched with controller {$params['controller']}, but no action was defined for this route", 404);
+			throw new \PHPixie\Exception\PageNotFound("Route {$matched} matched with controller {$params['controller']}, but no action was defined for this route");
 
 		return array(
 					'route'=>$route, 

+ 1 - 1
php-phpixie/vendor/phpixie/core/classes/PHPixie/Session.php

@@ -49,7 +49,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
 		$except = false;
 		try {
 			$this->object->run('bogus');
-		} catch (Exception $e) {
+		} catch (\PHPixie\Exception\PageNotFound $e) {
 			$except = true;
 		}
 		$this->assertEquals($except, true);

+ 1 - 1
php-phpixie/vendor/phpixie/core/tests/phpunit.xml

@@ -39,7 +39,7 @@ class RoterTest extends PHPUnit_Framework_TestCase
 		$this->object->add(new \PHPixie\Route('a', 'b', array()));
 		try {
 			$this->object->get('c');
-		} catch (Exception $e) {
+		} catch (\Exception $e) {
 			$except = true;
 		}
 		$this->assertEquals(true, $except);

+ 7 - 4
php-phpixie/vendor/phpixie/core/tests/sessionTest.php

@@ -145,7 +145,7 @@ class Query extends \PHPixie\DB\Query
 		if ($table instanceof \PHPixie\DB\Expression)
 			return "({$table->value}) AS {$alias}";
 
-		throw new \Exception("Parameter type {get_class($table)} cannot be used as a table");
+		throw new \Exception("Parameter type ".get_class($table)." cannot be used as a table");
 	}
 
 	/**
@@ -220,7 +220,8 @@ class Query extends \PHPixie\DB\Query
 						}
 					}
 				}
-				$query .= "FROM {$this->escape_table($this->_table, $params)} ";
+				if(!empty($this->_table))
+					$query .= "FROM {$this->escape_table($this->_table, $params)} ";
 			}
 			if ($this->_type == 'count')
 			{
@@ -265,7 +266,9 @@ class Query extends \PHPixie\DB\Query
 			{
 				$table = $join[0];
 				$table = $this->escape_table($table, $params);
-				$query .= strtoupper($join[1])." JOIN {$table} ON {$this->get_condition_query($join[2], $params, true, true)} ";
+				$query .= strtoupper($join[1])." JOIN {$table} ";
+				if(!empty($join[2]))
+					$query.="ON {$this->get_condition_query($join[2], $params, true, true)} ";
 			}
 
 			if (!empty($this->_conditions))
@@ -390,4 +393,4 @@ class Query extends \PHPixie\DB\Query
 		throw new \Exception("Cannot parse condition:\n".var_export($p, true));
 	}
 
-}
+}

+ 3 - 0
php-phpixie/vendor/phpixie/db/classes/PHPixie/DB/PDO/Result.php

@@ -418,6 +418,9 @@ abstract class Query
 	{
 		if ($this->_alias === null)
 		{
+			if (is_array($this->_table))
+				return $this->_table[1];
+
 			return $this->_table;
 		}
 		return 'a'.$this->_alias;

+ 81 - 81
php-phpixie/vendor/phpixie/db/classes/PHPixie/DB/Result.php

@@ -1,81 +1,81 @@
-<?php
-
-
-/**
- * Generated by PHPUnit_SkeletonGenerator on 2013-02-07 at 10:14:10.
- */
-class DB_Test extends PHPUnit_Framework_TestCase
-{
-
-	/**
-	 * @var Expression_Database
-	 */
-	protected $object;
-
-	/**
-	 * Sets up the fixture, for example, opens a network connection.
-	 * This method is called before a test is executed.
-	 */
-	protected function setUp()
-	{
-		
-		$this->db_file = tempnam(sys_get_temp_dir(), 'test.sqlite');
-		$this->conf_file = tempnam(sys_get_temp_dir(), 'test.conf');
-		file_put_contents($this->db_file, '');
-		$db = new PDO('sqlite:'.$this->db_file);
-		$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-		$db->exec("CREATE TABLE fairies(id INT PRIMARY_KEY,name VARCHAR(255))");
-		$pixie = $this->getMock('\PHPixie\Pixie',array('find_file'));
-		$pixie->expects($this->any())
-                 ->method('find_file')
-                 ->will($this->returnValue($this->conf_file));
-		$pixie->db = $this->getMockBuilder('\PHPixie\DB')
-				->disableOriginalConstructor()
-				->getMock();
-		$pixie->db->expects($this->any())
-                 ->method('query_driver')
-                 ->will($this->returnValue(null));
-		$pixie->config->set('db.default.connection', 'sqlite:'.$this->db_file);
-		$pixie-> config->set('db.default.driver', 'pdo');
-		$this->object = new \PHPixie\DB($pixie);
-		$pixie-> db = $this->object;
-		$db = null;
-	}
-	
-	public function testGet() {
-		$this->object->get()->test = 'same';
-		$this->assertEquals('same', $this->object->get()->test);
-		$this->assertEquals('PHPixie\DB\PDO\Connection', get_class($this->object->get()));
-	}
-	
-	public function testQuery() {
-		$this->assertEquals('PHPixie\DB\PDO\Query', get_class($this->object->query('select')));
-	}
-	
-	public function testInsert_id()
-	{
-		$this->object->get()->execute("INSERT INTO fairies(name)values('Trixie')");
-		$this->assertEquals(1, $this->object->insert_id());
-	}
-
-	public function testList_columns()
-	{
-		$cols = $this->object->list_columns('fairies');
-		$this->assertContains('id', $cols);
-		$this->assertContains('name', $cols);
-	}
-	
-	public function testExpr() {
-		$this->assertEquals('PHPixie\DB\Expression', get_class($this->object->expr("test")));
-	}
-	
-	public function testQuery_driver() {
-		$this->assertEquals('PHPixie\DB\PDO\Query', get_class($this->object->query_driver('pdo',$this->object->get(),'select')));
-	}
-	
-	public function testResult_driver() {
-		$this->assertEquals('PHPixie\DB\PDO\Result', get_class($this->object->result_driver('pdo',null)));
-	}
-	
-	
-}
+<?php
+
+
+/**
+ * Generated by PHPUnit_SkeletonGenerator on 2013-02-07 at 10:14:10.
+ */
+class DB_Test extends PHPUnit_Framework_TestCase
+{
+
+	/**
+	 * @var Expression_Database
+	 */
+	protected $object;
+
+	/**
+	 * Sets up the fixture, for example, opens a network connection.
+	 * This method is called before a test is executed.
+	 */
+	protected function setUp()
+	{
+		
+		$this->db_file = tempnam(sys_get_temp_dir(), 'test.sqlite');
+		$this->conf_file = tempnam(sys_get_temp_dir(), 'test.conf');
+		file_put_contents($this->db_file, '');
+		$db = new PDO('sqlite:'.$this->db_file);
+		$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+		$db->exec("CREATE TABLE fairies(id INT PRIMARY_KEY,name VARCHAR(255))");
+		$pixie = $this->getMock('\PHPixie\Pixie',array('find_file'));
+		$pixie->expects($this->any())
+                 ->method('find_file')
+                 ->will($this->returnValue($this->conf_file));
+		$pixie->db = $this->getMockBuilder('\PHPixie\DB')
+				->disableOriginalConstructor()
+				->getMock();
+		$pixie->db->expects($this->any())
+                 ->method('query_driver')
+                 ->will($this->returnValue(null));
+		$pixie->config->set('db.default.connection', 'sqlite:'.$this->db_file);
+		$pixie-> config->set('db.default.driver', 'pdo');
+		$this->object = new \PHPixie\DB($pixie);
+		$pixie-> db = $this->object;
+		$db = null;
+	}
+	
+	public function testGet() {
+		$this->object->get()->test = 'same';
+		$this->assertEquals('same', $this->object->get()->test);
+		$this->assertEquals('PHPixie\DB\PDO\Connection', get_class($this->object->get()));
+	}
+	
+	public function testQuery() {
+		$this->assertEquals('PHPixie\DB\PDO\Query', get_class($this->object->query('select')));
+	}
+	
+	public function testInsert_id()
+	{
+		$this->object->get()->execute("INSERT INTO fairies(name)values('Trixie')");
+		$this->assertEquals(1, $this->object->insert_id());
+	}
+
+	public function testList_columns()
+	{
+		$cols = $this->object->list_columns('fairies');
+		$this->assertContains('id', $cols);
+		$this->assertContains('name', $cols);
+	}
+	
+	public function testExpr() {
+		$this->assertEquals('PHPixie\DB\Expression', get_class($this->object->expr("test")));
+	}
+	
+	public function testQuery_driver() {
+		$this->assertEquals('PHPixie\DB\PDO\Query', get_class($this->object->query_driver('pdo',$this->object->get(),'select')));
+	}
+	
+	public function testResult_driver() {
+		$this->assertEquals('PHPixie\DB\PDO\Result', get_class($this->object->result_driver('pdo',null)));
+	}
+	
+	
+}

+ 76 - 76
php-phpixie/vendor/phpixie/db/tests/db/expressionTest.php

@@ -1,76 +1,76 @@
-<?php
-require_once(__DIR__.'/../files/extension.php');
-require_once(__DIR__.'/../files/tree_orm.php');
-require_once(__DIR__.'/../files/fairy_orm.php');
-
-/**
- * Generated by PHPUnit_SkeletonGenerator on 2013-02-07 at 10:14:10.
- */
-class ORM_Test extends PHPUnit_Framework_TestCase
-{
-
-	/**
-	 * @var Expression_Database
-	 */
-	protected $object;
-
-	/**
-	 * Sets up the fixture, for example, opens a network connection.
-	 * This method is called before a test is executed.
-	 */
-	protected function setUp()
-	{
-		
-		$this->db_file = tempnam(sys_get_temp_dir(), 'test.sqlite');
-		$this->conf_file = tempnam(sys_get_temp_dir(), 'test.conf');
-		file_put_contents($this->db_file, '');
-		$db = new PDO('sqlite:'.$this->db_file);
-		$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-		$db->exec("CREATE TABLE fairies(id INT PRIMARY_KEY,name VARCHAR(255),tree_id INT)");
-		$db->exec("CREATE TABLE trees(id INT PRIMARY_KEY,name VARCHAR(255),protector_id INT)");
-		$db->exec("CREATE TABLE friends(fairy_id INT,friend_id INT)");
-
-		$db->exec("INSERT INTO fairies(id,name,tree_id) VALUES (1,'Tinkerbell',1)");
-		$db->exec("INSERT INTO fairies(id,name,tree_id) VALUES (2,'Trixie',2)");
-
-		$db->exec("INSERT INTO trees(id,name,protector_id) VALUES (1,'Oak',2)");
-		$db->exec("INSERT INTO trees(id,name,protector_id) VALUES (2,'Willow',2)");
-
-		$db->exec("INSERT INTO friends(fairy_id,friend_id) VALUES (1,2)");
-
-		$this->pixie = $this->getMock('\PHPixie\Pixie',array('find_file'));
-		$this->pixie->expects($this->any())
-                 ->method('find_file')
-                 ->will($this->returnValue($this->conf_file));
-		$this->pixie->db = new \PHPixie\DB($this->pixie);
-		$this->pixie-> orm = new \PHPixie\ORM($this->pixie);
-				 
-		$this->pixie->config->set('db.orm.connection', 'sqlite:'.$this->db_file);
-		$this->pixie->config->set('db.orm.driver', 'pdo');
-
-		$this->fairies = new \Model\Fairy($this->pixie);
-		$this->trees = new \Model\Tree($this->pixie);
-		$this->object = $this->pixie-> orm;
-	}
-	
-	protected function tearDown()
-	{	
-		$db = $this->pixie->db->get('orm');
-		$db->conn = null;
-		unlink($this->db_file);
-		unlink($this->conf_file);
-	}
-	
-	public function testGet() {
-		$this->assertEquals('Model\Fairy', get_class($this->object->get('fairy')));
-		$this->assertEquals('Model\Tree', get_class($this->object->get('tree')));
-		$this->assertEquals(1, $this->object->get('fairy',1)->id);
-	}
-	
-	public function testResult() {
-		$this->assertEquals('PHPixie\ORM\Result', get_class($this->object->result('fairy',null)));
-	}
-	
-
-	
-}
+<?php
+require_once(__DIR__.'/../files/extension.php');
+require_once(__DIR__.'/../files/tree_orm.php');
+require_once(__DIR__.'/../files/fairy_orm.php');
+
+/**
+ * Generated by PHPUnit_SkeletonGenerator on 2013-02-07 at 10:14:10.
+ */
+class ORM_Test extends PHPUnit_Framework_TestCase
+{
+
+	/**
+	 * @var Expression_Database
+	 */
+	protected $object;
+
+	/**
+	 * Sets up the fixture, for example, opens a network connection.
+	 * This method is called before a test is executed.
+	 */
+	protected function setUp()
+	{
+		
+		$this->db_file = tempnam(sys_get_temp_dir(), 'test.sqlite');
+		$this->conf_file = tempnam(sys_get_temp_dir(), 'test.conf');
+		file_put_contents($this->db_file, '');
+		$db = new PDO('sqlite:'.$this->db_file);
+		$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+		$db->exec("CREATE TABLE fairies(id INT PRIMARY_KEY,name VARCHAR(255),tree_id INT)");
+		$db->exec("CREATE TABLE trees(id INT PRIMARY_KEY,name VARCHAR(255),protector_id INT)");
+		$db->exec("CREATE TABLE friends(fairy_id INT,friend_id INT)");
+
+		$db->exec("INSERT INTO fairies(id,name,tree_id) VALUES (1,'Tinkerbell',1)");
+		$db->exec("INSERT INTO fairies(id,name,tree_id) VALUES (2,'Trixie',2)");
+
+		$db->exec("INSERT INTO trees(id,name,protector_id) VALUES (1,'Oak',2)");
+		$db->exec("INSERT INTO trees(id,name,protector_id) VALUES (2,'Willow',2)");
+
+		$db->exec("INSERT INTO friends(fairy_id,friend_id) VALUES (1,2)");
+
+		$this->pixie = $this->getMock('\PHPixie\Pixie',array('find_file'));
+		$this->pixie->expects($this->any())
+                 ->method('find_file')
+                 ->will($this->returnValue($this->conf_file));
+		$this->pixie->db = new \PHPixie\DB($this->pixie);
+		$this->pixie-> orm = new \PHPixie\ORM($this->pixie);
+				 
+		$this->pixie->config->set('db.orm.connection', 'sqlite:'.$this->db_file);
+		$this->pixie->config->set('db.orm.driver', 'pdo');
+
+		$this->fairies = new \Model\Fairy($this->pixie);
+		$this->trees = new \Model\Tree($this->pixie);
+		$this->object = $this->pixie-> orm;
+	}
+	
+	protected function tearDown()
+	{	
+		$db = $this->pixie->db->get('orm');
+		$db->conn = null;
+		unlink($this->db_file);
+		unlink($this->conf_file);
+	}
+	
+	public function testGet() {
+		$this->assertEquals('Model\Fairy', get_class($this->object->get('fairy')));
+		$this->assertEquals('Model\Tree', get_class($this->object->get('tree')));
+		$this->assertEquals(1, $this->object->get('fairy',1)->id);
+	}
+	
+	public function testResult() {
+		$this->assertEquals('PHPixie\ORM\Result', get_class($this->object->result('fairy',null)));
+	}
+	
+
+	
+}

+ 1 - 4
php-phpixie/vendor/phpixie/orm/tests/orm/resultTest.php

@@ -2,10 +2,7 @@
 $root = dirname(__DIR__);
 $loader = require $root.'/vendor/autoload.php';
 $loader->add('', $root.'/classes/');
-$loader->add('PHPixie', $root.'/vendor/phpixie/core/classes/');
-$loader->add('PHPixie', $root.'/vendor/phpixie/db/classes/');
-$loader->add('PHPixie',$root.'/vendor/phpixie/orm/classes/');
 
 $pixie = new \App\Pixie();
-$pixie->bootstrap($root)->http_request()->execute()->send_headers()->send_body();
+$pixie->bootstrap($root)->handle_http_request();
 ?>