summaryrefslogtreecommitdiff
path: root/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite
diff options
context:
space:
mode:
Diffstat (limited to 'poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite')
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestCase.php679
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestLoader.php123
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestRunner.php103
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestSuite.php63
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestSuiteCommand.php171
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php276
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/ControllerTestCase.php378
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Coverage/BaseCoverageReport.php179
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php201
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Coverage/TextCoverageReport.php63
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Fixture/CakeFixtureManager.php282
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Fixture/CakeTestFixture.php269
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Fixture/CakeTestModel.php70
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Reporter/CakeBaseReporter.php210
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php377
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Reporter/CakeTextReporter.php187
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/footer.php36
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/header.php146
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/menu.php51
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/missing_connection.php27
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/phpunit.php36
-rw-r--r--poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/xdebug.php28
22 files changed, 3955 insertions, 0 deletions
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestCase.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestCase.php
new file mode 100644
index 0000000..3509243
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestCase.php
@@ -0,0 +1,679 @@
+<?php
+/**
+ * CakeTestCase file
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
+ * @package Cake.TestSuite
+ * @since CakePHP(tm) v 1.2.0.4667
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+App::uses('CakeFixtureManager', 'TestSuite/Fixture');
+App::uses('CakeTestFixture', 'TestSuite/Fixture');
+
+/**
+ * CakeTestCase class
+ *
+ * @package Cake.TestSuite
+ */
+abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
+
+/**
+ * The class responsible for managing the creation, loading and removing of fixtures
+ *
+ * @var CakeFixtureManager
+ */
+ public $fixtureManager = null;
+
+/**
+ * By default, all fixtures attached to this class will be truncated and reloaded after each test.
+ * Set this to false to handle manually
+ *
+ * @var array
+ */
+ public $autoFixtures = true;
+
+/**
+ * Set this to false to avoid tables to be dropped if they already exist
+ *
+ * @var boolean
+ */
+ public $dropTables = true;
+
+/**
+ * Configure values to restore at end of test.
+ *
+ * @var array
+ */
+ protected $_configure = array();
+
+/**
+ * Path settings to restore at the end of the test.
+ *
+ * @var array
+ */
+ protected $_pathRestore = array();
+
+/**
+ * Runs the test case and collects the results in a TestResult object.
+ * If no TestResult object is passed a new one will be created.
+ * This method is run for each test method in this class
+ *
+ * @param PHPUnit_Framework_TestResult $result
+ * @return PHPUnit_Framework_TestResult
+ * @throws InvalidArgumentException
+ */
+ public function run(PHPUnit_Framework_TestResult $result = null) {
+ if (!empty($this->fixtureManager)) {
+ $this->fixtureManager->load($this);
+ }
+ $result = parent::run($result);
+ if (!empty($this->fixtureManager)) {
+ $this->fixtureManager->unload($this);
+ }
+ return $result;
+ }
+
+/**
+ * Called when a test case method is about to start (to be overridden when needed.)
+ *
+ * @param string $method Test method about to get executed.
+ * @return void
+ */
+ public function startTest($method) {
+ }
+
+/**
+ * Called when a test case method has been executed (to be overridden when needed.)
+ *
+ * @param string $method Test method about that was executed.
+ * @return void
+ */
+ public function endTest($method) {
+ }
+
+/**
+ * Overrides SimpleTestCase::skipIf to provide a boolean return value
+ *
+ * @param boolean $shouldSkip
+ * @param string $message
+ * @return boolean
+ */
+ public function skipIf($shouldSkip, $message = '') {
+ if ($shouldSkip) {
+ $this->markTestSkipped($message);
+ }
+ return $shouldSkip;
+ }
+
+/**
+ * Setup the test case, backup the static object values so they can be restored.
+ * Specifically backs up the contents of Configure and paths in App if they have
+ * not already been backed up.
+ *
+ * @return void
+ */
+ public function setUp() {
+ parent::setUp();
+
+ if (empty($this->_configure)) {
+ $this->_configure = Configure::read();
+ }
+ if (empty($this->_pathRestore)) {
+ $this->_pathRestore = App::paths();
+ }
+ if (class_exists('Router', false)) {
+ Router::reload();
+ }
+ }
+
+/**
+ * teardown any static object changes and restore them.
+ *
+ * @return void
+ */
+ public function tearDown() {
+ parent::tearDown();
+ App::build($this->_pathRestore, App::RESET);
+ if (class_exists('ClassRegistry', false)) {
+ ClassRegistry::flush();
+ }
+ if (!empty($this->_configure)) {
+ Configure::clear();
+ Configure::write($this->_configure);
+ }
+ if (isset($_GET['debug']) && $_GET['debug']) {
+ ob_flush();
+ }
+ }
+
+/**
+ * See CakeTestSuiteDispatcher::date()
+ *
+ * @param string $format format to be used.
+ * @return string
+ */
+ public static function date($format = 'Y-m-d H:i:s') {
+ return CakeTestSuiteDispatcher::date($format);
+ }
+
+// @codingStandardsIgnoreStart PHPUnit overrides don't match CakePHP
+
+/**
+ * Announces the start of a test.
+ *
+ * @param string $method Test method just started.
+ * @return void
+ */
+ protected function assertPreConditions() {
+ parent::assertPreConditions();
+ $this->startTest($this->getName());
+ }
+
+/**
+ * Announces the end of a test.
+ *
+ * @param string $method Test method just finished.
+ * @return void
+ */
+ protected function assertPostConditions() {
+ parent::assertPostConditions();
+ $this->endTest($this->getName());
+ }
+
+// @codingStandardsIgnoreEnd
+
+/**
+ * Chooses which fixtures to load for a given test
+ *
+ * @param string $fixture Each parameter is a model name that corresponds to a
+ * fixture, i.e. 'Post', 'Author', etc.
+ * @return void
+ * @see CakeTestCase::$autoFixtures
+ * @throws Exception when no fixture manager is available.
+ */
+ public function loadFixtures() {
+ if (empty($this->fixtureManager)) {
+ throw new Exception(__d('cake_dev', 'No fixture manager to load the test fixture'));
+ }
+ $args = func_get_args();
+ foreach ($args as $class) {
+ $this->fixtureManager->loadSingle($class);
+ }
+ }
+
+/**
+ * Assert text equality, ignoring differences in newlines.
+ * Helpful for doing cross platform tests of blocks of text.
+ *
+ * @param string $expected The expected value.
+ * @param string $result The actual value.
+ * @param message The message to use for failure.
+ * @return boolean
+ */
+ public function assertTextNotEquals($expected, $result, $message = '') {
+ $expected = str_replace(array("\r\n", "\r"), "\n", $expected);
+ $result = str_replace(array("\r\n", "\r"), "\n", $result);
+ return $this->assertNotEquals($expected, $result, $message);
+ }
+
+/**
+ * Assert text equality, ignoring differences in newlines.
+ * Helpful for doing cross platform tests of blocks of text.
+ *
+ * @param string $expected The expected value.
+ * @param string $result The actual value.
+ * @param message The message to use for failure.
+ * @return boolean
+ */
+ public function assertTextEquals($expected, $result, $message = '') {
+ $expected = str_replace(array("\r\n", "\r"), "\n", $expected);
+ $result = str_replace(array("\r\n", "\r"), "\n", $result);
+ return $this->assertEquals($expected, $result, $message);
+ }
+
+/**
+ * Asserts that a string starts with a given prefix, ignoring differences in newlines.
+ * Helpful for doing cross platform tests of blocks of text.
+ *
+ * @param string $prefix
+ * @param string $string
+ * @param string $message
+ * @return boolean
+ */
+ public function assertTextStartsWith($prefix, $string, $message = '') {
+ $prefix = str_replace(array("\r\n", "\r"), "\n", $prefix);
+ $string = str_replace(array("\r\n", "\r"), "\n", $string);
+ return $this->assertStringStartsWith($prefix, $string, $message);
+ }
+
+/**
+ * Asserts that a string starts not with a given prefix, ignoring differences in newlines.
+ * Helpful for doing cross platform tests of blocks of text.
+ *
+ * @param string $prefix
+ * @param string $string
+ * @param string $message
+ * @return boolean
+ */
+ public function assertTextStartsNotWith($prefix, $string, $message = '') {
+ $prefix = str_replace(array("\r\n", "\r"), "\n", $prefix);
+ $string = str_replace(array("\r\n", "\r"), "\n", $string);
+ return $this->assertStringStartsNotWith($prefix, $string, $message);
+ }
+
+/**
+ * Asserts that a string ends with a given prefix, ignoring differences in newlines.
+ * Helpful for doing cross platform tests of blocks of text.
+ *
+ * @param string $suffix
+ * @param string $string
+ * @param string $message
+ * @return boolean
+ */
+ public function assertTextEndsWith($suffix, $string, $message = '') {
+ $suffix = str_replace(array("\r\n", "\r"), "\n", $suffix);
+ $string = str_replace(array("\r\n", "\r"), "\n", $string);
+ return $this->assertStringEndsWith($suffix, $string, $message);
+ }
+
+/**
+ * Asserts that a string ends not with a given prefix, ignoring differences in newlines.
+ * Helpful for doing cross platform tests of blocks of text.
+ *
+ * @param string $suffix
+ * @param string $string
+ * @param string $message
+ * @return boolean
+ */
+ public function assertTextEndsNotWith($suffix, $string, $message = '') {
+ $suffix = str_replace(array("\r\n", "\r"), "\n", $suffix);
+ $string = str_replace(array("\r\n", "\r"), "\n", $string);
+ return $this->assertStringEndsNotWith($suffix, $string, $message);
+ }
+
+/**
+ * Assert that a string contains another string, ignoring differences in newlines.
+ * Helpful for doing cross platform tests of blocks of text.
+ *
+ * @param string $needle
+ * @param string $haystack
+ * @param string $message
+ * @param boolean $ignoreCase
+ * @return boolean
+ */
+ public function assertTextContains($needle, $haystack, $message = '', $ignoreCase = false) {
+ $needle = str_replace(array("\r\n", "\r"), "\n", $needle);
+ $haystack = str_replace(array("\r\n", "\r"), "\n", $haystack);
+ return $this->assertContains($needle, $haystack, $message, $ignoreCase);
+ }
+
+/**
+ * Assert that a text doesn't contain another text, ignoring differences in newlines.
+ * Helpful for doing cross platform tests of blocks of text.
+ *
+ * @param string $needle
+ * @param string $haystack
+ * @param string $message
+ * @param boolean $ignoreCase
+ * @return boolean
+ */
+ public function assertTextNotContains($needle, $haystack, $message = '', $ignoreCase = false) {
+ $needle = str_replace(array("\r\n", "\r"), "\n", $needle);
+ $haystack = str_replace(array("\r\n", "\r"), "\n", $haystack);
+ return $this->assertNotContains($needle, $haystack, $message, $ignoreCase);
+ }
+
+/**
+ * Takes an array $expected and generates a regex from it to match the provided $string.
+ * Samples for $expected:
+ *
+ * Checks for an input tag with a name attribute (contains any non-empty value) and an id
+ * attribute that contains 'my-input':
+ * array('input' => array('name', 'id' => 'my-input'))
+ *
+ * Checks for two p elements with some text in them:
+ * array(
+ * array('p' => true),
+ * 'textA',
+ * '/p',
+ * array('p' => true),
+ * 'textB',
+ * '/p'
+ * )
+ *
+ * You can also specify a pattern expression as part of the attribute values, or the tag
+ * being defined, if you prepend the value with preg: and enclose it with slashes, like so:
+ * array(
+ * array('input' => array('name', 'id' => 'preg:/FieldName\d+/')),
+ * 'preg:/My\s+field/'
+ * )
+ *
+ * Important: This function is very forgiving about whitespace and also accepts any
+ * permutation of attribute order. It will also allow whitespace between specified tags.
+ *
+ * @param string $string An HTML/XHTML/XML string
+ * @param array $expected An array, see above
+ * @param string $message SimpleTest failure output string
+ * @return boolean
+ */
+ public function assertTags($string, $expected, $fullDebug = false) {
+ $regex = array();
+ $normalized = array();
+ foreach ((array)$expected as $key => $val) {
+ if (!is_numeric($key)) {
+ $normalized[] = array($key => $val);
+ } else {
+ $normalized[] = $val;
+ }
+ }
+ $i = 0;
+ foreach ($normalized as $tags) {
+ if (!is_array($tags)) {
+ $tags = (string)$tags;
+ }
+ $i++;
+ if (is_string($tags) && $tags{0} == '<') {
+ $tags = array(substr($tags, 1) => array());
+ } elseif (is_string($tags)) {
+ $tagsTrimmed = preg_replace('/\s+/m', '', $tags);
+
+ if (preg_match('/^\*?\//', $tags, $match) && $tagsTrimmed !== '//') {
+ $prefix = array(null, null);
+
+ if ($match[0] == '*/') {
+ $prefix = array('Anything, ', '.*?');
+ }
+ $regex[] = array(
+ sprintf('%sClose %s tag', $prefix[0], substr($tags, strlen($match[0]))),
+ sprintf('%s<[\s]*\/[\s]*%s[\s]*>[\n\r]*', $prefix[1], substr($tags, strlen($match[0]))),
+ $i,
+ );
+ continue;
+ }
+ if (!empty($tags) && preg_match('/^preg\:\/(.+)\/$/i', $tags, $matches)) {
+ $tags = $matches[1];
+ $type = 'Regex matches';
+ } else {
+ $tags = preg_quote($tags, '/');
+ $type = 'Text equals';
+ }
+ $regex[] = array(
+ sprintf('%s "%s"', $type, $tags),
+ $tags,
+ $i,
+ );
+ continue;
+ }
+ foreach ($tags as $tag => $attributes) {
+ $regex[] = array(
+ sprintf('Open %s tag', $tag),
+ sprintf('[\s]*<%s', preg_quote($tag, '/')),
+ $i,
+ );
+ if ($attributes === true) {
+ $attributes = array();
+ }
+ $attrs = array();
+ $explanations = array();
+ $i = 1;
+ foreach ($attributes as $attr => $val) {
+ if (is_numeric($attr) && preg_match('/^preg\:\/(.+)\/$/i', $val, $matches)) {
+ $attrs[] = $matches[1];
+ $explanations[] = sprintf('Regex "%s" matches', $matches[1]);
+ continue;
+ } else {
+ $quotes = '["\']';
+ if (is_numeric($attr)) {
+ $attr = $val;
+ $val = '.+?';
+ $explanations[] = sprintf('Attribute "%s" present', $attr);
+ } elseif (!empty($val) && preg_match('/^preg\:\/(.+)\/$/i', $val, $matches)) {
+ $quotes = '["\']?';
+ $val = $matches[1];
+ $explanations[] = sprintf('Attribute "%s" matches "%s"', $attr, $val);
+ } else {
+ $explanations[] = sprintf('Attribute "%s" == "%s"', $attr, $val);
+ $val = preg_quote($val, '/');
+ }
+ $attrs[] = '[\s]+' . preg_quote($attr, '/') . '=' . $quotes . $val . $quotes;
+ }
+ $i++;
+ }
+ if ($attrs) {
+ $permutations = $this->_arrayPermute($attrs);
+
+ $permutationTokens = array();
+ foreach ($permutations as $permutation) {
+ $permutationTokens[] = implode('', $permutation);
+ }
+ $regex[] = array(
+ sprintf('%s', implode(', ', $explanations)),
+ $permutationTokens,
+ $i,
+ );
+ }
+ $regex[] = array(
+ sprintf('End %s tag', $tag),
+ '[\s]*\/?[\s]*>[\n\r]*',
+ $i,
+ );
+ }
+ }
+ foreach ($regex as $i => $assertation) {
+ list($description, $expressions, $itemNum) = $assertation;
+ $matches = false;
+ foreach ((array)$expressions as $expression) {
+ if (preg_match(sprintf('/^%s/s', $expression), $string, $match)) {
+ $matches = true;
+ $string = substr($string, strlen($match[0]));
+ break;
+ }
+ }
+ if (!$matches) {
+ $this->assertTrue(false, sprintf('Item #%d / regex #%d failed: %s', $itemNum, $i, $description));
+ if ($fullDebug) {
+ debug($string, true);
+ debug($regex, true);
+ }
+ return false;
+ }
+ }
+
+ $this->assertTrue(true, '%s');
+ return true;
+ }
+
+/**
+ * Generates all permutation of an array $items and returns them in a new array.
+ *
+ * @param array $items An array of items
+ * @return array
+ */
+ protected function _arrayPermute($items, $perms = array()) {
+ static $permuted;
+ if (empty($perms)) {
+ $permuted = array();
+ }
+
+ if (empty($items)) {
+ $permuted[] = $perms;
+ } else {
+ $numItems = count($items) - 1;
+ for ($i = $numItems; $i >= 0; --$i) {
+ $newItems = $items;
+ $newPerms = $perms;
+ list($tmp) = array_splice($newItems, $i, 1);
+ array_unshift($newPerms, $tmp);
+ $this->_arrayPermute($newItems, $newPerms);
+ }
+ return $permuted;
+ }
+ }
+
+// @codingStandardsIgnoreStart
+
+/**
+ * Compatibility wrapper function for assertEquals
+ *
+ *
+ * @param mixed $result
+ * @param mixed $expected
+ * @param string $message the text to display if the assertion is not correct
+ * @return void
+ */
+ protected static function assertEqual($result, $expected, $message = '') {
+ return self::assertEquals($expected, $result, $message);
+ }
+
+/**
+ * Compatibility wrapper function for assertNotEquals
+ *
+ * @param mixed $result
+ * @param mixed $expected
+ * @param string $message the text to display if the assertion is not correct
+ * @return void
+ */
+ protected static function assertNotEqual($result, $expected, $message = '') {
+ return self::assertNotEquals($expected, $result, $message);
+ }
+
+/**
+ * Compatibility wrapper function for assertRegexp
+ *
+ * @param mixed $pattern a regular expression
+ * @param string $string the text to be matched
+ * @param string $message the text to display if the assertion is not correct
+ * @return void
+ */
+ protected static function assertPattern($pattern, $string, $message = '') {
+ return self::assertRegExp($pattern, $string, $message);
+ }
+
+/**
+ * Compatibility wrapper function for assertEquals
+ *
+ * @param mixed $actual
+ * @param mixed $expected
+ * @param string $message the text to display if the assertion is not correct
+ * @return void
+ */
+ protected static function assertIdentical($actual, $expected, $message = '') {
+ return self::assertSame($expected, $actual, $message);
+ }
+
+/**
+ * Compatibility wrapper function for assertNotEquals
+ *
+ * @param mixed $actual
+ * @param mixed $expected
+ * @param string $message the text to display if the assertion is not correct
+ * @return void
+ */
+ protected static function assertNotIdentical($actual, $expected, $message = '') {
+ return self::assertNotSame($expected, $actual, $message);
+ }
+
+/**
+ * Compatibility wrapper function for assertNotRegExp
+ *
+ * @param mixed $pattern a regular expression
+ * @param string $string the text to be matched
+ * @param string $message the text to display if the assertion is not correct
+ * @return void
+ */
+ protected static function assertNoPattern($pattern, $string, $message = '') {
+ return self::assertNotRegExp($pattern, $string, $message);
+ }
+
+ protected function assertNoErrors() {
+ }
+
+/**
+ * Compatibility wrapper function for setExpectedException
+ *
+ * @param mixed $expected the name of the Exception or error
+ * @param string $message the text to display if the assertion is not correct
+ * @return void
+ */
+ protected function expectError($expected = false, $message = '') {
+ if (!$expected) {
+ $expected = 'Exception';
+ }
+ $this->setExpectedException($expected, $message);
+ }
+
+/**
+ * Compatibility wrapper function for setExpectedException
+ *
+ * @param mixed $expected the name of the Exception
+ * @param string $message the text to display if the assertion is not correct
+ * @return void
+ */
+ protected function expectException($name = 'Exception', $message = '') {
+ $this->setExpectedException($name, $message);
+ }
+
+/**
+ * Compatibility wrapper function for assertSame
+ *
+ * @param mixed $first
+ * @param mixed $second
+ * @param string $message the text to display if the assertion is not correct
+ * @return void
+ */
+ protected static function assertReference(&$first, &$second, $message = '') {
+ return self::assertSame($first, $second, $message);
+ }
+
+/**
+ * Compatibility wrapper for assertIsA
+ *
+ * @param string $object
+ * @param string $type
+ * @param string $message
+ * @return void
+ */
+ protected static function assertIsA($object, $type, $message = '') {
+ return self::assertInstanceOf($type, $object, $message);
+ }
+
+/**
+ * Compatibility function to test if value is between an acceptable range
+ *
+ * @param mixed $result
+ * @param mixed $expected
+ * @param mixed $margin the rage of acceptation
+ * @param string $message the text to display if the assertion is not correct
+ * @return void
+ */
+ protected static function assertWithinMargin($result, $expected, $margin, $message = '') {
+ $upper = $result + $margin;
+ $lower = $result - $margin;
+ return self::assertTrue((($expected <= $upper) && ($expected >= $lower)), $message);
+ }
+
+/**
+ * Compatibility function for skipping.
+ *
+ * @param boolean $condition Condition to trigger skipping
+ * @param string $message Message for skip
+ * @return boolean
+ */
+ protected function skipUnless($condition, $message = '') {
+ if (!$condition) {
+ $this->markTestSkipped($message);
+ }
+ return $condition;
+ }
+ // @codingStandardsIgnoreStop
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestLoader.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestLoader.php
new file mode 100644
index 0000000..83a3607
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestLoader.php
@@ -0,0 +1,123 @@
+<?php
+/**
+ * TestLoader for CakePHP Test suite.
+ *
+ * Turns partial paths used on the testsuite console and web UI into full file paths.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
+ * @since CakePHP(tm) v 2.0
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ * @package Cake.TestSuite
+ */
+
+/**
+ * TestLoader for CakePHP Test suite.
+ *
+ * Turns partial paths used on the testsuite console and web UI into full file paths.
+ *
+ * @package Cake.TestSuite
+ */
+class CakeTestLoader extends PHPUnit_Runner_StandardTestSuiteLoader {
+
+/**
+ * Load a file and find the first test case / suite in that file.
+ *
+ * @param string $filePath
+ * @param string $params
+ * @return ReflectionClass
+ */
+ public function load($filePath, $params = '') {
+ $file = $this->_resolveTestFile($filePath, $params);
+ return parent::load('', $file);
+ }
+
+/**
+ * Convert path fragments used by Cake's test runner to absolute paths that can be fed to PHPUnit.
+ *
+ * @return void
+ */
+ protected function _resolveTestFile($filePath, $params) {
+ $basePath = $this->_basePath($params) . DS . $filePath;
+ $ending = 'Test.php';
+ return (strpos($basePath, $ending) === (strlen($basePath) - strlen($ending))) ? $basePath : $basePath . $ending;
+ }
+
+/**
+ * Generates the base path to a set of tests based on the parameters.
+ *
+ * @param array $params
+ * @return string The base path.
+ */
+ protected static function _basePath($params) {
+ $result = null;
+ if (!empty($params['core'])) {
+ $result = CORE_TEST_CASES;
+ } elseif (!empty($params['plugin'])) {
+ if (!CakePlugin::loaded($params['plugin'])) {
+ try {
+ CakePlugin::load($params['plugin']);
+ $result = CakePlugin::path($params['plugin']) . 'Test' . DS . 'Case';
+ } catch (MissingPluginException $e) {
+ }
+ } else {
+ $result = CakePlugin::path($params['plugin']) . 'Test' . DS . 'Case';
+ }
+ } elseif (!empty($params['app'])) {
+ $result = APP_TEST_CASES;
+ }
+ return $result;
+ }
+
+/**
+ * Get the list of files for the test listing.
+ *
+ * @return void
+ */
+ public static function generateTestList($params) {
+ $directory = self::_basePath($params);
+ $fileList = self::_getRecursiveFileList($directory);
+
+ $testCases = array();
+ foreach ($fileList as $testCaseFile) {
+ $case = str_replace($directory . DS, '', $testCaseFile);
+ $case = str_replace('Test.php', '', $case);
+ $testCases[$testCaseFile] = $case;
+ }
+ sort($testCases);
+ return $testCases;
+ }
+
+/**
+ * Gets a recursive list of files from a given directory and matches then against
+ * a given fileTestFunction, like isTestCaseFile()
+ *
+ * @param string $directory The directory to scan for files.
+ * @param mixed $fileTestFunction
+ */
+ protected static function _getRecursiveFileList($directory = '.') {
+ $fileList = array();
+ if (!is_dir($directory)) {
+ return $fileList;
+ }
+
+ $files = new RegexIterator(
+ new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)),
+ '/.*Test.php$/'
+ );
+
+ foreach ($files as $file) {
+ $fileList[] = $file->getPathname();
+ }
+ return $fileList;
+ }
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestRunner.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestRunner.php
new file mode 100644
index 0000000..e2f39cd
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestRunner.php
@@ -0,0 +1,103 @@
+<?php
+/**
+ * TestRunner for CakePHP Test suite.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
+ * @since CakePHP(tm) v 2.0
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+require_once 'PHPUnit/TextUI/TestRunner.php';
+
+/**
+ * A custom test runner for Cake's use of PHPUnit.
+ *
+ * @package Cake.TestSuite
+ */
+class CakeTestRunner extends PHPUnit_TextUI_TestRunner {
+
+/**
+ * Lets us pass in some options needed for cake's webrunner.
+ *
+ * @return void
+ */
+ public function __construct($loader, $params) {
+ parent::__construct($loader);
+ $this->_params = $params;
+ }
+
+/**
+ * Actually run a suite of tests. Cake initializes fixtures here using the chosen fixture manager
+ *
+ * @param PHPUnit_Framework_Test $suite
+ * @param array $arguments
+ * @return void
+ */
+ public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array()) {
+ if (isset($arguments['printer'])) {
+ self::$versionStringPrinted = true;
+ }
+
+ $fixture = $this->_getFixtureManager($arguments);
+ foreach ($suite->getIterator() as $test) {
+ if ($test instanceof CakeTestCase) {
+ $fixture->fixturize($test);
+ $test->fixtureManager = $fixture;
+ }
+ }
+
+ $return = parent::doRun($suite, $arguments);
+ $fixture->shutdown();
+ return $return;
+ }
+
+// @codingStandardsIgnoreStart PHPUnit overrides don't match CakePHP
+/**
+ * Create the test result and splice on our code coverage reports.
+ *
+ * @return PHPUnit_Framework_TestResult
+ */
+ protected function createTestResult() {
+ $result = new PHPUnit_Framework_TestResult;
+ if (!empty($this->_params['codeCoverage'])) {
+ if (method_exists($result, 'collectCodeCoverageInformation')) {
+ $result->collectCodeCoverageInformation(true);
+ }
+ if (method_exists($result, 'setCodeCoverage')) {
+ $result->setCodeCoverage(new PHP_CodeCoverage());
+ }
+ }
+ return $result;
+ }
+// @codingStandardsIgnoreEnd
+
+/**
+ * Get the fixture manager class specified or use the default one.
+ *
+ * @return instance of a fixture manager.
+ * @throws RuntimeException When fixture manager class cannot be loaded.
+ */
+ protected function _getFixtureManager($arguments) {
+ if (isset($arguments['fixtureManager'])) {
+ App::uses($arguments['fixtureManager'], 'TestSuite');
+ if (class_exists($arguments['fixtureManager'])) {
+ return new $arguments['fixtureManager'];
+ }
+ throw new RuntimeException(__d('cake_dev', 'Could not find fixture manager %s.', $arguments['fixtureManager']));
+ }
+ App::uses('AppFixtureManager', 'TestSuite');
+ if (class_exists('AppFixtureManager')) {
+ return new AppFixtureManager();
+ }
+ return new CakeFixtureManager();
+ }
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestSuite.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestSuite.php
new file mode 100644
index 0000000..ca478a0
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestSuite.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * A class to contain test cases and run them with shared fixtures
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
+ * @package Cake.TestSuite
+ * @since CakePHP(tm) v 2.0
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+App::uses('Folder', 'Utility');
+
+/**
+ * A class to contain test cases and run them with shared fixtures
+ *
+ * @package Cake.TestSuite
+ */
+class CakeTestSuite extends PHPUnit_Framework_TestSuite {
+
+/**
+ * Adds all the files in a directory to the test suite. Does not recurse through directories.
+ *
+ * @param string $directory The directory to add tests from.
+ * @return void
+ */
+ public function addTestDirectory($directory = '.') {
+ $Folder = new Folder($directory);
+ list($dirs, $files) = $Folder->read(true, true, true);
+
+ foreach ($files as $file) {
+ if (substr($file, -4) === '.php') {
+ $this->addTestFile($file);
+ }
+ }
+ }
+
+/**
+ * Recursively adds all the files in a directory to the test suite.
+ *
+ * @param string $directory The directory subtree to add tests from.
+ * @return void
+ */
+ public function addTestDirectoryRecursive($directory = '.') {
+ $Folder = new Folder($directory);
+ $files = $Folder->tree(null, true, 'files');
+
+ foreach ($files as $file) {
+ if (substr($file, -4) === '.php') {
+ $this->addTestFile($file);
+ }
+ }
+ }
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestSuiteCommand.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestSuiteCommand.php
new file mode 100644
index 0000000..6d410ec
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestSuiteCommand.php
@@ -0,0 +1,171 @@
+<?php
+/**
+ * TestRunner for CakePHP Test suite.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
+ * @package Cake.TestSuite
+ * @since CakePHP(tm) v 2.0
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+require_once 'PHPUnit/TextUI/Command.php';
+
+App::uses('CakeTestRunner', 'TestSuite');
+App::uses('CakeTestLoader', 'TestSuite');
+App::uses('CakeTestSuite', 'TestSuite');
+App::uses('CakeTestCase', 'TestSuite');
+App::uses('ControllerTestCase', 'TestSuite');
+App::uses('CakeTestModel', 'TestSuite/Fixture');
+
+/**
+ * Class to customize loading of test suites from CLI
+ *
+ * @package Cake.TestSuite
+ */
+class CakeTestSuiteCommand extends PHPUnit_TextUI_Command {
+
+/**
+ * Construct method
+ *
+ * @param array $params list of options to be used for this run
+ * @throws MissingTestLoaderException When a loader class could not be found.
+ */
+ public function __construct($loader, $params = array()) {
+ if ($loader && !class_exists($loader)) {
+ throw new MissingTestLoaderException(array('class' => $loader));
+ }
+ $this->arguments['loader'] = $loader;
+ $this->arguments['test'] = $params['case'];
+ $this->arguments['testFile'] = $params;
+ $this->_params = $params;
+
+ $this->longOptions['fixture='] = 'handleFixture';
+ $this->longOptions['output='] = 'handleReporter';
+ }
+
+/**
+ * Ugly hack to get around PHPUnit having a hard coded classname for the Runner. :(
+ *
+ * @param array $argv
+ * @param boolean $exit
+ */
+ public function run(array $argv, $exit = true) {
+ $this->handleArguments($argv);
+
+ $runner = $this->getRunner($this->arguments['loader']);
+
+ if (is_object($this->arguments['test']) &&
+ $this->arguments['test'] instanceof PHPUnit_Framework_Test) {
+ $suite = $this->arguments['test'];
+ } else {
+ $suite = $runner->getTest(
+ $this->arguments['test'],
+ $this->arguments['testFile']
+ );
+ }
+
+ if (count($suite) == 0) {
+ $skeleton = new PHPUnit_Util_Skeleton_Test(
+ $suite->getName(),
+ $this->arguments['testFile']
+ );
+
+ $result = $skeleton->generate(true);
+
+ if (!$result['incomplete']) {
+ eval(str_replace(array('<?php', '?>'), '', $result['code']));
+ $suite = new PHPUnit_Framework_TestSuite(
+ $this->arguments['test'] . 'Test'
+ );
+ }
+ }
+
+ if ($this->arguments['listGroups']) {
+ PHPUnit_TextUI_TestRunner::printVersionString();
+
+ print "Available test group(s):\n";
+
+ $groups = $suite->getGroups();
+ sort($groups);
+
+ foreach ($groups as $group) {
+ print " - $group\n";
+ }
+
+ exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
+ }
+
+ unset($this->arguments['test']);
+ unset($this->arguments['testFile']);
+
+ try {
+ $result = $runner->doRun($suite, $this->arguments);
+ } catch (PHPUnit_Framework_Exception $e) {
+ print $e->getMessage() . "\n";
+ }
+
+ if ($exit) {
+ if (isset($result) && $result->wasSuccessful()) {
+ exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
+ } elseif (!isset($result) || $result->errorCount() > 0) {
+ exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
+ } else {
+ exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
+ }
+ }
+ }
+
+/**
+ * Create a runner for the command.
+ *
+ * @param $loader The loader to be used for the test run.
+ * @return CakeTestRunner
+ */
+ public function getRunner($loader) {
+ return new CakeTestRunner($loader, $this->_params);
+ }
+
+/**
+ * Handler for customizing the FixtureManager class/
+ *
+ * @param string $class Name of the class that will be the fixture manager
+ * @return void
+ */
+ public function handleFixture($class) {
+ $this->arguments['fixtureManager'] = $class;
+ }
+
+/**
+ * Handles output flag used to change printing on webrunner.
+ *
+ * @return void
+ */
+ public function handleReporter($reporter) {
+ $object = null;
+
+ $type = strtolower($reporter);
+ $reporter = ucwords($reporter);
+ $coreClass = 'Cake' . $reporter . 'Reporter';
+ App::uses($coreClass, 'TestSuite/Reporter');
+
+ $appClass = $reporter . 'Reporter';
+ App::uses($appClass, 'TestSuite/Reporter');
+
+ if (!class_exists($appClass)) {
+ $object = new $coreClass(null, $this->_params);
+ } else {
+ $object = new $appClass(null, $this->_params);
+ }
+ return $this->arguments['printer'] = $object;
+ }
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php
new file mode 100644
index 0000000..20adfbf
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php
@@ -0,0 +1,276 @@
+<?php
+/**
+ * CakeTestSuiteDispatcher controls dispatching TestSuite web based requests.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
+ * @package Cake.TestSuite
+ * @since CakePHP(tm) v 1.3
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+define('CORE_TEST_CASES', CAKE . 'Test' . DS . 'Case');
+define('APP_TEST_CASES', TESTS . 'Case');
+
+App::uses('CakeTestSuiteCommand', 'TestSuite');
+
+/**
+ * CakeTestSuiteDispatcher handles web requests to the test suite and runs the correct action.
+ *
+ * @package Cake.TestSuite
+ */
+class CakeTestSuiteDispatcher {
+
+/**
+ * 'Request' parameters
+ *
+ * @var array
+ */
+ public $params = array(
+ 'codeCoverage' => false,
+ 'case' => null,
+ 'core' => false,
+ 'app' => true,
+ 'plugin' => null,
+ 'output' => 'html',
+ 'show' => 'groups',
+ 'show_passes' => false,
+ 'filter' => false,
+ 'fixture' => null
+ );
+
+/**
+ * Baseurl for the request
+ *
+ * @var string
+ */
+ protected $_baseUrl;
+
+/**
+ * Base dir of the request. Used for accessing assets.
+ *
+ * @var string
+ */
+ protected $_baseDir;
+
+/**
+ * boolean to set auto parsing of params.
+ *
+ * @var boolean
+ */
+ protected $_paramsParsed = false;
+
+/**
+ * reporter instance used for the request
+ *
+ * @var CakeBaseReporter
+ */
+ protected static $_Reporter = null;
+
+/**
+ * constructor
+ *
+ * @return void
+ */
+ public function __construct() {
+ $this->_baseUrl = $_SERVER['PHP_SELF'];
+ $dir = rtrim(dirname($this->_baseUrl), '\\');
+ $this->_baseDir = ($dir === '/') ? $dir : $dir . '/';
+ }
+
+/**
+ * Runs the actions required by the URL parameters.
+ *
+ * @return void
+ */
+ public function dispatch() {
+ $this->_checkPHPUnit();
+ $this->_parseParams();
+
+ if ($this->params['case']) {
+ $value = $this->_runTestCase();
+ } else {
+ $value = $this->_testCaseList();
+ }
+
+ $output = ob_get_clean();
+ echo $output;
+ return $value;
+ }
+
+/**
+ * Static method to initialize the test runner, keeps global space clean
+ *
+ * @return void
+ */
+ public static function run() {
+ $dispatcher = new CakeTestSuiteDispatcher();
+ $dispatcher->dispatch();
+ }
+
+/**
+ * Checks that PHPUnit is installed. Will exit if it doesn't
+ *
+ * @return void
+ */
+ protected function _checkPHPUnit() {
+ $found = $this->loadTestFramework();
+ if (!$found) {
+ $baseDir = $this->_baseDir;
+ include CAKE . 'TestSuite' . DS . 'templates' . DS . 'phpunit.php';
+ exit();
+ }
+ }
+
+/**
+ * Checks for the existence of the test framework files
+ *
+ * @return boolean true if found, false otherwise
+ */
+ public function loadTestFramework() {
+ foreach (App::path('vendors') as $vendor) {
+ if (is_dir($vendor . 'PHPUnit')) {
+ ini_set('include_path', $vendor . PATH_SEPARATOR . ini_get('include_path'));
+ break;
+ }
+ }
+
+ return include 'PHPUnit' . DS . 'Autoload.php';
+ }
+
+/**
+ * Checks for the xdebug extension required to do code coverage. Displays an error
+ * if xdebug isn't installed.
+ *
+ * @return void
+ */
+ protected function _checkXdebug() {
+ if (!extension_loaded('xdebug')) {
+ $baseDir = $this->_baseDir;
+ include CAKE . 'TestSuite' . DS . 'templates' . DS . 'xdebug.php';
+ exit();
+ }
+ }
+
+/**
+ * Generates a page containing the a list of test cases that could be run.
+ *
+ * @return void
+ */
+ protected function _testCaseList() {
+ $command = new CakeTestSuiteCommand('', $this->params);
+ $Reporter = $command->handleReporter($this->params['output']);
+ $Reporter->paintDocumentStart();
+ $Reporter->paintTestMenu();
+ $Reporter->testCaseList();
+ $Reporter->paintDocumentEnd();
+ }
+
+/**
+ * Sets the params, calling this will bypass the auto parameter parsing.
+ *
+ * @param array $params Array of parameters for the dispatcher
+ * @return void
+ */
+ public function setParams($params) {
+ $this->params = $params;
+ $this->_paramsParsed = true;
+ }
+
+/**
+ * Parse url params into a 'request'
+ *
+ * @return void
+ */
+ protected function _parseParams() {
+ if (!$this->_paramsParsed) {
+ if (!isset($_SERVER['SERVER_NAME'])) {
+ $_SERVER['SERVER_NAME'] = '';
+ }
+ foreach ($this->params as $key => $value) {
+ if (isset($_GET[$key])) {
+ $this->params[$key] = $_GET[$key];
+ }
+ }
+ if (isset($_GET['code_coverage'])) {
+ $this->params['codeCoverage'] = true;
+ $this->_checkXdebug();
+ }
+ }
+ if (empty($this->params['plugin']) && empty($this->params['core'])) {
+ $this->params['app'] = true;
+ }
+ $this->params['baseUrl'] = $this->_baseUrl;
+ $this->params['baseDir'] = $this->_baseDir;
+ }
+
+/**
+ * Runs a test case file.
+ *
+ * @return void
+ */
+ protected function _runTestCase() {
+ $commandArgs = array(
+ 'case' => $this->params['case'],
+ 'core' => $this->params['core'],
+ 'app' => $this->params['app'],
+ 'plugin' => $this->params['plugin'],
+ 'codeCoverage' => $this->params['codeCoverage'],
+ 'showPasses' => !empty($this->params['show_passes']),
+ 'baseUrl' => $this->_baseUrl,
+ 'baseDir' => $this->_baseDir,
+ );
+
+ $options = array(
+ '--filter', $this->params['filter'],
+ '--output', $this->params['output'],
+ '--fixture', $this->params['fixture']
+ );
+ restore_error_handler();
+
+ try {
+ self::time();
+ $command = new CakeTestSuiteCommand('CakeTestLoader', $commandArgs);
+ $result = $command->run($options);
+ } catch (MissingConnectionException $exception) {
+ ob_end_clean();
+ $baseDir = $this->_baseDir;
+ include CAKE . 'TestSuite' . DS . 'templates' . DS . 'missing_connection.php';
+ exit();
+ }
+ }
+
+/**
+ * Sets a static timestamp
+ *
+ * @param boolean $reset to set new static timestamp.
+ * @return integer timestamp
+ */
+ public static function time($reset = false) {
+ static $now;
+ if ($reset || !$now) {
+ $now = time();
+ }
+ return $now;
+ }
+
+/**
+ * Returns formatted date string using static time
+ * This method is being used as formatter for created, modified and updated fields in Model::save()
+ *
+ * @param string $format format to be used.
+ * @return string formatted date
+ */
+ public static function date($format) {
+ return date($format, self::time());
+ }
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/ControllerTestCase.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/ControllerTestCase.php
new file mode 100644
index 0000000..d6002f0
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/ControllerTestCase.php
@@ -0,0 +1,378 @@
+<?php
+/**
+ * ControllerTestCase file
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
+ * @package Cake.TestSuite
+ * @since CakePHP(tm) v 2.0
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+App::uses('Dispatcher', 'Routing');
+App::uses('CakeTestCase', 'TestSuite');
+App::uses('Router', 'Routing');
+App::uses('CakeRequest', 'Network');
+App::uses('CakeResponse', 'Network');
+App::uses('Helper', 'View');
+App::uses('CakeEvent', 'Event');
+
+/**
+ * ControllerTestDispatcher class
+ *
+ * @package Cake.TestSuite
+ */
+class ControllerTestDispatcher extends Dispatcher {
+
+/**
+ * The controller to use in the dispatch process
+ *
+ * @var Controller
+ */
+ public $testController = null;
+
+/**
+ * Use custom routes during tests
+ *
+ * @var boolean
+ */
+ public $loadRoutes = true;
+
+/**
+ * Returns the test controller
+ *
+ * @return Controller
+ */
+ protected function _getController($request, $response) {
+ if ($this->testController === null) {
+ $this->testController = parent::_getController($request, $response);
+ }
+ $this->testController->helpers = array_merge(array('InterceptContent'), $this->testController->helpers);
+ $this->testController->setRequest($request);
+ $this->testController->response = $this->response;
+ foreach ($this->testController->Components->attached() as $component) {
+ $object = $this->testController->Components->{$component};
+ if (isset($object->response)) {
+ $object->response = $response;
+ }
+ if (isset($object->request)) {
+ $object->request = $request;
+ }
+ }
+ return $this->testController;
+ }
+
+/**
+ * Loads routes and resets if the test case dictates it should
+ *
+ * @return void
+ */
+ protected function _loadRoutes() {
+ parent::_loadRoutes();
+ if (!$this->loadRoutes) {
+ Router::reload();
+ }
+ }
+
+}
+
+/**
+ * InterceptContentHelper class
+ *
+ * @package Cake.TestSuite
+ */
+class InterceptContentHelper extends Helper {
+
+/**
+ * Intercepts and stores the contents of the view before the layout is rendered
+ *
+ * @param string $viewFile The view file
+ */
+ public function afterRender($viewFile) {
+ $this->_View->assign('__view_no_layout__', $this->_View->fetch('content'));
+ $this->_View->Helpers->unload('InterceptContent');
+ }
+
+}
+
+/**
+ * ControllerTestCase class
+ *
+ * @package Cake.TestSuite
+ */
+abstract class ControllerTestCase extends CakeTestCase {
+
+/**
+ * The controller to test in testAction
+ *
+ * @var Controller
+ */
+ public $controller = null;
+
+/**
+ * Automatically mock controllers that aren't mocked
+ *
+ * @var boolean
+ */
+ public $autoMock = true;
+
+/**
+ * Use custom routes during tests
+ *
+ * @var boolean
+ */
+ public $loadRoutes = true;
+
+/**
+ * The resulting view vars of the last testAction call
+ *
+ * @var array
+ */
+ public $vars = null;
+
+/**
+ * The resulting rendered view of the last testAction call
+ *
+ * @var string
+ */
+ public $view = null;
+
+/**
+ * The resulting rendered layout+view of the last testAction call
+ *
+ * @var string
+ */
+ public $contents = null;
+
+/**
+ * The returned result of the dispatch (requestAction), if any
+ *
+ * @var string
+ */
+ public $result = null;
+
+/**
+ * The headers that would have been sent by the action
+ *
+ * @var string
+ */
+ public $headers = null;
+
+/**
+ * Flag for checking if the controller instance is dirty.
+ * Once a test has been run on a controller it should be rebuilt
+ * to clean up properties.
+ *
+ * @var boolean
+ */
+ private $__dirtyController = false;
+
+/**
+ * Used to enable calling ControllerTestCase::testAction() without the testing
+ * framework thinking that it's a test case
+ *
+ * @param string $name The name of the function
+ * @param array $arguments Array of arguments
+ * @return Function
+ */
+ public function __call($name, $arguments) {
+ if ($name == 'testAction') {
+ return call_user_func_array(array($this, '_testAction'), $arguments);
+ }
+ }
+
+/**
+ * Lets you do functional tests of a controller action.
+ *
+ * ### Options:
+ *
+ * - `data` Will be used as the request data. If the `method` is GET,
+ * data will be used a GET params. If the `method` is POST, it will be used
+ * as POST data. By setting `$options['data']` to a string, you can simulate XML or JSON
+ * payloads to your controllers allowing you to test REST webservices.
+ * - `method` POST or GET. Defaults to POST.
+ * - `return` Specify the return type you want. Choose from:
+ * - `vars` Get the set view variables.
+ * - `view` Get the rendered view, without a layout.
+ * - `contents` Get the rendered view including the layout.
+ * - `result` Get the return value of the controller action. Useful
+ * for testing requestAction methods.
+ *
+ * @param string $url The url to test
+ * @param array $options See options
+ */
+ protected function _testAction($url = '', $options = array()) {
+ $this->vars = $this->result = $this->view = $this->contents = $this->headers = null;
+
+ $options = array_merge(array(
+ 'data' => array(),
+ 'method' => 'POST',
+ 'return' => 'result'
+ ), $options);
+
+ $restore = array('get' => $_GET, 'post' => $_POST);
+
+ $_SERVER['REQUEST_METHOD'] = strtoupper($options['method']);
+ if (is_array($options['data'])) {
+ if (strtoupper($options['method']) == 'GET') {
+ $_GET = $options['data'];
+ $_POST = array();
+ } else {
+ $_POST = $options['data'];
+ $_GET = array();
+ }
+ }
+ $request = $this->getMock('CakeRequest', array('_readInput'), array($url));
+
+ if (is_string($options['data'])) {
+ $request->expects($this->any())
+ ->method('_readInput')
+ ->will($this->returnValue($options['data']));
+ }
+
+ $Dispatch = new ControllerTestDispatcher();
+ foreach (Router::$routes as $route) {
+ if ($route instanceof RedirectRoute) {
+ $route->response = $this->getMock('CakeResponse', array('send'));
+ }
+ }
+ $Dispatch->loadRoutes = $this->loadRoutes;
+ $Dispatch->parseParams(new CakeEvent('ControllerTestCase', $Dispatch, array('request' => $request)));
+ if (!isset($request->params['controller'])) {
+ $this->headers = Router::currentRoute()->response->header();
+ return;
+ }
+ if ($this->__dirtyController) {
+ $this->controller = null;
+ }
+
+ $plugin = empty($request->params['plugin']) ? '' : Inflector::camelize($request->params['plugin']) . '.';
+ if ($this->controller === null && $this->autoMock) {
+ $this->generate($plugin . Inflector::camelize($request->params['controller']));
+ }
+ $params = array();
+ if ($options['return'] == 'result') {
+ $params['return'] = 1;
+ $params['bare'] = 1;
+ $params['requested'] = 1;
+ }
+ $Dispatch->testController = $this->controller;
+ $Dispatch->response = $this->getMock('CakeResponse', array('send'));
+ $this->result = $Dispatch->dispatch($request, $Dispatch->response, $params);
+ $this->controller = $Dispatch->testController;
+ $this->vars = $this->controller->viewVars;
+ $this->contents = $this->controller->response->body();
+ if (isset($this->controller->View)) {
+ $this->view = $this->controller->View->fetch('__view_no_layout__');
+ }
+ $this->__dirtyController = true;
+ $this->headers = $Dispatch->response->header();
+
+ $_GET = $restore['get'];
+ $_POST = $restore['post'];
+
+ return $this->{$options['return']};
+ }
+
+/**
+ * Generates a mocked controller and mocks any classes passed to `$mocks`. By
+ * default, `_stop()` is stubbed as is sending the response headers, so to not
+ * interfere with testing.
+ *
+ * ### Mocks:
+ *
+ * - `methods` Methods to mock on the controller. `_stop()` is mocked by default
+ * - `models` Models to mock. Models are added to the ClassRegistry so they any
+ * time they are instantiated the mock will be created. Pass as key value pairs
+ * with the value being specific methods on the model to mock. If `true` or
+ * no value is passed, the entire model will be mocked.
+ * - `components` Components to mock. Components are only mocked on this controller
+ * and not within each other (i.e., components on components)
+ *
+ * @param string $controller Controller name
+ * @param array $mocks List of classes and methods to mock
+ * @return Controller Mocked controller
+ * @throws MissingControllerException When controllers could not be created.
+ * @throws MissingComponentException When components could not be created.
+ */
+ public function generate($controller, $mocks = array()) {
+ list($plugin, $controller) = pluginSplit($controller);
+ if ($plugin) {
+ App::uses($plugin . 'AppController', $plugin . '.Controller');
+ $plugin .= '.';
+ }
+ App::uses($controller . 'Controller', $plugin . 'Controller');
+ if (!class_exists($controller . 'Controller')) {
+ throw new MissingControllerException(array(
+ 'class' => $controller . 'Controller',
+ 'plugin' => substr($plugin, 0, -1)
+ ));
+ }
+ ClassRegistry::flush();
+
+ $mocks = array_merge_recursive(array(
+ 'methods' => array('_stop'),
+ 'models' => array(),
+ 'components' => array()
+ ), (array)$mocks);
+
+ list($plugin, $name) = pluginSplit($controller);
+ $_controller = $this->getMock($name . 'Controller', $mocks['methods'], array(), '', false);
+ $_controller->name = $name;
+ $request = $this->getMock('CakeRequest');
+ $response = $this->getMock('CakeResponse', array('_sendHeader'));
+ $_controller->__construct($request, $response);
+
+ $config = ClassRegistry::config('Model');
+ foreach ($mocks['models'] as $model => $methods) {
+ if (is_string($methods)) {
+ $model = $methods;
+ $methods = true;
+ }
+ if ($methods === true) {
+ $methods = array();
+ }
+ ClassRegistry::init($model);
+ list($plugin, $name) = pluginSplit($model);
+ $config = array_merge((array)$config, array('name' => $model));
+ $_model = $this->getMock($name, $methods, array($config));
+ ClassRegistry::removeObject($name);
+ ClassRegistry::addObject($name, $_model);
+ }
+
+ foreach ($mocks['components'] as $component => $methods) {
+ if (is_string($methods)) {
+ $component = $methods;
+ $methods = true;
+ }
+ if ($methods === true) {
+ $methods = array();
+ }
+ list($plugin, $name) = pluginSplit($component, true);
+ $componentClass = $name . 'Component';
+ App::uses($componentClass, $plugin . 'Controller/Component');
+ if (!class_exists($componentClass)) {
+ throw new MissingComponentException(array(
+ 'class' => $componentClass
+ ));
+ }
+ $_component = $this->getMock($componentClass, $methods, array(), '', false);
+ $_controller->Components->set($name, $_component);
+ }
+
+ $_controller->constructClasses();
+ $this->__dirtyController = false;
+
+ $this->controller = $_controller;
+ return $this->controller;
+ }
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Coverage/BaseCoverageReport.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Coverage/BaseCoverageReport.php
new file mode 100644
index 0000000..0cf23e8
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Coverage/BaseCoverageReport.php
@@ -0,0 +1,179 @@
+<?php
+/**
+ * Abstract class for common CoverageReport methods.
+ * Provides several template methods for custom output.
+ *
+ * PHP5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
+ * @package Cake.TestSuite.Coverage
+ * @since CakePHP(tm) v 2.0
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+/**
+ * Abstract class for common CoverageReport methods.
+ * Provides several template methods for custom output.
+ *
+ * @package Cake.TestSuite.Coverage
+ */
+abstract class BaseCoverageReport {
+
+/**
+ * coverage data
+ *
+ * @var string
+ */
+ protected $_rawCoverage;
+
+/**
+ * is the test an app test
+ *
+ * @var string
+ */
+ public $appTest = false;
+
+/**
+ * is the test a plugin test
+ *
+ * @var string
+ */
+ public $pluginTest = false;
+
+/**
+ * Array of test case file names. Used to do basename() matching with
+ * files that have coverage to decide which results to show on page load.
+ *
+ * @var array
+ */
+ protected $_testNames = array();
+
+/**
+ * Constructor
+ *
+ * @param array $coverage Array of coverage data from PHPUnit_Test_Result
+ * @param CakeBaseReporter $reporter A reporter to use for the coverage report.
+ * @return void
+ */
+ public function __construct($coverage, CakeBaseReporter $reporter) {
+ $this->_rawCoverage = $coverage;
+ $this->_setParams($reporter);
+ }
+
+/**
+ * Pulls params out of the reporter.
+ *
+ * @param CakeBaseReporter $reporter Reporter to suck params out of.
+ * @return void
+ */
+ protected function _setParams(CakeBaseReporter $reporter) {
+ if ($reporter->params['app']) {
+ $this->appTest = true;
+ }
+ if ($reporter->params['plugin']) {
+ $this->pluginTest = Inflector::camelize($reporter->params['plugin']);
+ }
+ }
+
+/**
+ * Set the coverage data array
+ *
+ * @param array $coverage Coverage data to use.
+ * @return void
+ */
+ public function setCoverage($coverage) {
+ $this->_rawCoverage = $coverage;
+ }
+
+/**
+ * Gets the base path that the files we are interested in live in.
+ *
+ * @return void
+ */
+ public function getPathFilter() {
+ $path = ROOT . DS;
+ if ($this->appTest) {
+ $path .= APP_DIR . DS;
+ } elseif ($this->pluginTest) {
+ $path = App::pluginPath($this->pluginTest);
+ } else {
+ $path = CAKE;
+ }
+ return $path;
+ }
+
+/**
+ * Filters the coverage data by path. Files not in the provided path will be removed.
+ *
+ * @param string $path Path to filter files by.
+ * @return array Array of coverage data for files that match the given path.
+ */
+ public function filterCoverageDataByPath($path) {
+ $files = array();
+ foreach ($this->_rawCoverage as $fileName => $fileCoverage) {
+ if (strpos($fileName, $path) !== 0) {
+ continue;
+ }
+ $files[$fileName] = $fileCoverage;
+ }
+ return $files;
+ }
+
+/**
+ * Calculates how many lines are covered and what the total number of executable lines is.
+ *
+ * Handles both PHPUnit3.5 and 3.6 formats.
+ *
+ * 3.5 uses -1 for uncovered, and -2 for dead.
+ * 3.6 uses array() for uncovered and null for dead.
+ *
+ * @param array $fileLines
+ * @param array $coverageData
+ * @return array. Array of covered, total lines.
+ */
+ protected function _calculateCoveredLines($fileLines, $coverageData) {
+ $covered = $total = 0;
+
+ //shift line numbers forward one
+ array_unshift($fileLines, ' ');
+ unset($fileLines[0]);
+
+ foreach ($fileLines as $lineno => $line) {
+ if (!isset($coverageData[$lineno])) {
+ continue;
+ }
+ if (is_array($coverageData[$lineno]) && !empty($coverageData[$lineno])) {
+ $covered++;
+ $total++;
+ } elseif ($coverageData[$lineno] === -1 || $coverageData[$lineno] === array()) {
+ $total++;
+ }
+ }
+ return array($covered, $total);
+ }
+
+/**
+ * Generates report to display.
+ *
+ * @return string compiled html report.
+ */
+ abstract public function report();
+
+/**
+ * Generates an coverage 'diff' for $file based on $coverageData.
+ *
+ * @param string $filename Name of the file having coverage generated
+ * @param array $fileLines File data as an array. See file() for how to get one of these.
+ * @param array $coverageData Array of coverage data to use to generate HTML diffs with
+ * @return string prepared report for a single file.
+ */
+ abstract public function generateDiff($filename, $fileLines, $coverageData);
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php
new file mode 100644
index 0000000..8706888
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php
@@ -0,0 +1,201 @@
+<?php
+/**
+ * Generates code coverage reports in HTML from data obtained from PHPUnit
+ *
+ * PHP5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
+ * @package Cake.TestSuite.Coverage
+ * @since CakePHP(tm) v 2.0
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+App::uses('BaseCoverageReport', 'TestSuite/Coverage');
+
+/**
+ * Generates code coverage reports in HTML from data obtained from PHPUnit
+ *
+ * @package Cake.TestSuite.Coverage
+ */
+class HtmlCoverageReport extends BaseCoverageReport {
+
+/**
+ * Generates report html to display.
+ *
+ * @return string compiled html report.
+ */
+ public function report() {
+ $pathFilter = $this->getPathFilter();
+ $coverageData = $this->filterCoverageDataByPath($pathFilter);
+ if (empty($coverageData)) {
+ return '<h3>No files to generate coverage for</h3>';
+ }
+ $output = $this->coverageScript();
+ $output .= <<<HTML
+ <h3>Code coverage results
+ <a href="#" onclick="coverage_toggle_all()" class="coverage-toggle">Toggle all files</a>
+ </h3>
+HTML;
+ foreach ($coverageData as $file => $coverageData) {
+ $fileData = file($file);
+ $output .= $this->generateDiff($file, $fileData, $coverageData);
+ }
+ return $output;
+ }
+
+/**
+ * Generates an HTML diff for $file based on $coverageData.
+ *
+ * Handles both PHPUnit3.5 and 3.6 formats.
+ *
+ * 3.5 uses -1 for uncovered, and -2 for dead.
+ * 3.6 uses array() for uncovered and null for dead.
+ *
+ * @param string $filename Name of the file having coverage generated
+ * @param array $fileLines File data as an array. See file() for how to get one of these.
+ * @param array $coverageData Array of coverage data to use to generate HTML diffs with
+ * @return string HTML diff.
+ */
+ public function generateDiff($filename, $fileLines, $coverageData) {
+ $output = '';
+ $diff = array();
+
+ list($covered, $total) = $this->_calculateCoveredLines($fileLines, $coverageData);
+
+ //shift line numbers forward one;
+ array_unshift($fileLines, ' ');
+ unset($fileLines[0]);
+
+ foreach ($fileLines as $lineno => $line) {
+ $class = 'ignored';
+ $coveringTests = array();
+ if (!empty($coverageData[$lineno]) && is_array($coverageData[$lineno])) {
+ $coveringTests = array();
+ foreach ($coverageData[$lineno] as $test) {
+ $class = (is_array($test) && isset($test['id'])) ? $test['id'] : $test;
+ $testReflection = new ReflectionClass(current(explode('::', $class)));
+ $this->_testNames[] = $this->_guessSubjectName($testReflection);
+ $coveringTests[] = $class;
+ }
+ $class = 'covered';
+ } elseif (isset($coverageData[$lineno]) && ($coverageData[$lineno] === -1 || $coverageData[$lineno] === array())) {
+ $class = 'uncovered';
+ } elseif (array_key_exists($lineno, $coverageData) && ($coverageData[$lineno] === -2 || $coverageData[$lineno] === null)) {
+ $class .= ' dead';
+ }
+ $diff[] = $this->_paintLine($line, $lineno, $class, $coveringTests);
+ }
+
+ $percentCovered = 100;
+ if ($total > 0) {
+ $percentCovered = round(100 * $covered / $total, 2);
+ }
+ $output .= $this->coverageHeader($filename, $percentCovered);
+ $output .= implode("", $diff);
+ $output .= $this->coverageFooter();
+ return $output;
+ }
+
+/**
+ * Guess the classname the test was for based on the test case filename.
+ *
+ * @param ReflectionClass $testReflection.
+ * @return string Possible test subject name.
+ */
+ protected function _guessSubjectName($testReflection) {
+ $basename = basename($testReflection->getFilename());
+ if (strpos($basename, '.test') !== false) {
+ list($subject, ) = explode('.', $basename, 2);
+ return $subject;
+ }
+ $subject = str_replace('Test.php', '', $basename);
+ return $subject;
+ }
+
+/**
+ * Renders the html for a single line in the html diff.
+ *
+ * @return void
+ */
+ protected function _paintLine($line, $linenumber, $class, $coveringTests) {
+ $coveredBy = '';
+ if (!empty($coveringTests)) {
+ $coveredBy = "Covered by:\n";
+ foreach ($coveringTests as $test) {
+ $coveredBy .= $test . "\n";
+ }
+ }
+
+ return sprintf(
+ '<div class="code-line %s" title="%s"><span class="line-num">%s</span><span class="content">%s</span></div>',
+ $class,
+ $coveredBy,
+ $linenumber,
+ htmlspecialchars($line)
+ );
+ }
+
+/**
+ * generate some javascript for the coverage report.
+ *
+ * @return void
+ */
+ public function coverageScript() {
+ return <<<HTML
+ <script type="text/javascript">
+ function coverage_show_hide(selector) {
+ var element = document.getElementById(selector);
+ element.style.display = (element.style.display == 'none') ? '' : 'none';
+ }
+ function coverage_toggle_all() {
+ var divs = document.querySelectorAll('div.coverage-container');
+ var i = divs.length;
+ while (i--) {
+ if (divs[i] && divs[i].className.indexOf('primary') == -1) {
+ divs[i].style.display = (divs[i].style.display == 'none') ? '' : 'none';
+ }
+ }
+ }
+ </script>
+HTML;
+ }
+
+/**
+ * Generate an HTML snippet for coverage headers
+ *
+ * @return void
+ */
+ public function coverageHeader($filename, $percent) {
+ $filename = basename($filename);
+ list($file, $ext) = explode('.', $filename);
+ $display = in_array($file, $this->_testNames) ? 'block' : 'none';
+ $primary = $display == 'block' ? 'primary' : '';
+ return <<<HTML
+ <div class="coverage-container $primary" style="display:$display;">
+ <h4>
+ <a href="#coverage-$filename" onclick="coverage_show_hide('coverage-$filename');">
+ $filename Code coverage: $percent%
+ </a>
+ </h4>
+ <div class="code-coverage-results" id="coverage-$filename" style="display:none;">
+ <pre>
+HTML;
+ }
+
+/**
+ * Generate an HTML snippet for coverage footers
+ *
+ * @return void
+ */
+ public function coverageFooter() {
+ return "</pre></div></div>";
+ }
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Coverage/TextCoverageReport.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Coverage/TextCoverageReport.php
new file mode 100644
index 0000000..e258214
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Coverage/TextCoverageReport.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Generates code coverage reports in Simple plain text from data obtained from PHPUnit
+ *
+ * PHP5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
+ * @package Cake.TestSuite.Coverage
+ * @since CakePHP(tm) v 2.0
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+App::uses('BaseCoverageReport', 'TestSuite/Coverage');
+
+/**
+ * Generates code coverage reports in Simple plain text from data obtained from PHPUnit
+ *
+ * @package Cake.TestSuite.Coverage
+ */
+class TextCoverageReport extends BaseCoverageReport {
+
+/**
+ * Generates report text to display.
+ *
+ * @return string compiled plain text report.
+ */
+ public function report() {
+ $pathFilter = $this->getPathFilter();
+ $coverageData = $this->filterCoverageDataByPath($pathFilter);
+ if (empty($coverageData)) {
+ return 'No files to generate coverage for';
+ }
+ $output = "\nCoverage Report:\n\n";
+ foreach ($coverageData as $file => $coverageData) {
+ $fileData = file($file);
+ $output .= $this->generateDiff($file, $fileData, $coverageData);
+ }
+ return $output;
+ }
+
+/**
+ * Generates a 'diff' report for a file.
+ * Since diffs are too big for plain text reports a simple file => % covered is done.
+ *
+ * @param string $filename Name of the file having coverage generated
+ * @param array $fileLines File data as an array. See file() for how to get one of these.
+ * @param array $coverageData Array of coverage data to use to generate HTML diffs with
+ * @return string
+ */
+ public function generateDiff($filename, $fileLines, $coverageData) {
+ list($covered, $total) = $this->_calculateCoveredLines($fileLines, $coverageData);
+ $percentCovered = round(100 * $covered / $total, 2);
+ return "$filename : $percentCovered%\n";
+ }
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Fixture/CakeFixtureManager.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Fixture/CakeFixtureManager.php
new file mode 100644
index 0000000..d5998ec
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Fixture/CakeFixtureManager.php
@@ -0,0 +1,282 @@
+<?php
+/**
+ * A factory class to manage the life cycle of test fixtures
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
+ * @package Cake.TestSuite.Fixture
+ * @since CakePHP(tm) v 2.0
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+App::uses('ConnectionManager', 'Model');
+App::uses('ClassRegistry', 'Utility');
+
+/**
+ * A factory class to manage the life cycle of test fixtures
+ *
+ * @package Cake.TestSuite.Fixture
+ */
+class CakeFixtureManager {
+
+/**
+ * Was this class already initialized?
+ *
+ * @var boolean
+ */
+ protected $_initialized = false;
+
+/**
+ * Default datasource to use
+ *
+ * @var DataSource
+ */
+ protected $_db = null;
+
+/**
+ * Holds the fixture classes that where instantiated
+ *
+ * @var array
+ */
+ protected $_loaded = array();
+
+/**
+ * Holds the fixture classes that where instantiated indexed by class name
+ *
+ * @var array
+ */
+ protected $_fixtureMap = array();
+
+/**
+ * Inspects the test to look for unloaded fixtures and loads them
+ *
+ * @param CakeTestCase $test the test case to inspect
+ * @return void
+ */
+ public function fixturize($test) {
+ if (!$this->_initialized) {
+ ClassRegistry::config(array('ds' => 'test', 'testing' => true));
+ }
+ if (empty($test->fixtures) || !empty($this->_processed[get_class($test)])) {
+ $test->db = $this->_db;
+ return;
+ }
+ $this->_initDb();
+ $test->db = $this->_db;
+ if (!is_array($test->fixtures)) {
+ $test->fixtures = array_map('trim', explode(',', $test->fixtures));
+ }
+ if (isset($test->fixtures)) {
+ $this->_loadFixtures($test->fixtures);
+ }
+
+ $this->_processed[get_class($test)] = true;
+ }
+
+/**
+ * Initializes this class with a DataSource object to use as default for all fixtures
+ *
+ * @return void
+ */
+ protected function _initDb() {
+ if ($this->_initialized) {
+ return;
+ }
+ $db = ConnectionManager::getDataSource('test');
+ $db->cacheSources = false;
+ $this->_db = $db;
+ $this->_initialized = true;
+ }
+
+/**
+ * Looks for fixture files and instantiates the classes accordingly
+ *
+ * @param array $fixtures the fixture names to load using the notation {type}.{name}
+ * @return void
+ * @throws UnexpectedValueException when a referenced fixture does not exist.
+ */
+ protected function _loadFixtures($fixtures) {
+ foreach ($fixtures as $index => $fixture) {
+ $fixtureFile = null;
+ $fixtureIndex = $fixture;
+ if (isset($this->_loaded[$fixture])) {
+ continue;
+ }
+
+ if (strpos($fixture, 'core.') === 0) {
+ $fixture = substr($fixture, strlen('core.'));
+ $fixturePaths[] = CAKE . 'Test' . DS . 'Fixture';
+ } elseif (strpos($fixture, 'app.') === 0) {
+ $fixture = substr($fixture, strlen('app.'));
+ $fixturePaths = array(
+ TESTS . 'Fixture'
+ );
+ } elseif (strpos($fixture, 'plugin.') === 0) {
+ $parts = explode('.', $fixture, 3);
+ $pluginName = $parts[1];
+ $fixture = $parts[2];
+ $fixturePaths = array(
+ CakePlugin::path(Inflector::camelize($pluginName)) . 'Test' . DS . 'Fixture',
+ TESTS . 'Fixture'
+ );
+ } else {
+ $fixturePaths = array(
+ TESTS . 'Fixture',
+ CAKE . 'Test' . DS . 'Fixture'
+ );
+ }
+
+ $loaded = false;
+ foreach ($fixturePaths as $path) {
+ $className = Inflector::camelize($fixture);
+ if (is_readable($path . DS . $className . 'Fixture.php')) {
+ $fixtureFile = $path . DS . $className . 'Fixture.php';
+ require_once $fixtureFile;
+ $fixtureClass = $className . 'Fixture';
+ $this->_loaded[$fixtureIndex] = new $fixtureClass();
+ $this->_fixtureMap[$fixtureClass] = $this->_loaded[$fixtureIndex];
+ $loaded = true;
+ break;
+ }
+ }
+
+ if (!$loaded) {
+ $firstPath = str_replace(array(APP, CAKE_CORE_INCLUDE_PATH, ROOT), '', $fixturePaths[0] . DS . $className . 'Fixture.php');
+ throw new UnexpectedValueException(__d('cake_dev', 'Referenced fixture class %s (%s) not found', $className, $firstPath));
+ }
+ }
+ }
+
+/**
+ * Runs the drop and create commands on the fixtures if necessary.
+ *
+ * @param CakeTestFixture $fixture the fixture object to create
+ * @param DataSource $db the datasource instance to use
+ * @param boolean $drop whether drop the fixture if it is already created or not
+ * @return void
+ */
+ protected function _setupTable($fixture, $db = null, $drop = true) {
+ if (!$db) {
+ if (!empty($fixture->useDbConfig)) {
+ $db = ConnectionManager::getDataSource($fixture->useDbConfig);
+ } else {
+ $db = $this->_db;
+ }
+ }
+ if (!empty($fixture->created) && in_array($db->configKeyName, $fixture->created)) {
+ return;
+ }
+
+ $sources = $db->listSources();
+ $table = $db->config['prefix'] . $fixture->table;
+ $exists = in_array($table, $sources);
+
+ if ($drop && $exists) {
+ $fixture->drop($db);
+ $fixture->create($db);
+ } elseif (!$exists) {
+ $fixture->create($db);
+ } else {
+ $fixture->created[] = $db->configKeyName;
+ }
+ }
+
+/**
+ * Creates the fixtures tables and inserts data on them.
+ *
+ * @param CakeTestCase $test the test to inspect for fixture loading
+ * @return void
+ */
+ public function load(CakeTestCase $test) {
+ if (empty($test->fixtures)) {
+ return;
+ }
+ $fixtures = $test->fixtures;
+ if (empty($fixtures) || $test->autoFixtures == false) {
+ return;
+ }
+
+ $nested = $test->db->useNestedTransactions;
+ $test->db->useNestedTransactions = false;
+ $test->db->begin();
+ foreach ($fixtures as $f) {
+ if (!empty($this->_loaded[$f])) {
+ $fixture = $this->_loaded[$f];
+ $db = ConnectionManager::getDataSource($fixture->useDbConfig);
+ $this->_setupTable($fixture, $db, $test->dropTables);
+ $fixture->insert($db);
+ }
+ }
+ $test->db->commit();
+ $test->db->useNestedTransactions = $nested;
+ }
+
+/**
+ * Truncates the fixtures tables
+ *
+ * @param CakeTestCase $test the test to inspect for fixture unloading
+ * @return void
+ */
+ public function unload(CakeTestCase $test) {
+ $fixtures = !empty($test->fixtures) ? $test->fixtures : array();
+ foreach (array_reverse($fixtures) as $f) {
+ if (isset($this->_loaded[$f])) {
+ $fixture = $this->_loaded[$f];
+ if (!empty($fixture->created)) {
+ foreach ($fixture->created as $ds) {
+ $db = ConnectionManager::getDataSource($ds);
+ $fixture->truncate($db);
+ }
+ }
+ }
+ }
+ }
+
+/**
+ * Creates a single fixture table and loads data into it.
+ *
+ * @param string $name of the fixture
+ * @param DataSource $db DataSource instance or leave null to get DataSource from the fixture
+ * @return void
+ * @throws UnexpectedValueException if $name is not a previously loaded class
+ */
+ public function loadSingle($name, $db = null) {
+ $name .= 'Fixture';
+ if (isset($this->_fixtureMap[$name])) {
+ $fixture = $this->_fixtureMap[$name];
+ if (!$db) {
+ $db = ConnectionManager::getDataSource($fixture->useDbConfig);
+ }
+ $this->_setupTable($fixture, $db);
+ $fixture->truncate($db);
+ $fixture->insert($db);
+ } else {
+ throw new UnexpectedValueException(__d('cake_dev', 'Referenced fixture class %s not found', $name));
+ }
+ }
+
+/**
+ * Drop all fixture tables loaded by this class
+ *
+ * @return void
+ */
+ public function shutDown() {
+ foreach ($this->_loaded as $fixture) {
+ if (!empty($fixture->created)) {
+ foreach ($fixture->created as $ds) {
+ $db = ConnectionManager::getDataSource($ds);
+ $fixture->drop($db);
+ }
+ }
+ }
+ }
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Fixture/CakeTestFixture.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Fixture/CakeTestFixture.php
new file mode 100644
index 0000000..359d57f
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Fixture/CakeTestFixture.php
@@ -0,0 +1,269 @@
+<?php
+/**
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
+ * @package Cake.TestSuite.Fixture
+ * @since CakePHP(tm) v 1.2.0.4667
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+App::uses('CakeSchema', 'Model');
+
+/**
+ * CakeTestFixture is responsible for building and destroying tables to be used
+ * during testing.
+ *
+ * @package Cake.TestSuite.Fixture
+ */
+class CakeTestFixture {
+
+/**
+ * Name of the object
+ *
+ * @var string
+ */
+ public $name = null;
+
+/**
+ * Cake's DBO driver (e.g: DboMysql).
+ *
+ * @var object
+ */
+ public $db = null;
+
+/**
+ * Fixture Datasource
+ *
+ * @var string
+ */
+ public $useDbConfig = 'test';
+
+/**
+ * Full Table Name
+ *
+ * @var string
+ */
+ public $table = null;
+
+/**
+ * List of datasources where this fixture has been created
+ *
+ * @var array
+ */
+ public $created = array();
+
+/**
+ * Instantiate the fixture.
+ *
+ * @throws CakeException on invalid datasource usage.
+ */
+ public function __construct() {
+ if ($this->name === null) {
+ if (preg_match('/^(.*)Fixture$/', get_class($this), $matches)) {
+ $this->name = $matches[1];
+ } else {
+ $this->name = get_class($this);
+ }
+ }
+ $connection = 'test';
+ if (!empty($this->useDbConfig)) {
+ $connection = $this->useDbConfig;
+ if (strpos($connection, 'test') !== 0) {
+ throw new CakeException(__d('cake_dev', 'Invalid datasource %s for object %s', $connection, $this->name));
+ }
+ }
+ $this->Schema = new CakeSchema(array('name' => 'TestSuite', 'connection' => $connection));
+ $this->init();
+ }
+
+/**
+ * Initialize the fixture.
+ *
+ * @return void
+ * @throws MissingModelException Whe importing from a model that does not exist.
+ */
+ public function init() {
+ if (isset($this->import) && (is_string($this->import) || is_array($this->import))) {
+ $import = array_merge(
+ array('connection' => 'default', 'records' => false),
+ is_array($this->import) ? $this->import : array('model' => $this->import)
+ );
+
+ $this->Schema->connection = $import['connection'];
+ if (isset($import['model'])) {
+ list($plugin, $modelClass) = pluginSplit($import['model'], true);
+ App::uses($modelClass, $plugin . 'Model');
+ if (!class_exists($modelClass)) {
+ throw new MissingModelException(array('class' => $modelClass));
+ }
+ $model = new $modelClass(null, null, $import['connection']);
+ $db = $model->getDataSource();
+ if (empty($model->tablePrefix)) {
+ $model->tablePrefix = $db->config['prefix'];
+ }
+ $this->fields = $model->schema(true);
+ $this->fields[$model->primaryKey]['key'] = 'primary';
+ $this->table = $db->fullTableName($model, false, false);
+ ClassRegistry::config(array('ds' => 'test'));
+ ClassRegistry::flush();
+ } elseif (isset($import['table'])) {
+ $model = new Model(null, $import['table'], $import['connection']);
+ $db = ConnectionManager::getDataSource($import['connection']);
+ $db->cacheSources = false;
+ $model->useDbConfig = $import['connection'];
+ $model->name = Inflector::camelize(Inflector::singularize($import['table']));
+ $model->table = $import['table'];
+ $model->tablePrefix = $db->config['prefix'];
+ $this->fields = $model->schema(true);
+ ClassRegistry::flush();
+ }
+
+ if (!empty($db->config['prefix']) && strpos($this->table, $db->config['prefix']) === 0) {
+ $this->table = str_replace($db->config['prefix'], '', $this->table);
+ }
+
+ if (isset($import['records']) && $import['records'] !== false && isset($model) && isset($db)) {
+ $this->records = array();
+ $query = array(
+ 'fields' => $db->fields($model, null, array_keys($this->fields)),
+ 'table' => $db->fullTableName($model),
+ 'alias' => $model->alias,
+ 'conditions' => array(),
+ 'order' => null,
+ 'limit' => null,
+ 'group' => null
+ );
+ $records = $db->fetchAll($db->buildStatement($query, $model), false, $model->alias);
+
+ if ($records !== false && !empty($records)) {
+ $this->records = Hash::extract($records, '{n}.' . $model->alias);
+ }
+ }
+ }
+
+ if (!isset($this->table)) {
+ $this->table = Inflector::underscore(Inflector::pluralize($this->name));
+ }
+
+ if (!isset($this->primaryKey) && isset($this->fields['id'])) {
+ $this->primaryKey = 'id';
+ }
+ }
+
+/**
+ * Run before all tests execute, should return SQL statement to create table for this fixture could be executed successfully.
+ *
+ * @param object $db An instance of the database object used to create the fixture table
+ * @return boolean True on success, false on failure
+ */
+ public function create($db) {
+ if (!isset($this->fields) || empty($this->fields)) {
+ return false;
+ }
+
+ if (empty($this->fields['tableParameters']['engine'])) {
+ $canUseMemory = true;
+ foreach ($this->fields as $field => $args) {
+
+ if (is_string($args)) {
+ $type = $args;
+ } elseif (!empty($args['type'])) {
+ $type = $args['type'];
+ } else {
+ continue;
+ }
+
+ if (in_array($type, array('blob', 'text', 'binary'))) {
+ $canUseMemory = false;
+ break;
+ }
+ }
+
+ if ($canUseMemory) {
+ $this->fields['tableParameters']['engine'] = 'MEMORY';
+ }
+ }
+ $this->Schema->build(array($this->table => $this->fields));
+ try {
+ $db->execute($db->createSchema($this->Schema), array('log' => false));
+ $this->created[] = $db->configKeyName;
+ } catch (Exception $e) {
+ return false;
+ }
+ return true;
+ }
+
+/**
+ * Run after all tests executed, should return SQL statement to drop table for this fixture.
+ *
+ * @param object $db An instance of the database object used to create the fixture table
+ * @return boolean True on success, false on failure
+ */
+ public function drop($db) {
+ if (empty($this->fields)) {
+ return false;
+ }
+ $this->Schema->build(array($this->table => $this->fields));
+ try {
+
+ $db->execute($db->dropSchema($this->Schema), array('log' => false));
+ $this->created = array_diff($this->created, array($db->configKeyName));
+ } catch (Exception $e) {
+ return false;
+ }
+ return true;
+ }
+
+/**
+ * Run before each tests is executed, should return a set of SQL statements to insert records for the table
+ * of this fixture could be executed successfully.
+ *
+ * @param object $db An instance of the database into which the records will be inserted
+ * @return boolean on success or if there are no records to insert, or false on failure
+ */
+ public function insert($db) {
+ if (!isset($this->_insert)) {
+ $values = array();
+ if (isset($this->records) && !empty($this->records)) {
+ $fields = array();
+ foreach ($this->records as $record) {
+ $fields = array_merge($fields, array_keys(array_intersect_key($record, $this->fields)));
+ }
+ $fields = array_unique($fields);
+ $default = array_fill_keys($fields, null);
+ foreach ($this->records as $record) {
+ $fields = array_keys($record);
+ $values[] = array_values(array_merge($default, $record));
+ }
+ $nested = $db->useNestedTransactions;
+ $db->useNestedTransactions = false;
+ $result = $db->insertMulti($this->table, $fields, $values);
+ $db->useNestedTransactions = $nested;
+ return $result;
+ }
+ return true;
+ }
+ }
+
+/**
+ * Truncates the current fixture. Can be overwritten by classes extending CakeFixture to trigger other events before / after
+ * truncate.
+ *
+ * @param object $db A reference to a db instance
+ * @return boolean
+ */
+ public function truncate($db) {
+ $fullDebug = $db->fullDebug;
+ $db->fullDebug = false;
+ $return = $db->truncate($this->table);
+ $db->fullDebug = $fullDebug;
+ return $return;
+ }
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Fixture/CakeTestModel.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Fixture/CakeTestModel.php
new file mode 100644
index 0000000..22add85
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Fixture/CakeTestModel.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
+ * @package Cake.TestSuite.Fixture
+ * @since CakePHP(tm) v 1.2.0.4667
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+App::uses('Model', 'Model');
+
+/**
+ * A model to extend from to help you during testing.
+ *
+ * @package Cake.TestSuite.Fixture
+ */
+class CakeTestModel extends Model {
+
+ public $useDbConfig = 'test';
+
+ public $cacheSources = false;
+
+/**
+ * Sets default order for the model to avoid failing tests caused by
+ * incorrect order when no order has been defined in the finds.
+ * Postgres can return the results in any order it considers appropriate if none is specified
+ *
+ * @param array $queryData
+ * @return array $queryData
+ */
+ public function beforeFind($queryData) {
+ $pk = $this->primaryKey;
+ $aliasedPk = $this->alias . '.' . $this->primaryKey;
+ switch (true) {
+ case !$pk:
+ case !$this->useTable:
+ case !$this->schema('id'):
+ case !empty($queryData['order'][0]):
+ case !empty($queryData['group']):
+ case
+ (is_string($queryData['fields']) && !($queryData['fields'] == $pk || $queryData['fields'] == $aliasedPk)) ||
+ (is_array($queryData['fields']) && !(array_key_exists($pk, $queryData['fields']) || array_key_exists($aliasedPk, $queryData['fields']))):
+ break;
+ default:
+ $queryData['order'] = array($this->alias . '.' . $this->primaryKey => 'ASC');
+ break;
+ }
+ return $queryData;
+ }
+/**
+ * Overriding save() to set CakeTestSuiteDispatcher::date() as formatter for created, modified and updated fields
+ *
+ * @param array $data
+ * @param boolean|array $validate
+ * @param array $fieldList
+ */
+
+ public function save($data = null, $validate = true, $fieldList = array()) {
+ $db = $this->getDataSource();
+ $db->columns['datetime']['formatter'] = 'CakeTestSuiteDispatcher::date';
+ return parent::save($data, $validate, $fieldList);
+ }
+
+} \ No newline at end of file
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Reporter/CakeBaseReporter.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Reporter/CakeBaseReporter.php
new file mode 100644
index 0000000..27dfbd7
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Reporter/CakeBaseReporter.php
@@ -0,0 +1,210 @@
+<?php
+/**
+ * CakeBaseReporter contains common functionality to all cake test suite reporters.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
+ * @since CakePHP(tm) v 1.3
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+require_once 'PHPUnit/TextUI/ResultPrinter.php';
+
+/**
+ * CakeBaseReporter contains common reporting features used in the CakePHP Test suite
+ *
+ * @package Cake.TestSuite.Reporter
+ */
+class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
+
+ protected $_headerSent = false;
+
+/**
+ * Array of request parameters. Usually parsed GET params.
+ *
+ * @var array
+ */
+ public $params = array();
+
+/**
+ * Character set for the output of test reporting.
+ *
+ * @var string
+ */
+ protected $_characterSet;
+
+/**
+ * Does nothing yet. The first output will
+ * be sent on the first test start.
+ *
+ * ### Params
+ *
+ * - show_passes - Should passes be shown
+ * - plugin - Plugin test being run?
+ * - core - Core test being run.
+ * - case - The case being run
+ * - codeCoverage - Whether the case/group being run is being code covered.
+ *
+ * @param string $charset The character set to output with. Defaults to UTF-8
+ * @param array $params Array of request parameters the reporter should use. See above.
+ */
+ public function __construct($charset = 'utf-8', $params = array()) {
+ if (!$charset) {
+ $charset = 'utf-8';
+ }
+ $this->_characterSet = $charset;
+ $this->params = $params;
+ }
+
+/**
+ * Retrieves a list of test cases from the active Manager class,
+ * displaying it in the correct format for the reporter subclass
+ *
+ * @return mixed
+ */
+ public function testCaseList() {
+ $testList = CakeTestLoader::generateTestList($this->params);
+ return $testList;
+ }
+
+/**
+ * Paints the start of the response from the test suite.
+ * Used to paint things like head elements in an html page.
+ *
+ * @return void
+ */
+ public function paintDocumentStart() {
+ }
+
+/**
+ * Paints the end of the response from the test suite.
+ * Used to paint things like </body> in an html page.
+ *
+ * @return void
+ */
+ public function paintDocumentEnd() {
+ }
+
+/**
+ * Paint a list of test sets, core, app, and plugin test sets
+ * available.
+ *
+ * @return void
+ */
+ public function paintTestMenu() {
+ }
+
+/**
+ * Get the baseUrl if one is available.
+ *
+ * @return string The base url for the request.
+ */
+ public function baseUrl() {
+ if (!empty($_SERVER['PHP_SELF'])) {
+ return $_SERVER['PHP_SELF'];
+ }
+ return '';
+ }
+
+ public function printResult(PHPUnit_Framework_TestResult $result) {
+ $this->paintFooter($result);
+ }
+
+ public function paintResult(PHPUnit_Framework_TestResult $result) {
+ $this->paintFooter($result);
+ }
+
+/**
+ * An error occurred.
+ *
+ * @param PHPUnit_Framework_Test $test
+ * @param Exception $e
+ * @param float $time
+ */
+ public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) {
+ $this->paintException($e, $test);
+ }
+
+/**
+ * A failure occurred.
+ *
+ * @param PHPUnit_Framework_Test $test
+ * @param PHPUnit_Framework_AssertionFailedError $e
+ * @param float $time
+ */
+ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) {
+ $this->paintFail($e, $test);
+ }
+
+/**
+ * Incomplete test.
+ *
+ * @param PHPUnit_Framework_Test $test
+ * @param Exception $e
+ * @param float $time
+ */
+ public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
+ $this->paintSkip($e, $test);
+ }
+
+/**
+ * Skipped test.
+ *
+ * @param PHPUnit_Framework_Test $test
+ * @param Exception $e
+ * @param float $time
+ */
+ public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
+ $this->paintSkip($e, $test);
+ }
+
+/**
+ * A test suite started.
+ *
+ * @param PHPUnit_Framework_TestSuite $suite
+ */
+ public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {
+ if (!$this->_headerSent) {
+ echo $this->paintHeader();
+ }
+ echo __d('cake_dev', 'Running %s', $suite->getName()) . "\n";
+ }
+
+/**
+ * A test suite ended.
+ *
+ * @param PHPUnit_Framework_TestSuite $suite
+ */
+ public function endTestSuite(PHPUnit_Framework_TestSuite $suite) {
+ }
+
+/**
+ * A test started.
+ *
+ * @param PHPUnit_Framework_Test $test
+ */
+ public function startTest(PHPUnit_Framework_Test $test) {
+ }
+
+/**
+ * A test ended.
+ *
+ * @param PHPUnit_Framework_Test $test
+ * @param float $time
+ */
+ public function endTest(PHPUnit_Framework_Test $test, $time) {
+ $this->numAssertions += $test->getNumAssertions();
+ if ($test->hasFailed()) {
+ return;
+ }
+ $this->paintPass($test, $time);
+ }
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php
new file mode 100644
index 0000000..5bd2695
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php
@@ -0,0 +1,377 @@
+<?php
+/**
+ * CakeHtmlReporter
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
+ * @since CakePHP(tm) v 1.2.0.4433
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+App::uses('CakeBaseReporter', 'TestSuite/Reporter');
+
+/**
+ * CakeHtmlReporter Reports Results of TestSuites and Test Cases
+ * in an HTML format / context.
+ *
+ * @package Cake.TestSuite.Reporter
+ */
+class CakeHtmlReporter extends CakeBaseReporter {
+
+/**
+ * Paints the top of the web page setting the
+ * title to the name of the starting test.
+ *
+ * @return void
+ */
+ public function paintHeader() {
+ $this->_headerSent = true;
+ $this->sendContentType();
+ $this->sendNoCacheHeaders();
+ $this->paintDocumentStart();
+ $this->paintTestMenu();
+ echo "<ul class='tests'>\n";
+ }
+
+/**
+ * Set the content-type header so it is in the correct encoding.
+ *
+ * @return void
+ */
+ public function sendContentType() {
+ if (!headers_sent()) {
+ header('Content-Type: text/html; charset=' . Configure::read('App.encoding'));
+ }
+ }
+
+/**
+ * Paints the document start content contained in header.php
+ *
+ * @return void
+ */
+ public function paintDocumentStart() {
+ ob_start();
+ $baseDir = $this->params['baseDir'];
+ include CAKE . 'TestSuite' . DS . 'templates' . DS . 'header.php';
+ }
+
+/**
+ * Paints the menu on the left side of the test suite interface.
+ * Contains all of the various plugin, core, and app buttons.
+ *
+ * @return void
+ */
+ public function paintTestMenu() {
+ $cases = $this->baseUrl() . '?show=cases';
+ $plugins = App::objects('plugin', null, false);
+ sort($plugins);
+ include CAKE . 'TestSuite' . DS . 'templates' . DS . 'menu.php';
+ }
+
+/**
+ * Retrieves and paints the list of tests cases in an HTML format.
+ *
+ * @return void
+ */
+ public function testCaseList() {
+ $testCases = parent::testCaseList();
+ $core = $this->params['core'];
+ $plugin = $this->params['plugin'];
+
+ $buffer = "<h3>App Test Cases:</h3>\n<ul>";
+ $urlExtra = null;
+ if ($core) {
+ $buffer = "<h3>Core Test Cases:</h3>\n<ul>";
+ $urlExtra = '&core=true';
+ } elseif ($plugin) {
+ $buffer = "<h3>" . Inflector::humanize($plugin) . " Test Cases:</h3>\n<ul>";
+ $urlExtra = '&plugin=' . $plugin;
+ }
+
+ if (1 > count($testCases)) {
+ $buffer .= "<strong>EMPTY</strong>";
+ }
+
+ foreach ($testCases as $testCaseFile => $testCase) {
+ $title = explode(DS, str_replace('.test.php', '', $testCase));
+ $title[count($title) - 1] = Inflector::camelize($title[count($title) - 1]);
+ $title = implode(' / ', $title);
+ $buffer .= "<li><a href='" . $this->baseUrl() . "?case=" . urlencode($testCase) . $urlExtra . "'>" . $title . "</a></li>\n";
+ }
+ $buffer .= "</ul>\n";
+ echo $buffer;
+ }
+
+/**
+ * Send the headers necessary to ensure the page is
+ * reloaded on every request. Otherwise you could be
+ * scratching your head over out of date test data.
+ *
+ * @return void
+ */
+ public function sendNoCacheHeaders() {
+ if (!headers_sent()) {
+ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+ header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+ header("Cache-Control: no-store, no-cache, must-revalidate");
+ header("Cache-Control: post-check=0, pre-check=0", false);
+ header("Pragma: no-cache");
+ }
+ }
+
+/**
+ * Paints the end of the test with a summary of
+ * the passes and failures.
+ *
+ * @param PHPUnit_Framework_TestResult $result Result object
+ * @return void
+ */
+ public function paintFooter($result) {
+ ob_end_flush();
+ $colour = ($result->failureCount() + $result->errorCount() > 0 ? "red" : "green");
+ echo "</ul>\n";
+ echo "<div style=\"";
+ echo "padding: 8px; margin: 1em 0; background-color: $colour; color: white;";
+ echo "\">";
+ echo ($result->count() - $result->skippedCount()) . "/" . $result->count();
+ echo " test methods complete:\n";
+ echo "<strong>" . count($result->passed()) . "</strong> passes, ";
+ echo "<strong>" . $result->failureCount() . "</strong> fails, ";
+ echo "<strong>" . $this->numAssertions . "</strong> assertions and ";
+ echo "<strong>" . $result->errorCount() . "</strong> exceptions.";
+ echo "</div>\n";
+ echo '<div style="padding:0 0 5px;">';
+ echo '<p><strong>Time:</strong> ' . $result->time() . ' seconds</p>';
+ echo '<p><strong>Peak memory:</strong> ' . number_format(memory_get_peak_usage()) . ' bytes</p>';
+ echo $this->_paintLinks();
+ echo '</div>';
+ if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) {
+ $coverage = $result->getCodeCoverage();
+ if (method_exists($coverage, 'getSummary')) {
+ $report = $coverage->getSummary();
+ echo $this->paintCoverage($report);
+ }
+ if (method_exists($coverage, 'getData')) {
+ $report = $coverage->getData();
+ echo $this->paintCoverage($report);
+ }
+ }
+ $this->paintDocumentEnd();
+ }
+
+/**
+ * Paints a code coverage report.
+ *
+ * @return void
+ */
+ public function paintCoverage(array $coverage) {
+ App::uses('HtmlCoverageReport', 'TestSuite/Coverage');
+
+ $reporter = new HtmlCoverageReport($coverage, $this);
+ echo $reporter->report();
+ }
+
+/**
+ * Renders the links that for accessing things in the test suite.
+ *
+ * @return void
+ */
+ protected function _paintLinks() {
+ $show = $query = array();
+ if (!empty($this->params['case'])) {
+ $show['show'] = 'cases';
+ }
+
+ if (!empty($this->params['core'])) {
+ $show['core'] = $query['core'] = 'true';
+ }
+ if (!empty($this->params['plugin'])) {
+ $show['plugin'] = $query['plugin'] = $this->params['plugin'];
+ }
+ if (!empty($this->params['case'])) {
+ $query['case'] = $this->params['case'];
+ }
+ $show = $this->_queryString($show);
+ $query = $this->_queryString($query);
+
+ echo "<p><a href='" . $this->baseUrl() . $show . "'>Run more tests</a> | <a href='" . $this->baseUrl() . $query . "&show_passes=1'>Show Passes</a> | \n";
+ echo "<a href='" . $this->baseUrl() . $query . "&debug=1'>Enable Debug Output</a> | \n";
+ echo "<a href='" . $this->baseUrl() . $query . "&amp;code_coverage=true'>Analyze Code Coverage</a></p>\n";
+ }
+
+/**
+ * Convert an array of parameters into a query string url
+ *
+ * @param array $url Url hash to be converted
+ * @return string Converted url query string
+ */
+ protected function _queryString($url) {
+ $out = '?';
+ $params = array();
+ foreach ($url as $key => $value) {
+ $params[] = "$key=$value";
+ }
+ $out .= implode('&amp;', $params);
+ return $out;
+ }
+
+/**
+ * Paints the end of the document html.
+ *
+ * @return void
+ */
+ public function paintDocumentEnd() {
+ $baseDir = $this->params['baseDir'];
+ include CAKE . 'TestSuite' . DS . 'templates' . DS . 'footer.php';
+ if (ob_get_length()) {
+ ob_end_flush();
+ }
+ }
+
+/**
+ * Paints the test failure with a breadcrumbs
+ * trail of the nesting test suites below the
+ * top level test.
+ *
+ * @param PHPUnit_Framework_AssertionFailedError $message Failure object displayed in
+ * the context of the other tests.
+ * @return void
+ */
+ public function paintFail($message, $test) {
+ $trace = $this->_getStackTrace($message);
+ $testName = get_class($test) . '(' . $test->getName() . ')';
+
+ $actualMsg = $expectedMsg = null;
+ $failure = $message->getComparisonFailure();
+ if (is_object($failure)) {
+ $actualMsg = $message->getComparisonFailure()->getActualAsString();
+ $expectedMsg = $message->getComparisonFailure()->getExpectedAsString();
+ }
+
+ echo "<li class='fail'>\n";
+ echo "<span>Failed</span>";
+ echo "<div class='msg'><pre>" . $this->_htmlEntities($message->toString());
+
+ if ((is_string($actualMsg) && is_string($expectedMsg)) || (is_array($actualMsg) && is_array($expectedMsg))) {
+ echo "<br />" . PHPUnit_Util_Diff::diff($expectedMsg, $actualMsg);
+ }
+
+ echo "</pre></div>\n";
+ echo "<div class='msg'>" . __d('cake_dev', 'Test case: %s', $testName) . "</div>\n";
+ echo "<div class='msg'>" . __d('cake_dev', 'Stack trace:') . '<br />' . $trace . "</div>\n";
+ echo "</li>\n";
+ }
+
+/**
+ * Paints the test pass with a breadcrumbs
+ * trail of the nesting test suites below the
+ * top level test.
+ *
+ * @param PHPUnit_Framework_Test test method that just passed
+ * @param float $time time spent to run the test method
+ * @return void
+ */
+ public function paintPass(PHPUnit_Framework_Test $test, $time = null) {
+ if (isset($this->params['showPasses']) && $this->params['showPasses']) {
+ echo "<li class='pass'>\n";
+ echo "<span>Passed</span> ";
+
+ echo "<br />" . $this->_htmlEntities($test->getName()) . " ($time seconds)\n";
+ echo "</li>\n";
+ }
+ }
+
+/**
+ * Paints a PHP exception.
+ *
+ * @param Exception $exception Exception to display.
+ * @return void
+ */
+ public function paintException($message, $test) {
+ $trace = $this->_getStackTrace($message);
+ $testName = get_class($test) . '(' . $test->getName() . ')';
+
+ echo "<li class='fail'>\n";
+ echo "<span>" . get_class($message) . "</span>";
+
+ echo "<div class='msg'>" . $this->_htmlEntities($message->getMessage()) . "</div>\n";
+ echo "<div class='msg'>" . __d('cake_dev', 'Test case: %s', $testName) . "</div>\n";
+ echo "<div class='msg'>" . __d('cake_dev', 'Stack trace:') . '<br />' . $trace . "</div>\n";
+ echo "</li>\n";
+ }
+
+/**
+ * Prints the message for skipping tests.
+ *
+ * @param string $message Text of skip condition.
+ * @param PHPUnit_Framework_TestCase $test the test method skipped
+ * @return void
+ */
+ public function paintSkip($message, $test) {
+ echo "<li class='skipped'>\n";
+ echo "<span>Skipped</span> ";
+ echo $test->getName() . ': ' . $this->_htmlEntities($message->getMessage());
+ echo "</li>\n";
+ }
+
+/**
+ * Paints formatted text such as dumped variables.
+ *
+ * @param string $message Text to show.
+ * @return void
+ */
+ public function paintFormattedMessage($message) {
+ echo '<pre>' . $this->_htmlEntities($message) . '</pre>';
+ }
+
+/**
+ * Character set adjusted entity conversion.
+ *
+ * @param string $message Plain text or Unicode message.
+ * @return string Browser readable message.
+ */
+ protected function _htmlEntities($message) {
+ return htmlentities($message, ENT_COMPAT, $this->_characterSet);
+ }
+
+/**
+ * Gets a formatted stack trace.
+ *
+ * @param Exception $e Exception to get a stack trace for.
+ * @return string Generated stack trace.
+ */
+ protected function _getStackTrace(Exception $e) {
+ $trace = $e->getTrace();
+ $out = array();
+ foreach ($trace as $frame) {
+ if (isset($frame['file']) && isset($frame['line'])) {
+ $out[] = $frame['file'] . ' : ' . $frame['line'];
+ } elseif (isset($frame['class']) && isset($frame['function'])) {
+ $out[] = $frame['class'] . '::' . $frame['function'];
+ } else {
+ $out[] = '[internal]';
+ }
+ }
+ return implode('<br />', $out);
+ }
+
+/**
+ * A test suite started.
+ *
+ * @param PHPUnit_Framework_TestSuite $suite
+ */
+ public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {
+ if (!$this->_headerSent) {
+ echo $this->paintHeader();
+ }
+ echo '<h2>' . __d('cake_dev', 'Running %s', $suite->getName()) . '</h2>';
+ }
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Reporter/CakeTextReporter.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Reporter/CakeTextReporter.php
new file mode 100644
index 0000000..1c8c201
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/Reporter/CakeTextReporter.php
@@ -0,0 +1,187 @@
+<?php
+/**
+ * CakeTextReporter contains reporting features used for plain text based output
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
+ * @since CakePHP(tm) v 1.3
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+App::uses('CakeBaseReporter', 'TestSuite/Reporter');
+App::uses('TextCoverageReport', 'TestSuite/Coverage');
+
+/**
+ * CakeTextReporter contains reporting features used for plain text based output
+ *
+ * @package Cake.TestSuite.Reporter
+ */
+class CakeTextReporter extends CakeBaseReporter {
+
+/**
+ * Sets the text/plain header if the test is not a CLI test.
+ *
+ * @return void
+ */
+ public function paintDocumentStart() {
+ if (!headers_sent()) {
+ header('Content-type: text/plain');
+ }
+ }
+
+/**
+ * Paints a pass
+ *
+ * @return void
+ */
+ public function paintPass() {
+ echo '.';
+ }
+
+/**
+ * Paints a failing test.
+ *
+ * @param $message PHPUnit_Framework_AssertionFailedError $message Failure object displayed in
+ * the context of the other tests.
+ * @return void
+ */
+ public function paintFail($message) {
+ $context = $message->getTrace();
+ $realContext = $context[3];
+ $context = $context[2];
+
+ printf(
+ "FAIL on line %s\n%s in\n%s %s()\n\n",
+ $context['line'], $message->toString(), $context['file'], $realContext['function']
+ );
+ }
+
+/**
+ * Paints the end of the test with a summary of
+ * the passes and failures.
+ *
+ * @param PHPUnit_Framework_TestResult $result Result object
+ * @return void
+ */
+ public function paintFooter($result) {
+ if ($result->failureCount() + $result->errorCount() == 0) {
+ echo "\nOK\n";
+ } else {
+ echo "FAILURES!!!\n";
+ }
+
+ echo "Test cases run: " . $result->count() .
+ "/" . ($result->count() - $result->skippedCount()) .
+ ', Passes: ' . $this->numAssertions .
+ ', Failures: ' . $result->failureCount() .
+ ', Exceptions: ' . $result->errorCount() . "\n";
+
+ echo 'Time: ' . $result->time() . " seconds\n";
+ echo 'Peak memory: ' . number_format(memory_get_peak_usage()) . " bytes\n";
+
+ if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) {
+ $coverage = $result->getCodeCoverage()->getSummary();
+ echo $this->paintCoverage($coverage);
+ }
+ }
+
+/**
+ * Paints the title only.
+ *
+ * @param string $test_name Name class of test.
+ * @return void
+ */
+ public function paintHeader() {
+ $this->paintDocumentStart();
+ flush();
+ }
+
+/**
+ * Paints a PHP exception.
+ *
+ * @param Exception $exception Exception to describe.
+ * @return void
+ */
+ public function paintException($exception) {
+ $message = 'Unexpected exception of type [' . get_class($exception) .
+ '] with message [' . $exception->getMessage() .
+ '] in [' . $exception->getFile() .
+ ' line ' . $exception->getLine() . ']';
+ echo $message . "\n\n";
+ }
+
+/**
+ * Prints the message for skipping tests.
+ *
+ * @param string $message Text of skip condition.
+ * @return void
+ */
+ public function paintSkip($message) {
+ printf("Skip: %s\n", $message->getMessage());
+ }
+
+/**
+ * Paints formatted text such as dumped variables.
+ *
+ * @param string $message Text to show.
+ * @return void
+ */
+ public function paintFormattedMessage($message) {
+ echo "$message\n";
+ flush();
+ }
+
+/**
+ * Generate a test case list in plain text.
+ * Creates as series of url's for tests that can be run.
+ * One case per line.
+ *
+ * @return void
+ */
+ public function testCaseList() {
+ $testCases = parent::testCaseList();
+ $app = $this->params['app'];
+ $plugin = $this->params['plugin'];
+
+ $buffer = "Core Test Cases:\n";
+ $urlExtra = '';
+ if ($app) {
+ $buffer = "App Test Cases:\n";
+ $urlExtra = '&app=true';
+ } elseif ($plugin) {
+ $buffer = Inflector::humanize($plugin) . " Test Cases:\n";
+ $urlExtra = '&plugin=' . $plugin;
+ }
+
+ if (1 > count($testCases)) {
+ $buffer .= "EMPTY";
+ echo $buffer;
+ }
+
+ foreach ($testCases as $testCaseFile => $testCase) {
+ $buffer .= $_SERVER['SERVER_NAME'] . $this->baseUrl() . "?case=" . $testCase . "&output=text\n";
+ }
+
+ $buffer .= "\n";
+ echo $buffer;
+ }
+
+/**
+ * Generates a Text summary of the coverage data.
+ *
+ * @param array $coverage Array of coverage data.
+ * @return string
+ */
+ public function paintCoverage($coverage) {
+ $reporter = new TextCoverageReport($coverage, $this);
+ echo $reporter->report();
+ }
+
+}
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/footer.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/footer.php
new file mode 100644
index 0000000..06af88e
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/footer.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Short description for file.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
+ * @package Cake.TestSuite.templates
+ * @since CakePHP(tm) v 1.2.0.4433
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?> </div>
+ </div>
+ <div id="footer">
+ <p>
+ <!--PLEASE USE ONE OF THE POWERED BY CAKEPHP LOGO-->
+ <a href="http://www.cakephp.org/" target="_blank">
+ <img src="<?php echo $baseDir; ?>img/cake.power.gif" alt="CakePHP(tm) :: Rapid Development Framework" /></a>
+ </p>
+ </div>
+ <?php
+ App::uses('View', 'View');
+ $null = null;
+ $View = new View($null, false);
+ echo $View->element('sql_dump');
+ ?>
+ </div>
+</body>
+</html> \ No newline at end of file
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/header.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/header.php
new file mode 100644
index 0000000..4d41719
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/header.php
@@ -0,0 +1,146 @@
+<?php
+/**
+ * Short description for file.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
+ * @package Cake.TestSuite.templates
+ * @since CakePHP(tm) v 1.2.0.4433
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>CakePHP Test Suite 2.2</title>
+ <style type="text/css">
+ body h2 {color: #777;}
+ h3 {font-size: 170%; padding-top: 1em}
+ a {font-size: 120%}
+ li {line-height: 140%}
+ .test-menu {float:left; margin-right: 24px;}
+ .test-results {float:left; width: 67%;}
+ ul.tests {margin: 0; font-size:12px;}
+ ul.tests li {
+ list-style: none;
+ margin: 14px 0;
+ padding-left: 20px;
+ }
+ ul.tests li span {
+ font-size:14px;
+ text-transform: uppercase;
+ font-weight: bold;
+ }
+ ul.tests li.pass span, ul.tests li.skipped span { display:inline;}
+ ul.tests li.fail span { color: red; }
+ ul.tests li.pass span { color: green; }
+ ul.tests li.skipped span { color: navy; }
+ ul.tests li.error span { color : #d15d00; }
+
+ ul.tests li.pass,
+ ul.tests li.error,
+ ul.tests li.skipped,
+ ul.tests li.fail {
+ background: #fff2f2 url(<?php echo $baseDir; ?>img/test-fail-icon.png) 5px 5px no-repeat;
+ border-top: 1px dotted red;
+ border-bottom: 1px dotted red;
+ padding:5px 10px 2px 25px;
+ }
+ ul.tests li.pass {
+ background-color: #f2fff2;
+ background-image: url(<?php echo $baseDir; ?>img/test-pass-icon.png);
+ border-color:green;
+ }
+ ul.tests li.skipped {
+ background-color: #edf1ff;
+ background-image: url(<?php echo $baseDir; ?>img/test-skip-icon.png);
+ border-color:navy;
+ }
+ ul.tests li.error {
+ background-color: #ffffe5;
+ background-image: url(<?php echo $baseDir; ?>img/test-error-icon.png);
+ border-color: #DF6300;
+ }
+ ul.tests li div { margin: 5px 0 8px 0; }
+ ul.tests li div.msg { font-weight: bold; }
+ table caption { color:#fff; }
+
+ div.code-coverage-results div.code-line {
+ padding-left:5px;
+ display:block;
+ margin-left:10px;
+ }
+ .coverage-toggle {
+ float:right;
+ margin-top:10px;
+ font-size:12px;
+ }
+ .coverage-container {
+ margin-top:1em;
+ }
+ div.code-coverage-results div.uncovered span.content { background:#ecc; }
+ div.code-coverage-results div.covered span.content { background:#cec; }
+ div.code-coverage-results div.ignored span.content { color:#aaa; }
+ div.code-coverage-results div:hover {
+ background:#e8e8e8;
+ cursor: pointer;
+ }
+ div.code-coverage-results div.covered:hover span.content { background:#b4edb4;}
+ div.code-coverage-results div.uncovered:hover span.content { background:#edb4b4;}
+ div.code-coverage-results span.line-num {
+ color:#666;
+ display:block;
+ float:left;
+ width:20px;
+ text-align:right;
+ margin-right:5px;
+ }
+ div.code-coverage-results span.line-num strong { color:#666; }
+ div.code-coverage-results div.start {
+ border:1px solid #aaa;
+ border-width:1px 1px 0px 1px;
+ margin-top:30px;
+ padding-top:5px;
+ }
+ div.code-coverage-results div.end {
+ border:1px solid #aaa;
+ border-width:0px 1px 1px 1px;
+ margin-bottom:30px;
+ padding-bottom:5px;
+ }
+ div.code-coverage-results div.realstart { margin-top:0px; }
+ div.code-coverage-results p.note {
+ color:#bbb;
+ padding:5px;
+ margin:5px 0 10px;
+ font-size:10px;
+ }
+ div.code-coverage-results span.result-bad { color: #a00; }
+ div.code-coverage-results span.result-ok { color: #fa0; }
+ div.code-coverage-results span.result-good { color: #0a0; }
+
+ div#version {
+ padding-top: 2px;
+ float: right;
+ padding-left: 20px;
+ }
+ </style>
+ <link rel="stylesheet" type="text/css" href="<?php echo $baseDir; ?>css/cake.generic.css" />
+ </head>
+ <body>
+ <div id="container">
+ <div id="header">
+ <div id="version">PHPUnit: <?php echo class_exists('PHPUnit_Runner_Version') ? PHPUnit_Runner_Version::id() : 'n/a'; ?></div>
+ <h1>CakePHP: the rapid development php framework</h1>
+ </div>
+ <div id="content">
+ <h2>CakePHP Test Suite 2.2</h2>
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/menu.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/menu.php
new file mode 100644
index 0000000..df6ec41
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/menu.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * Short description for file.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
+ * @package Cake.TestSuite.templates
+ * @since CakePHP(tm) v 1.2.0.4433
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<div class="test-menu">
+<ul>
+ <li>
+ <span style="font-size: 18px">App</span>
+ <ul>
+ <li><a href='<?php echo $cases; ?>'>Tests</a></li>
+ </ul>
+ </li>
+<?php if (!empty($plugins)): ?>
+ <li style="padding-top: 10px">
+ <span style="font-size: 18px">Plugins</span>
+ <?php foreach ($plugins as $plugin): ?>
+ <ul>
+ <li style="padding-top: 10px">
+ <span style="font-size: 18px"><?php echo $plugin; ?></span>
+ <ul>
+ <li><?php printf('<a href="%s&amp;plugin=%s">Tests</a>', $cases, $plugin); ?></li>
+ </ul>
+ </li>
+ </ul>
+ <?php endforeach; ?>
+ </li>
+<?php endif; ?>
+ <li style="padding-top: 10px">
+ <span style="font-size: 18px">Core</span>
+ <ul>
+ <li><a href='<?php echo $cases; ?>&amp;core=true'>Tests</a></li>
+ </ul>
+ </li>
+</ul>
+</div>
+<div class="test-results">
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/missing_connection.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/missing_connection.php
new file mode 100644
index 0000000..fc9e3ca
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/missing_connection.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Missing Connection error page
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
+ * @package Cake.TestSuite.templates
+ * @since CakePHP(tm) v 1.2.0.4433
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<?php include dirname(__FILE__) . DS . 'header.php'; ?>
+<div id="content">
+ <h2>Missing Test Database Connection</h2>
+ <h3><?php echo $exception->getMessage(); ?></h3>
+ <pre><?php echo $exception->getTraceAsString(); ?></pre>
+</div>
+<?php
+include dirname(__FILE__) . DS . 'footer.php';
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/phpunit.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/phpunit.php
new file mode 100644
index 0000000..ae111f7
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/phpunit.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Missing PHPUnit
+ * error page.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
+ * @package Cake.TestSuite.templates
+ * @since CakePHP(tm) v 1.2.0.4433
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<?php include dirname(__FILE__) . DS . 'header.php'; ?>
+<div id="content">
+ <h2>PHPUnit is not installed!</h2>
+ <p>You must install PHPUnit to use the CakePHP(tm) Test Suite.</p>
+ <p>PHPUnit can be installed with pear, using the pear installer.</p>
+ <p>To install with the PEAR installer run the following commands:</p>
+ <ul>
+ <li><code>pear config-set auto_discover 1</code></li>
+ <li><code>pear install pear.phpunit.de/PHPUnit</code></li>
+ </ul>
+ <p>Once PHPUnit is installed make sure its located on PHP's <code>include_path</code> by checking your php.ini</p>
+ <p>For full instructions on how to <a href="http://www.phpunit.de/manual/current/en/installation.html" target="_blank">install PHPUnit, see the PHPUnit installation guide</a>.</p>
+ <p><a href="http://github.com/sebastianbergmann/phpunit" target="_blank">Download PHPUnit</a></p>
+</div>
+<?php
+include dirname(__FILE__) . DS . 'footer.php';
diff --git a/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/xdebug.php b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/xdebug.php
new file mode 100644
index 0000000..ecf24cb
--- /dev/null
+++ b/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/TestSuite/templates/xdebug.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Xdebug error page
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
+ * @package Cake.TestSuite.templates
+ * @since CakePHP(tm) v 1.2.0.4433
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<?php include dirname(__FILE__) . DS . 'header.php'; ?>
+<div id="content">
+ <h2>Xdebug is not installed</h2>
+ <p>You must install Xdebug to use the CakePHP(tm) Code Coverage Analyzation.</p>
+ <p><a href="http://www.xdebug.org/docs/install" target="_blank">Learn How To Install Xdebug</a></p>
+</div>
+<?php
+include dirname(__FILE__) . DS . 'footer.php';
+