Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch '1.0.0'

  • Loading branch information...
commit bfe43fb36b32a1a42311306ffd5d83f97aeac814 2 parents 74b6c97 + ac1b228
Paul M. Jones pmjones authored

Showing 44 changed files with 167 additions and 3,456 deletions. Show diff stats Hide diff stats

  1. +0 9 .travis.yml
  2. +1 1  LICENSE
  3. +0 10 config/default.php
  4. +3 0  config/test.php
  5. +5 21 meta/changes.txt
  6. +15 15 meta/require.csv
  7. +1 0  src/Aura/Framework/Autoload/Loader.php
  8. +20 12 src/Aura/Framework/Bootstrap/Factory.php
  9. +10 2 src/Aura/Framework/Test/WiringAssertionsTrait.php
  10. +6 2 src/Aura/Framework/Web/Renderer/AuraViewTwoStep.php
  11. +2 24 tests/Aura/Framework/Bootstrap/FactoryTest.php
  12. +1 2  tests/Aura/Framework/Cli/AbstractCommandTest.php
  13. +0 33 tests/Aura/Framework/Cli/CacheClassmap/CommandTest.php
  14. +0 35 tests/Aura/Framework/Cli/CacheConfig/CommandTest.php
  15. +0 34 tests/Aura/Framework/Cli/Server/CommandTest.php
  16. +18 0 tests/Aura/Framework/Mock/Controller.php
  17. +2 0  tests/Aura/Framework/Mock/NotFound.php
  18. +4 90 tests/Aura/Framework/Mock/Page.php
  19. 0  tests/Aura/Framework/Mock/{layout → layouts}/default.php
  20. 0  tests/Aura/Framework/Mock/{view → views}/index.php
  21. +12 35 tests/Aura/Framework/SystemTest.php
  22. +0 20 tests/Aura/Framework/VfsSystem.php
  23. +5 22 tests/Aura/Framework/Web/Controller/FactoryTest.php
  24. +24 15 tests/Aura/Framework/Web/Controller/FrontTest.php
  25. +0 9 tests/Aura/Framework/Web/MockPage.php
  26. +2 2 tests/Aura/Framework/Web/NotFound/PageTest.php
  27. +31 26 tests/Aura/Framework/Web/Renderer/AuraViewTwoStepTest.php
  28. +1 1  tests/WiringTest.php
  29. +3 49 tests/bootstrap.php
  30. +0 87 tests/org/bovigo/vfs/Quota.php
  31. +0 389 tests/org/bovigo/vfs/vfsStream.php
  32. +0 375 tests/org/bovigo/vfs/vfsStreamAbstractContent.php
  33. +0 62 tests/org/bovigo/vfs/vfsStreamContainer.php
  34. +0 90 tests/org/bovigo/vfs/vfsStreamContainerIterator.php
  35. +0 182 tests/org/bovigo/vfs/vfsStreamContent.php
  36. +0 235 tests/org/bovigo/vfs/vfsStreamDirectory.php
  37. +0 20 tests/org/bovigo/vfs/vfsStreamException.php
  38. +0 327 tests/org/bovigo/vfs/vfsStreamFile.php
  39. +0 932 tests/org/bovigo/vfs/vfsStreamWrapper.php
  40. +0 45 tests/org/bovigo/vfs/visitor/vfsStreamAbstractVisitor.php
  41. +0 93 tests/org/bovigo/vfs/visitor/vfsStreamPrintVisitor.php
  42. +0 98 tests/org/bovigo/vfs/visitor/vfsStreamStructureVisitor.php
  43. +0 46 tests/org/bovigo/vfs/visitor/vfsStreamVisitor.php
  44. +1 6 tests/phpunit.xml
9 .travis.yml
... ... @@ -1,9 +0,0 @@
1   -language: php
2   -php:
3   - - 5.4
4   -before_script:
5   - - git clone https://github.com/auraphp/system.git
6   - - cd system
7   - - composer update
8   - - cd package/Aura.Framework/tests
9   -script: phpunit
2  LICENSE
... ... @@ -1,4 +1,4 @@
1   -Copyright (c) 2012, The Aura Project for PHP
  1 +Copyright (c) 2011-2013, Aura for PHP
2 2 All rights reserved.
3 3
4 4 Redistribution and use in source and binary forms, with or without
10 config/default.php
@@ -40,11 +40,6 @@
40 40 $di->params['Aura\Framework\Bootstrap\Web']['http_transport'] = $di->lazyGet('http_transport');
41 41
42 42 /**
43   - * Aura\Framework\Cli\AbstractCommand
44   - */
45   -$di->setter['Aura\Framework\Cli\AbstractCommand']['setSignal'] = $di->lazyGet('signal_manager');
46   -
47   -/**
48 43 * Aura\Framework\Cli\CacheClassmap\Command
49 44 */
50 45 $di->setter['Aura\Framework\Cli\CacheClassmap\Command']['setSystem'] = $di->lazyGet('framework_system');
@@ -68,11 +63,6 @@
68 63 $di->setter['Aura\Framework\Cli\Server\Command']['setSystem'] = $di->lazyGet('framework_system');
69 64
70 65 /**
71   - * Aura\Framework\Cli\Server\Command
72   - */
73   -$di->setter['Aura\Framework\Input\Form']['setFilter'] = $di->lazyNew('Aura\Filter\RuleCollection');
74   -
75   -/**
76 66 * Aura\Framework\View\Helper\AssetHref
77 67 */
78 68 $di->setter['Aura\Framework\View\Helper\AssetHref']['setBase'] = '/asset';
3  config/test.php
@@ -3,3 +3,6 @@
3 3 * Loader
4 4 */
5 5 $loader->add('Aura\Framework\\', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'tests');
  6 +
  7 +// PHPUnit adds its own autoloader, so don't throw exceptions
  8 +$loader->setMode($loader::MODE_SILENT);
