namespace OC\AppFramework;
-use OC\AppFramework\Http\Request;
-use OC\AppFramework\Core\API;
-use OC\AppFramework\Middleware\MiddlewareDispatcher;
-
-// FIXME: loading pimpl correctly from 3rdparty repo
-require_once __DIR__ . '/../../../3rdparty/Pimple/Pimple.php';
-//require_once __DIR__ . "/classloader.php";
-
class AppTest extends \PHPUnit_Framework_TestCase {
class MiddlewareDispatcherTest extends \PHPUnit_Framework_TestCase {
+ public $exception;
+ public $response;
+ private $out;
+ private $method;
+ private $controller;
+
+ /**
+ * @var MiddlewareDispatcher
+ */
private $dispatcher;
$this->controller = $this->getControllerMock();
$this->method = 'method';
$this->response = new Response();
- $this->output = 'hi';
+ $this->out = 'hi';
$this->exception = new \Exception();
}
public function testBeforeOutputCorrectArguments(){
$m1 = $this->getMiddleware();
- $this->dispatcher->beforeOutput($this->controller, $this->method, $this->output);
+ $this->dispatcher->beforeOutput($this->controller, $this->method, $this->out);
$this->assertEquals($this->controller, $m1->controller);
$this->assertEquals($this->method, $m1->methodName);
- $this->assertEquals($this->output, $m1->output);
+ $this->assertEquals($this->out, $m1->output);
}
$m1 = $this->getMiddleware();
$m2 = $this->getMiddleware();
- $this->dispatcher->beforeOutput($this->controller, $this->method, $this->output);
+ $this->dispatcher->beforeOutput($this->controller, $this->method, $this->out);
$this->assertEquals(2, $m1->beforeOutputOrder);
$this->assertEquals(1, $m2->beforeOutputOrder);
$this->dispatcher->registerMiddleware($m3);
- $this->dispatcher->beforeOutput($this->controller, $this->method, $this->output);
+ $this->dispatcher->beforeOutput($this->controller, $this->method, $this->out);
$this->assertEquals(2, $m1->beforeOutputOrder);
$this->assertEquals(1, $m2->beforeOutputOrder);