26 meta/changes.txt
... ... @@ -1,25 +1,9 @@
1   -(This list includes the changes from 1.0.0-beta5 and 6, which had problems with their composer.json files.)
  1 +- [TST] Added PHP 5.5 to the Travis-CI build.
2 2
3   -- [ADD] Re-add View\Helper\AssetHref and Web\Asset.
  3 +- [DOC] Update license and add Travis build status badge.
4 4
5   -- [FIX] In tests, replaced static Unix-Style Directory Seperators with dynamic ones from PHPs DIRECTORY_SEPARATOR Constant; else all tests would fail on Windows environments.
  5 +- [CHG] Update config files to remove unneeded setters.
6 6
7   -- [BRK] In front controller, add a session manager param to the constructor, and commit the session at the end of exec().
  7 +- [CHG] Bootstrap\Factory::newInstance() and prep() now have a $silent_loader'
  8 + param; when true, this forces the autoloader into MODE_SILENT for testing
8 9
9   -- [FIX] In front controller, make allowances for index.php in the path.
10   -
11   -- [FIX] In Bootstrap\Factory, load system-level default config, and then system-level mode config, instead of just the mode without default. (fixes #29)
12   -
13   -- [NEW] Aura\Framework\Intl\Translator to implement a separated interface.
14   -
15   -- [FIX] Make allowances for non-integer return codes in Bootstrap\Cli.
16   -
17   -- [FIX] In Bootstrap\Factory, don't read the same $mode file twice. read 'default' then whatever the non-default mode is. closes #32. thanks @ammmze
18   -
19   -- [FIX] In Bootstrap\Factory, instead of overriding the include path, prepend it with the system include directory
20   -
21   -- [NEW] Test\WiringAssertionsTrait for wiring test assertions.
22   -
23   -- [NEW] Input\Filter to implement separated interface.
24   -
25   -- [CHG] In Bootstrap\Factory::prep(), use null mode by default
30 meta/require.csv
... ... @@ -1,17 +1,17 @@
1 1 php,>=5.4.0
2 2 aura/installer-default,>=1.0.0
3   -aura/autoload,>=1.0.1
4   -aura/cli,>=1.1.0
5   -aura/di,>=1.1.0
6   -aura/filter,>=1.0.0beta2
7   -aura/http,>=1.0.1
8   -aura/input,>=1.0.0beta1
9   -aura/intl,>=1.0.0beta2
10   -aura/marshal,>=1.1.0
11   -aura/router,>=1.1.0
12   -aura/session,>=1.0.0
13   -aura/signal,>=1.0.1
14   -aura/sql,>=1.1.0
15   -aura/uri,>=1.1.0
16   -aura/view,>=1.1.2
17   -aura/web,>=1.0.1
  3 +aura/autoload,>=1.0.2
  4 +aura/cli,>=1.1.1
  5 +aura/di,>=1.1.1
  6 +aura/filter,>=1.0.0
  7 +aura/http,>=1.0.2
  8 +aura/input,>=1.0.0
  9 +aura/intl,>=1.0.0
  10 +aura/marshal,>=1.1.1
  11 +aura/router,>=1.1.1
  12 +aura/session,>=1.0.1
  13 +aura/signal,>=1.0.2
  14 +aura/sql,>=1.2.0
  15 +aura/uri,>=1.1.1
  16 +aura/view,>=1.2.0
  17 +aura/web,>=1.0.2
1  src/Aura/Framework/Autoload/Loader.php
@@ -46,6 +46,7 @@ public function prep(System $system)
46 46 $classes = $read($file, $system);
47 47 $this->setClasses($classes);
48 48 } else {
  49 + $this->add('Aura\Di\\', $system->getPackagePath('Aura.Di/src'));
49 50 $this->add('Aura\Framework\\', $system->getPackagePath('Aura.Framework/src'));
50 51 }
51 52
32 src/Aura/Framework/Bootstrap/Factory.php
@@ -10,6 +10,9 @@
10 10 */
11 11 namespace Aura\Framework\Bootstrap;
12 12
  13 +use Aura\Di\Config;
  14 +use Aura\Di\Container;
  15 +use Aura\Di\Forge;
13 16 use Aura\Framework\Autoload\Loader;
14 17 use Aura\Framework\System;
15 18 use Exception;
@@ -75,12 +78,15 @@ public function __construct($root = null, array $map = null)
75 78 *
76 79 * @param string $mode The config mode to use.
77 80 *
  81 + * @param bool $silent_loader Force the autoloader to MODE_SILENT; this is
  82 + * useful primarily for testing purposes.
  83 + *
78 84 * @return object A bootstrapper.
79 85 *
80 86 */
81   - public function newInstance($type, $mode = null)
  87 + public function newInstance($type, $mode = null, $silent_loader = false)
82 88 {
83   - $di = $this->prep($mode);
  89 + $di = $this->prep($mode, $silent_loader);
84 90 $class = $this->map[$type];
85 91 return $di->newInstance($class);
86 92 }
@@ -92,35 +98,37 @@ public function newInstance($type, $mode = null)
92 98 *
93 99 * @param string $mode The config mode.
94 100 *
  101 + * @param bool $silent_loader Force the autoloader to MODE_SILENT; this is
  102 + * useful primarily for testing purposes.
  103 + *
95 104 * @return \Aura\Di\Container A dependency injection container.
96 105 *
97 106 */
98   - public function prep($mode = null)
  107 + public function prep($mode = null, $silent_loader = false)
99 108 {
100 109 // turn up error reporting
101 110 error_reporting(E_ALL);
102 111 ini_set('display_errors', true);
103 112 ini_set('html_errors', false);
104 113
105   - // create the system object
  114 + // create the system object and prepend to include path
106 115 require_once dirname(__DIR__) . '/System.php';
107 116 $system = new System($this->root);
108   -
109   - // prepend to the include path
110 117 set_include_path($system->getIncludePath() . PATH_SEPARATOR . get_include_path());
111 118
112   - // requires
  119 + // create the autoloader
113 120 require_once $system->getPackagePath('Aura.Autoload/src.php');
114 121 require_once $system->getPackagePath('Aura.Framework/src/Aura/Framework/Autoload/Loader.php');
115   -
116   - // set the DI container object
117   - $di = require_once $system->getPackagePath('Aura.Di/scripts/instance.php');
118   -
119   - // set the autoloader
120 122 $loader = new Loader;
121 123 $loader->prep($system);
  124 + if ($silent_loader) {
  125 + $loader->setMode($loader::MODE_SILENT);
  126 + }
122 127 $loader->register();
123 128
  129 + // create the DI container
  130 + $di = new Container(new Forge(new Config));
  131 +
124 132 // set framework services
125 133 $di->set('framework_system', $system);
126 134 $di->set('framework_loader', $loader);
12 src/Aura/Framework/Test/WiringAssertionsTrait.php
@@ -32,14 +32,22 @@
32 32
33 33 /**
34 34 *
35   - * Loads the $di property from the global variable $AURA_FRAMEWORK_DI.
  35 + * Loads the $di property.
36 36 *
37 37 * @return void
38 38 *
39 39 */
40 40 protected function loadDi()
41 41 {
42   - $this->di = $GLOBALS['AURA_FRAMEWORK_DI'];
  42 + // prep the framework in 'test' mode via the bootstrap factory
  43 + // and get back the DI container
  44 + $factory = new \Aura\Framework\Bootstrap\Factory;
  45 + $this->di = $factory->prep('test');
  46 +
  47 + // set the loader mode so that missing PHPUnit files don't blow up the tests;
  48 + // there are issues with PHP_Invoker
  49 + $loader = $this->di->get('framework_loader');
  50 + $loader->setMode(\Aura\Autoload\Loader::MODE_SILENT);
43 51 }
44 52
45 53 /**
8 src/Aura/Framework/Web/Renderer/AuraViewTwoStep.php
@@ -145,17 +145,21 @@ public function setController(ControllerInterface $controller)
145 145 */
146 146 public function exec()
147 147 {
  148 + // set any explicit format from the controller
148 149 $this->twostep->setFormat($this->controller->getFormat());
149   -
  150 +
  151 + // is there already response content?
150 152 $response = $this->controller->getResponse();
151 153 if (! $response->getContent()) {
  154 + // no, render the two-step view into the response content
152 155 $this->twostep->setData((array) $this->controller->getData());
153 156 $this->twostep->setAccept($this->accept->getContentType());
154 157 $this->twostep->setInnerView($this->controller->getView());
155 158 $this->twostep->setOuterView($this->controller->getLayout());
156 159 $response->setContent($this->twostep->render());
157 160 }
158   -
  161 +
  162 + // set the response content-type
159 163 $response->setContentType($this->twostep->getContentType());
160 164 }
161 165 }
26 tests/Aura/Framework/Bootstrap/FactoryTest.php
... ... @@ -1,20 +1,10 @@
1 1 <?php
2 2 namespace Aura\Framework\Bootstrap;
3 3
4   -/**
5   - * Generated by PHPUnit_SkeletonGenerator 1.2.0 on 2012-11-20 at 08:18:01.
6   - */
7 4 class FactoryTest extends \PHPUnit_Framework_TestCase
8 5 {
9   - /**
10   - * @var Factory
11   - */
12 6 protected $factory;
13 7
14   - /**
15   - * Sets up the fixture, for example, opens a network connection.
16   - * This method is called before a test is executed.
17   - */
18 8 protected function setUp()
19 9 {
20 10 // use the real system root
@@ -23,21 +13,9 @@ protected function setUp()
23 13 $this->factory = new Factory($root, $map);
24 14 }
25 15
26   - /**
27   - * Tears down the fixture, for example, closes a network connection.
28   - * This method is called after a test is executed.
29   - */
30   - protected function tearDown()
  16 + public function testNewInstance()
31 17 {
32   - }
33   -
34   - /**
35   - * @covers Aura\Framework\Bootstrap::exec
36   - * @todo Implement testExec().
37   - */
38   - public function testExec()
39   - {
40   - $bootstrap = $this->factory->newInstance('mock');
  18 + $bootstrap = $this->factory->newInstance('mock', 'test', true);
41 19 $this->assertInstanceOf('Aura\Framework\Mock\Bootstrap', $bootstrap);
42 20 }
43 21 }
3  tests/Aura/Framework/Cli/AbstractCommandTest.php
@@ -12,7 +12,6 @@
12 12 use Aura\Signal\ResultFactory;
13 13 use Aura\Signal\ResultCollection;
14 14 use Aura\Framework\System;
15   -use Aura\Framework\VfsSystem;
16 15 use Aura\Framework\Intl\Translator;
17 16 use Aura\Intl\BasicFormatter;
18 17
@@ -42,7 +41,7 @@
42 41
43 42 protected function setUp()
44 43 {
45   - $root = VfsSystem::create('root');
  44 + $root = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__))))));
46 45 $this->system = new System($root);
47 46 }
48 47
33 tests/Aura/Framework/Cli/CacheClassmap/CommandTest.php
... ... @@ -1,33 +0,0 @@
1   -<?php
2   -namespace Aura\Framework\Cli\CacheClassmap;
3   -
4   -use Aura\Framework\Cli\AbstractCommandTest;
5   -
6   -/**
7   - * Test class for Command.
8   - * Generated by PHPUnit on 2011-10-06 at 15:19:38.
9   - */
10   -class CommandTest extends AbstractCommandTest
11   -{
12   - protected $command_class = '\Aura\Framework\Cli\CacheClassmap\Command';
13   -
14   - protected function newCommand($argv = [], $system_dir = null)
15   - {
16   - $command = parent::newCommand($argv, $system_dir);
17   - $command->setSystem($this->system);
18   - return $command;
19   - }
20   -
21   - /**
22   - * @todo Implement testAction().
23   - */
24   - public function testAction()
25   - {
26   - $command = $this->newCommand();
27   -
28   - // Remove the following lines when you implement this test.
29   - $this->markTestIncomplete(
30   - 'This test has not been implemented yet.'
31   - );
32   - }
33   -}
35 tests/Aura/Framework/Cli/CacheConfig/CommandTest.php
... ... @@ -1,35 +0,0 @@
1   -<?php
2   -namespace Aura\Framework\Cli\CacheConfig;
3   -use Aura\Framework\Cli\AbstractCommandTest;
4   -
5   -/**
6   - * Test class for Command.
7   - * Generated by PHPUnit on 2011-10-06 at 15:19:38.
8   - */
9   -class CommandTest extends AbstractCommandTest
10   -{
11   - /**
12   - * @var Command
13   - */
14   - protected $command_class = '\Aura\Framework\Cli\CacheConfig\Command';
15   -
16   - protected function newCommand($argv = [], $system_dir = null)
17   - {
18   - $command = parent::newCommand($argv, $system_dir);
19   - $command->setSystem($this->system);
20   - return $command;
21   - }
22   -
23   - /**
24   - * @todo Implement testAction().
25   - */
26   - public function testAction()
27   - {
28   - $command = $this->newCommand();
29   -
30   - // Remove the following lines when you implement this test.
31   - $this->markTestIncomplete(
32   - 'This test has not been implemented yet.'
33   - );
34   - }
35   -}
34 tests/Aura/Framework/Cli/Server/CommandTest.php
... ... @@ -1,34 +0,0 @@
1   -<?php
2   -namespace Aura\Framework\Cli\Server;
3   -
4   -use Aura\Framework\Cli\AbstractCommandTest;
5   -
6   -/**
7   - * Generated by PHPUnit_SkeletonGenerator 1.2.0 on 2012-11-20 at 11:31:13.
8   - */
9   -class CommandTest extends AbstractCommandTest
10   -{
11   - /**
12   - * @covers Aura\Framework\Cli\Server\Command::setPhp
13   - * @todo Implement testSetPhp().
14   - */
15   - public function testSetPhp()
16   - {
17   - // Remove the following lines when you implement this test.
18   - $this->markTestIncomplete(
19   - 'This test has not been implemented yet.'
20   - );
21   - }
22   -
23   - /**
24   - * @covers Aura\Framework\Cli\Server\Command::action
25   - * @todo Implement testAction().
26   - */
27   - public function testAction()
28   - {
29   - // Remove the following lines when you implement this test.
30   - $this->markTestIncomplete(
31   - 'This test has not been implemented yet.'
32   - );
33   - }
34   -}
18 tests/Aura/Framework/Mock/Controller.php
... ... @@ -0,0 +1,18 @@
  1 +<?php
  2 +namespace Aura\Framework\Mock;
  3 +
  4 +use Aura\Web\Response;
  5 +
  6 +class Controller {
  7 +
  8 + public function __construct()
  9 + {
  10 + }
  11 +
  12 + public function exec()
  13 + {
  14 + $response = new Response;
  15 + $response->setContent(__METHOD__);
  16 + return $response;
  17 + }
  18 +}
2  tests/Aura/Framework/Mock/NotFound.php
... ... @@ -1,6 +1,8 @@
1 1 <?php
2 2 namespace Aura\Framework\Mock;
  3 +
3 4 use Aura\Web\Response;
  5 +
4 6 class NotFound {
5 7
6 8 public function __construct()
94 tests/Aura/Framework/Mock/Page.php
@@ -2,98 +2,12 @@
2 2 namespace Aura\Framework\Mock;
3 3
4 4 use Aura\Web\Response;
5   -use Aura\Web\Controller\ControllerInterface;
  5 +use Aura\Framework\Web\Controller\AbstractPage;
6 6
7   -class Page implements ControllerInterface
  7 +class Page extends AbstractPage
8 8 {
9   -
10   - public function __construct()
  9 + public function setView($view)
11 10 {
12   - }
13   -
14   - /**
15   - *
16   - * Returns the Accept object.
17   - *
18   - * @return Accept
19   - *
20   - */
21   - public function getAccept()
22   - {
23   -
24   - }
25   -
26   - /**
27   - *
28   - * Returns the Context object.
29   - *
30   - * @return Context
31   - *
32   - */
33   - public function getContext()
34   - {
35   -
36   - }
37   -
38   - /**
39   - *
40   - * Returns the data collection object.
41   - *
42   - * @return object
43   - *
44   - */
45   - public function getData()
46   - {
47   -
48   - }
49   -
50   - /**
51   - *
52   - * Returns the params.
53   - *
54   - * @return array
55   - *
56   - */
57   - public function getParams()
58   - {
59   -
60   - }
61   -
62   - /**
63   - *
64   - * Returns the Response object.
65   - *
66   - * @return Response
67   - *
68   - */
69   - public function getResponse()
70   - {
71   -
72   - }
73   -
74   - /**
75   - *
76   - * Returns the SignalInterface object.
77   - *
78   - * @return SignalInterface
79   - *
80   - */
81   - public function getSignal()
82   - {
83   -
84   - }
85   -
86   - /**
87   - *
88   - * Executes the controller.
89   - *
90   - * @return Response
91   - *
92   - */
93   - public function exec()
94   - {
95   - $response = new Response;
96   - $response->setContent(__METHOD__);
97   - return $response;
  11 + $this->view = $view;
98 12 }
99 13 }
0  tests/Aura/Framework/Mock/layout/default.php → tests/Aura/Framework/Mock/layouts/default.php
File renamed without changes
0  tests/Aura/Framework/Mock/view/index.php → tests/Aura/Framework/Mock/views/index.php
File renamed without changes
47 tests/Aura/Framework/SystemTest.php
@@ -3,30 +3,22 @@
3 3
4 4 use Aura\Framework\VfsSystem;
5 5
6   -/**
7   - * Test class for System.
8   - */
9 6 class SystemTest extends \PHPUnit_Framework_TestCase
10 7 {
11   - /**
12   - * @var System
13   - */
14 8 protected $system;
15 9
16   - /**
17   - * Sets up the fixture, for example, opens a network connection.
18   - * This method is called before a test is executed.
19   - */
  10 + protected $root;
  11 +
20 12 public function setUp()
21 13 {
22 14 parent::setUp();
23   - $root = VfsSystem::create('root');
24   - $this->system = new System($root);
  15 + $this->root = dirname(dirname(dirname(dirname(dirname(__DIR__)))));
  16 + $this->system = new System($this->root);
25 17 }
26 18
27 19 public function testGetRootPath()
28 20 {
29   - $expect = 'vfs://root';
  21 + $expect = $this->root;
30 22 $actual = $this->system->getRootPath();
31 23 $this->assertSame($expect, $actual);
32 24
@@ -40,17 +32,14 @@ public function testGetRootPath()
40 32
41 33 public function test__toString()
42 34 {
43   - $expect = 'vfs://root';
  35 + $expect = $this->root;
44 36 $actual = (string) $this->system;
45 37 $this->assertSame($expect, $actual);
46 38 }
47 39
48   - /**
49   - * @todo Implement testGetPackagePath().
50   - */
51 40 public function testGetPackagePath()
52 41 {
53   - $expect = 'vfs://root' . DIRECTORY_SEPARATOR . 'package';
  42 + $expect = $this->root . DIRECTORY_SEPARATOR . 'package';
54 43 $actual = $this->system->getPackagePath();
55 44 $this->assertSame($expect, $actual);
56 45
@@ -61,12 +50,9 @@ public function testGetPackagePath()
61 50 $this->assertSame($expect, $actual);
62 51 }
63 52
64   - /**
65   - * @todo Implement testGetTmpPath().
66   - */
67 53 public function testGetTmpPath()
68 54 {
69   - $expect = 'vfs://root' . DIRECTORY_SEPARATOR . 'tmp';
  55 + $expect = $this->root . DIRECTORY_SEPARATOR . 'tmp';
70 56 $actual = $this->system->getTmpPath();
71 57 $this->assertSame($expect, $actual);
72 58
@@ -77,12 +63,9 @@ public function testGetTmpPath()
77 63 $this->assertSame($expect, $actual);
78 64 }
79 65
80   - /**
81   - * @todo Implement testGetWebPath().
82   - */
83 66 public function testGetWebPath()
84 67 {
85   - $expect = 'vfs://root' . DIRECTORY_SEPARATOR . 'web';
  68 + $expect = $this->root . DIRECTORY_SEPARATOR . 'web';
86 69 $actual = $this->system->getWebPath();
87 70 $this->assertSame($expect, $actual);
88 71
@@ -93,12 +76,9 @@ public function testGetWebPath()
93 76 $this->assertSame($expect, $actual);
94 77 }
95 78
96   - /**
97   - * @todo Implement testGetConfigPath().
98   - */
99 79 public function testGetConfigPath()
100 80 {
101   - $expect = 'vfs://root' . DIRECTORY_SEPARATOR . 'config';
  81 + $expect = $this->root . DIRECTORY_SEPARATOR . 'config';
102 82 $actual = $this->system->getConfigPath();
103 83 $this->assertSame($expect, $actual);
104 84
@@ -109,12 +89,9 @@ public function testGetConfigPath()
109 89 $this->assertSame($expect, $actual);
110 90 }
111 91
112   - /**
113   - * @todo Implement testGetIncludePath().
114   - */
115 92 public function testGetIncludePath()
116 93 {
117   - $expect = 'vfs://root' . DIRECTORY_SEPARATOR . 'include';
  94 + $expect = $this->root . DIRECTORY_SEPARATOR . 'include';
118 95 $actual = $this->system->getIncludePath();
119 96 $this->assertSame($expect, $actual);
120 97
@@ -128,7 +105,7 @@ public function testGetIncludePath()
128 105 public function testGetVendorPath()
129 106 {
130 107
131   - $expect = 'vfs://root' . DIRECTORY_SEPARATOR . 'vendor';
  108 + $expect = $this->root . DIRECTORY_SEPARATOR . 'vendor';
132 109 $actual = $this->system->getVendorPath();
133 110 $this->assertSame($expect, $actual);
134 111
20 tests/Aura/Framework/VfsSystem.php
... ... @@ -1,20 +0,0 @@
1   -<?php
2   -namespace Aura\Framework;
3   -
4   -use org\bovigo\vfs\vfsStream as Vfs;
5   -
6   -class VfsSystem
7   -{
8   - public static function create($root)
9   - {
10   - Vfs::setup($root);
11   - $root = Vfs::url($root);
12   - mkdir("$root/config");
13   - mkdir("$root/include");
14   - mkdir("$root/package");
15   - mkdir("$root/vendor");
16   - mkdir("$root/web");
17   - mkdir("$root/tmp");
18   - return $root;
19   - }
20   -}
27 tests/Aura/Framework/Web/Controller/FactoryTest.php
@@ -4,21 +4,10 @@
4 4 use Aura\Di\Config;
5 5 use Aura\Di\Forge;
6 6
7   -/**
8   - * Test class for ControllerFactory.
9   - * Generated by PHPUnit on 2011-03-19 at 15:01:06.
10   - */
11 7 class FactoryTest extends \PHPUnit_Framework_TestCase
12 8 {
13   - /**
14   - * @var Factory
15   - */
16 9 protected $factory;
17 10
18   - /**
19   - * Sets up the fixture, for example, opens a network connection.
20   - * This method is called before a test is executed.
21   - */
22 11 public function setUp()
23 12 {
24 13 parent::setUp();
@@ -32,36 +21,30 @@ protected function newFactory(array $map = [], $not_found = null)
32 21 $not_found
33 22 );
34 23 }
35   - /**
36   - * Tears down the fixture, for example, closes a network connection.
37   - * This method is called after a test is executed.
38   - */
  24 +
39 25 public function tearDown()
40 26 {
41 27 parent::tearDown();
42 28 }
43 29
44   - /**
45   - * @todo Implement testNewInstance().
46   - */
47 30 public function testNewInstance()
48 31 {
49 32 $factory = $this->newFactory([
50   - 'mock' => 'Aura\Framework\Mock\Page',
  33 + 'mock' => 'StdClass',
51 34 ]);
52 35 $name = 'mock';
53 36 $params = [];
54 37 $controller = $factory->newInstance($name, $params);
55   - $this->assertInstanceOf('Aura\Framework\Mock\Page', $controller);
  38 + $this->assertInstanceOf('StdClass', $controller);
56 39 }
57 40
58 41 public function testNewInstanceNotFound()
59 42 {
60   - $factory = $this->newFactory([], 'Aura\Framework\Mock\Page');
  43 + $factory = $this->newFactory([], 'StdClass');
61 44 $name = 'no-such-name';
62 45 $params = [];
63 46 $controller = $factory->newInstance($name, $params);
64   - $this->assertInstanceOf('Aura\Framework\Mock\Page', $controller);
  47 + $this->assertInstanceOf('StdClass', $controller);
65 48 }
66 49
67 50 public function testNewInstanceException()
39 tests/Aura/Framework/Web/Controller/FrontTest.php
@@ -41,17 +41,13 @@ class FrontTest extends \PHPUnit_Framework_TestCase
41 41
42 42 protected $front;
43 43
44   - /**
45   - * Sets up the fixture, for example, opens a network connection.
46   - * This method is called before a test is executed.
47   - */
48   - protected function newFront($path_info)
  44 + protected function newFront($request_uri)
49 45 {
50 46 parent::setUp();
51 47
52 48 $this->signal = new SignalManager(new HandlerFactory, new ResultFactory, new ResultCollection);
53 49
54   - $_SERVER['REQUEST_URI'] = $path_info;
  50 + $_SERVER['REQUEST_URI'] = $request_uri;
55 51 $this->context = new Context($GLOBALS);
56 52
57 53 $this->router = new RouterMap(new DefinitionFactory, new RouteFactory);
@@ -63,7 +59,7 @@ protected function newFront($path_info)
63 59
64 60 $this->forge = new Forge(new Config);
65 61
66   - $map = ['mock' => 'Aura\Framework\Mock\Page'];
  62 + $map = ['mock' => 'Aura\Framework\Mock\Controller'];
67 63 $not_found = 'Aura\Framework\Mock\NotFound';
68 64 $this->factory = new Factory($this->forge, $map, $not_found);
69 65
@@ -81,18 +77,11 @@ protected function newFront($path_info)
81 77 );
82 78 }
83 79
84   - /**
85   - * Tears down the fixture, for example, closes a network connection.
86   - * This method is called after a test is executed.
87   - */
88 80 public function tearDown()
89 81 {
90 82 parent::tearDown();
91 83 }
92 84
93   - /**
94   - * @todo Implement test__get().
95   - */
96 85 public function test__get()
97 86 {
98 87 $front = $this->newFront('/');
@@ -108,7 +97,27 @@ public function testExec()
108 97 $front = $this->newFront('/mock');
109 98 $response = $front->exec();
110 99 $this->assertInstanceOf('Aura\Http\Message\Response', $response);
111   - $expect = "Aura\Framework\Mock\Page::exec";
  100 + $expect = "Aura\Framework\Mock\Controller::exec";
  101 + $actual = $response->getContent();
  102 + $this->assertSame($expect, $actual);
  103 + }
  104 +
  105 + public function testExec_indexPhp()
  106 + {
  107 + $front = $this->newFront('/index.php/mock');
  108 + $response = $front->exec();
  109 + $this->assertInstanceOf('Aura\Http\Message\Response', $response);
  110 + $expect = "Aura\Framework\Mock\Controller::exec";
  111 + $actual = $response->getContent();
  112 + $this->assertSame($expect, $actual);
  113 + }
  114 +
  115 + public function testExec_indexPhpEmpty()
  116 + {
  117 + $front = $this->newFront('/index.php');
  118 + $response = $front->exec();
  119 + $this->assertInstanceOf('Aura\Http\Message\Response', $response);
  120 + $expect = "Aura\Framework\Mock\NotFound::exec";
112 121 $actual = $response->getContent();
113 122 $this->assertSame($expect, $actual);
114 123 }
9 tests/Aura/Framework/Web/MockPage.php
... ... @@ -1,9 +0,0 @@
1   -<?php
2   -namespace Aura\Framework\Web;
3   -
4   -use Aura\Framework\Web\Controller\AbstractPage;
5   -
6   -class MockPage extends AbstractPage
7   -{
8   -
9   -}
4 tests/Aura/Framework/Web/NotFound/PageTest.php
@@ -25,10 +25,10 @@ public function testActionIndex()
25 25 </head>
26 26 <body>
27 27 <h1>404 Not Found</h1>
28   - <p>No controller found for <code>&#039;/&#039;</code></p>
  28 + <p>No controller found for <code>&#039;/no-such-controller&#039;</code></p>
29 29 <p>Please check that your config has:</p>
30 30 <ol>
31   - <li>An <code>Aura\Router\Map</code> route for the path <code>&#039;/&#039;</code></li>
  31 + <li>An <code>Aura\Router\Map</code> route for the path <code>&#039;/no-such-controller&#039;</code></li>
32 32 <li>A <code>['values']['controller']</code> value for the mapped route</li>
33 33 <li>
34 34 A <code>\$di->params['Aura\\Framework\\Web\\Controller\\Factory']['map']</code>
57 tests/Aura/Framework/Web/Renderer/AuraViewTwoStepTest.php
@@ -2,18 +2,21 @@
2 2 namespace Aura\Framework\Web\Renderer;
3 3
4 4 use Aura\Framework\Inflect;
  5 +use Aura\Framework\Mock\Page;
  6 +use Aura\Framework\Signal\Manager as SignalManager;
  7 +use Aura\Signal\HandlerFactory;
  8 +use Aura\Signal\ResultFactory;
  9 +use Aura\Signal\ResultCollection;
5 10 use Aura\View\EscaperFactory;
6 11 use Aura\View\FormatTypes;
7 12 use Aura\View\HelperLocator;
8 13 use Aura\View\Template;
9 14 use Aura\View\TemplateFinder;
10 15 use Aura\View\TwoStep;
11   -use Aura\Framework\Mock\Page;
12 16 use Aura\Web\Accept;
  17 +use Aura\Web\Context;
  18 +use Aura\Web\Response;
13 19
14   -/**
15   - * Generated by PHPUnit_SkeletonGenerator 1.2.0 on 2012-11-20 at 11:34:28.
16   - */
17 20 class AuraViewTwoStepTest extends \PHPUnit_Framework_TestCase
18 21 {
19 22 /**
@@ -37,37 +40,39 @@ protected function setUp()
37 40
38 41 // renderer
39 42 $this->renderer = new AuraViewTwoStep($twostep, new Inflect, new Accept($_SERVER));
  43 +
  44 + // page
  45 + $this->page = new Page(
  46 + new Context($GLOBALS),
  47 + new Accept($GLOBALS['_SERVER']),
  48 + new Response,
  49 + new SignalManager(
  50 + new HandlerFactory,
  51 + new ResultFactory,
  52 + new ResultCollection
  53 + ),
  54 + $this->renderer
  55 + );
40 56 }
41   -
42   - /**
43   - * @todo Implement test__call().
44   - */
  57 +
45 58 public function test__call()
46 59 {
47 60 $this->renderer->addInnerPath('/foo/bar');
48   - $expect = ['/foo/bar'];
  61 + $dir = dirname(dirname(__DIR__));
  62 + $expect = [
  63 + $dir . '/Mock/views',
  64 + '/foo/bar'
  65 + ];
49 66 $actual = $this->renderer->getInnerPaths();
50 67 $this->assertSame($expect, $actual);
51 68 }
52 69
53   - /**
54   - * @todo Implement testSetController().
55   - */
56   - public function testSetController()
57   - {
58   - $page = new Page;
59   - $this->renderer->setController($page);
60   -
61   - }
62   -
63   - /**
64   - * @todo Implement testExec().
65   - */
66 70 public function testExec()
67 71 {
68   - // Remove the following lines when you implement this test.
69   - $this->markTestIncomplete(
70   - 'This test has not been implemented yet.'
71   - );
  72 + $this->page->setView('index');
  73 + $this->renderer->exec();
  74 + $response = $this->page->getResponse();
  75 + $content = $response->getContent();
  76 + $this->assertSame('mock view', $content);
72 77 }
73 78 }
2  tests/WiringTest.php
@@ -31,7 +31,7 @@ public function testInstances()
31 31 $this->assertNewInstance('Aura\Framework\View\Helper\AssetHref');
32 32 $this->assertNewInstance('Aura\Framework\View\Helper\Route');
33 33 $this->assertNewInstance('Aura\Framework\Web\Asset\Page');
34   - $this->assertNewInstance('Aura\Framework\Web\Controller\AbstractPage', 'Aura\Framework\Web\MockPage');
  34 + $this->assertNewInstance('Aura\Framework\Web\Controller\AbstractPage', 'Aura\Framework\Mock\Page');
35 35 $this->assertNewInstance('Aura\Framework\Web\Controller\Factory');
36 36 $this->assertNewInstance('Aura\Framework\Web\Controller\Front');
37 37 $this->assertNewInstance('Aura\Framework\Web\Renderer\AuraViewTwoStep');
52 tests/bootstrap.php
... ... @@ -1,49 +1,3 @@
1   -<?php
2   -spl_autoload_register(function($class) {
3   -
4   - // split the class into namespace parts
5   - $parts = explode('\\', $class);
6   - if (count($parts) == 1) {
7   - return;
8   - }
9   -
10   - // the eventual filename
11   - $file = implode(DIRECTORY_SEPARATOR, $parts) . '.php';
12   -
13   - // look for a tests file (probably org\bovigo)
14   - $tmp = __DIR__ . DIRECTORY_SEPARATOR . $file;
15   - if (is_readable($tmp)) {
16   - require_once $tmp;
17   - return;
18   - }
19   -
20   - // the package dir for the class
21   - $dir = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . "{$parts[0]}.{$parts[1]}";
22   -
23   - // look for a package src file
24   - $tmp = $dir . DIRECTORY_SEPARATOR . 'src'. DIRECTORY_SEPARATOR . $file;
25   - if (is_readable($tmp)) {
26   - require_once $tmp;
27   - return;
28   - }
29   -
30   - // look for a package tests file
31   - $tmp = $dir . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . $file;
32   - if (is_readable($tmp)) {
33   - require_once $tmp;
34   - return;
35   - }
36   -
37   - // look in the include-path
38   - $dirs = explode(PATH_SEPARATOR, get_include_path());
39   - foreach ($dirs as $dir) {
40   - $tmp = $dir . DIRECTORY_SEPARATOR . $file;
41   - if (is_readable($tmp)) {
42   - require_once $tmp;
43   - return;
44   - }
45   - }
46   -});
47   -
48   -// load source files after autoload
49   -require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'src.php';
  1 +This package cannot be tested independently from an Aura system.
  2 +Please check out an Aura system and test it instead.
  3 +<?php exit(0); ?>
87 tests/org/bovigo/vfs/Quota.php
... ... @@ -1,87 +0,0 @@
1   -<?php
2   -/**
3   - * This file is part of vfsStream.
4   - *
5   - * For the full copyright and license information, please view the LICENSE
6   - * file that was distributed with this source code.
7   - *
8   - * @package org\bovigo\vfs
9   - */
10   -namespace org\bovigo\vfs;
11   -/**
12   - * Represents a quota for disk space.
13   - *
14   - * @since 1.1.0
15   - * @internal
16   - */
17   -class Quota
18   -{
19   - /**
20   - * unlimited quota
21   - */
22   - const UNLIMITED = -1;
23   - /**
24   - * quota in bytes
25   - *
26   - * A value of -1 is treated as unlimited.
27   - *
28   - * @type int
29   - */
30   - private $amount;
31   -
32   - /**
33   - * constructor
34   - *
35   - * @param int $amount quota in bytes
36   - */
37   - public function __construct($amount)
38   - {
39   - $this->amount = $amount;
40   - }
41   -
42   - /**
43   - * create with unlimited space
44   - *
45   - * @return Quota
46   - */
47   - public static function unlimited()
48   - {
49   - return new self(self::UNLIMITED);
50   - }
51   -
52   - /**
53   - * checks if a quota is set
54   - *
55   - * @return bool
56   - */
57   - public function isLimited()
58   - {
59   - return self::UNLIMITED < $this->amount;
60   - }
61   -