diff --git a/.travis.yml b/.travis.yml
index 6626cbfc2..34c2d1303 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,6 +32,11 @@ after_failure:
before_script:
# Install Nette Tester & Code Checker
- - composer self-update
- - composer update --no-interaction --dev --prefer-source $dependencies
- - composer create-project nette/code-checker code-checker ~2.2 --no-interaction --prefer-source
+ - travis_retry composer update --no-interaction --prefer-dist $dependencies
+ - travis_retry composer create-project nette/code-checker code-checker ~2.5 --no-interaction
+
+sudo: false
+
+cache:
+ directories:
+ - $HOME/.composer/cache
diff --git a/composer.json b/composer.json
index bf990b821..770ab4411 100644
--- a/composer.json
+++ b/composer.json
@@ -28,7 +28,7 @@
"require-dev": {
"nette/tester": "~1.3",
"nette/forms": "~2.2",
- "latte/latte": "~2.3"
+ "latte/latte": "~2.3.0"
},
"conflict": {
"nette/nette": "<2.2"
diff --git a/src/Application/Application.php b/src/Application/Application.php
index 95ac97d61..34350f399 100644
--- a/src/Application/Application.php
+++ b/src/Application/Application.php
@@ -31,22 +31,22 @@ class Application extends Nette\Object
/** @var string */
public $errorPresenter;
- /** @var callable[] function(Application $sender); Occurs before the application loads presenter */
+ /** @var callable[] function (Application $sender); Occurs before the application loads presenter */
public $onStartup;
- /** @var callable[] function(Application $sender, \Exception $e = NULL); Occurs before the application shuts down */
+ /** @var callable[] function (Application $sender, \Exception $e = NULL); Occurs before the application shuts down */
public $onShutdown;
- /** @var callable[] function(Application $sender, Request $request); Occurs when a new request is received */
+ /** @var callable[] function (Application $sender, Request $request); Occurs when a new request is received */
public $onRequest;
- /** @var callable[] function(Application $sender, Presenter $presenter); Occurs when a presenter is created */
+ /** @var callable[] function (Application $sender, Presenter $presenter); Occurs when a presenter is created */
public $onPresenter;
- /** @var callable[] function(Application $sender, IResponse $response); Occurs when a new response is ready for dispatch */
+ /** @var callable[] function (Application $sender, IResponse $response); Occurs when a new response is ready for dispatch */
public $onResponse;
- /** @var callable[] function(Application $sender, \Exception $e); Occurs when an unhandled exception occurs in the application */
+ /** @var callable[] function (Application $sender, \Exception $e); Occurs when an unhandled exception occurs in the application */
public $onError;
/** @var Request[] */
diff --git a/src/Application/ErrorPresenter.php b/src/Application/ErrorPresenter.php
index ef1e0c280..de2adde88 100644
--- a/src/Application/ErrorPresenter.php
+++ b/src/Application/ErrorPresenter.php
@@ -7,9 +7,9 @@
namespace NetteModule;
-use Nette,
- Nette\Application,
- Tracy\Debugger;
+use Nette;
+use Nette\Application;
+use Tracy\Debugger;
/**
@@ -30,7 +30,7 @@ public function run(Application\Request $request)
$code = $e->getCode();
} else {
$code = 500;
- Debugger::log($e, Debugger::ERROR);
+ Debugger::log($e, Debugger::EXCEPTION);
}
ob_start();
require __DIR__ . '/templates/error.phtml';
diff --git a/src/Application/IPresenter.php b/src/Application/IPresenter.php
index 182d3f956..7968d7539 100644
--- a/src/Application/IPresenter.php
+++ b/src/Application/IPresenter.php
@@ -7,8 +7,6 @@
namespace Nette\Application;
-use Nette;
-
/**
* Presenter converts Request to IResponse.
diff --git a/src/Application/IPresenterFactory.php b/src/Application/IPresenterFactory.php
index ad1cf2bc6..5f02d7d86 100644
--- a/src/Application/IPresenterFactory.php
+++ b/src/Application/IPresenterFactory.php
@@ -7,8 +7,6 @@
namespace Nette\Application;
-use Nette;
-
/**
* Responsible for creating a new instance of given presenter.
diff --git a/src/Application/MicroPresenter.php b/src/Application/MicroPresenter.php
index 3635a9cd9..df1386cd8 100644
--- a/src/Application/MicroPresenter.php
+++ b/src/Application/MicroPresenter.php
@@ -7,11 +7,11 @@
namespace NetteModule;
-use Nette,
- Nette\Application,
- Nette\Application\Responses,
- Nette\Http,
- Latte;
+use Nette;
+use Nette\Application;
+use Nette\Application\Responses;
+use Nette\Http;
+use Latte;
/**
diff --git a/src/Application/PresenterFactory.php b/src/Application/PresenterFactory.php
index 0948c8c3b..f9a178b36 100644
--- a/src/Application/PresenterFactory.php
+++ b/src/Application/PresenterFactory.php
@@ -91,7 +91,7 @@ public function getPresenterClass(& $name)
// internal autoloading
$file = $this->formatPresenterFile($name);
if (is_file($file) && is_readable($file)) {
- call_user_func(function() use ($file) { require $file; });
+ call_user_func(function () use ($file) { require $file; });
}
if (!class_exists($class)) {
diff --git a/src/Application/Responses/RedirectResponse.php b/src/Application/Responses/RedirectResponse.php
index 03a71855f..dffb96efe 100644
--- a/src/Application/Responses/RedirectResponse.php
+++ b/src/Application/Responses/RedirectResponse.php
@@ -7,8 +7,8 @@
namespace Nette\Application\Responses;
-use Nette,
- Nette\Http;
+use Nette;
+use Nette\Http;
/**
diff --git a/src/Application/Routers/CliRouter.php b/src/Application/Routers/CliRouter.php
index af87938bf..fbb89c538 100644
--- a/src/Application/Routers/CliRouter.php
+++ b/src/Application/Routers/CliRouter.php
@@ -7,8 +7,8 @@
namespace Nette\Application\Routers;
-use Nette,
- Nette\Application;
+use Nette;
+use Nette\Application;
/**
diff --git a/src/Application/Routers/Route.php b/src/Application/Routers/Route.php
index 44ef12db3..07c396ca7 100644
--- a/src/Application/Routers/Route.php
+++ b/src/Application/Routers/Route.php
@@ -7,9 +7,9 @@
namespace Nette\Application\Routers;
-use Nette,
- Nette\Application,
- Nette\Utils\Strings;
+use Nette;
+use Nette\Application;
+use Nette\Utils\Strings;
/**
diff --git a/src/Application/Routers/SimpleRouter.php b/src/Application/Routers/SimpleRouter.php
index 8ed9169da..bc23d4abf 100644
--- a/src/Application/Routers/SimpleRouter.php
+++ b/src/Application/Routers/SimpleRouter.php
@@ -7,8 +7,8 @@
namespace Nette\Application\Routers;
-use Nette,
- Nette\Application;
+use Nette;
+use Nette\Application;
/**
diff --git a/src/Application/UI/Control.php b/src/Application/UI/Control.php
index 7a6a7d726..b5c96e77c 100644
--- a/src/Application/UI/Control.php
+++ b/src/Application/UI/Control.php
@@ -109,7 +109,7 @@ public function flashMessage($message, $type = 'info')
public function redrawControl($snippet = NULL, $redraw = TRUE)
{
if ($redraw) {
- $this->invalidSnippets[$snippet] = TRUE;
+ $this->invalidSnippets[$snippet === NULL ? "\0" : $snippet] = TRUE;
} elseif ($snippet === NULL) {
$this->invalidSnippets = array();
@@ -164,7 +164,7 @@ public function isControlInvalid($snippet = NULL)
}
} else {
- return isset($this->invalidSnippets[NULL]) || isset($this->invalidSnippets[$snippet]);
+ return isset($this->invalidSnippets["\0"]) || isset($this->invalidSnippets[$snippet]);
}
}
diff --git a/src/Application/UI/IRenderable.php b/src/Application/UI/IRenderable.php
index 898062e18..05f669d34 100644
--- a/src/Application/UI/IRenderable.php
+++ b/src/Application/UI/IRenderable.php
@@ -7,8 +7,6 @@
namespace Nette\Application\UI;
-use Nette;
-
/**
* Component with ability to repaint.
diff --git a/src/Application/UI/ISignalReceiver.php b/src/Application/UI/ISignalReceiver.php
index 13075cfad..cd3210c21 100644
--- a/src/Application/UI/ISignalReceiver.php
+++ b/src/Application/UI/ISignalReceiver.php
@@ -7,8 +7,6 @@
namespace Nette\Application\UI;
-use Nette;
-
/**
* Component with ability to receive signal.
diff --git a/src/Application/UI/IStatePersistent.php b/src/Application/UI/IStatePersistent.php
index 6837c9006..7fc409ac5 100644
--- a/src/Application/UI/IStatePersistent.php
+++ b/src/Application/UI/IStatePersistent.php
@@ -7,8 +7,6 @@
namespace Nette\Application\UI;
-use Nette;
-
/**
* Component with ability to save and load its state.
diff --git a/src/Application/UI/ITemplate.php b/src/Application/UI/ITemplate.php
index 4d0584406..2794e343f 100644
--- a/src/Application/UI/ITemplate.php
+++ b/src/Application/UI/ITemplate.php
@@ -7,8 +7,6 @@
namespace Nette\Application\UI;
-use Nette;
-
/**
* Defines template.
diff --git a/src/Application/UI/ITemplateFactory.php b/src/Application/UI/ITemplateFactory.php
index 05f6c31a5..7534e7b93 100644
--- a/src/Application/UI/ITemplateFactory.php
+++ b/src/Application/UI/ITemplateFactory.php
@@ -7,8 +7,6 @@
namespace Nette\Application\UI;
-use Nette;
-
/**
* Defines ITemplate factory.
diff --git a/src/Application/UI/InvalidLinkException.php b/src/Application/UI/InvalidLinkException.php
index b340b7b65..05588fd4a 100644
--- a/src/Application/UI/InvalidLinkException.php
+++ b/src/Application/UI/InvalidLinkException.php
@@ -7,8 +7,6 @@
namespace Nette\Application\UI;
-use Nette;
-
/**
* Link generation exception.
diff --git a/src/Application/UI/Presenter.php b/src/Application/UI/Presenter.php
index ea4c16b72..de065d83a 100644
--- a/src/Application/UI/Presenter.php
+++ b/src/Application/UI/Presenter.php
@@ -7,11 +7,11 @@
namespace Nette\Application\UI;
-use Nette,
- Nette\Application,
- Nette\Application\Responses,
- Nette\Http,
- Nette\Reflection;
+use Nette;
+use Nette\Application;
+use Nette\Application\Responses;
+use Nette\Http;
+use Nette\Reflection;
/**
@@ -48,7 +48,7 @@ abstract class Presenter extends Control implements Application\IPresenter
/** @var int */
public $invalidLinkMode;
- /** @var callable[] function(Presenter $sender, IResponse $response = NULL); Occurs when the presenter is shutting down */
+ /** @var callable[] function (Presenter $sender, IResponse $response = NULL); Occurs when the presenter is shutting down */
public $onShutdown;
/** @var Nette\Application\Request */
@@ -223,17 +223,20 @@ public function run(Application\Request $request)
} catch (Application\AbortException $e) {
// continue with shutting down
- if ($this->isAjax()) try {
- $hasPayload = (array) $this->payload; unset($hasPayload['state']);
- if ($this->response instanceof Responses\TextResponse && $this->isControlInvalid()) {
- $this->snippetMode = TRUE;
- $this->response->send($this->httpRequest, $this->httpResponse);
- $this->sendPayload();
-
- } elseif (!$this->response && $hasPayload) { // back compatibility for use terminate() instead of sendPayload()
- $this->sendPayload();
+ if ($this->isAjax()) {
+ try {
+ $hasPayload = (array) $this->payload;
+ unset($hasPayload['state']);
+ if ($this->response instanceof Responses\TextResponse && $this->isControlInvalid()) {
+ $this->snippetMode = TRUE;
+ $this->response->send($this->httpRequest, $this->httpResponse);
+ $this->sendPayload();
+ } elseif (!$this->response && $hasPayload) { // back compatibility for use terminate() instead of sendPayload()
+ $this->sendPayload();
+ }
+ } catch (Application\AbortException $e) {
}
- } catch (Application\AbortException $e) { }
+ }
if ($this->hasFlashSession()) {
$this->getFlashSession()->setExpiration($this->response instanceof Responses\RedirectResponse ? '+ 30 seconds' : '+ 3 seconds');
@@ -312,7 +315,8 @@ public function processSignal()
try {
$component = $this->signalReceiver === '' ? $this : $this->getComponent($this->signalReceiver, FALSE);
- } catch (Nette\InvalidArgumentException $e) {}
+ } catch (Nette\InvalidArgumentException $e) {
+ }
if (isset($e) || $component === NULL) {
throw new BadSignalException("The signal receiver component '$this->signalReceiver' is not found.", NULL, isset($e) ? $e : NULL);
@@ -609,7 +613,7 @@ public function sendPayload()
/**
* Sends JSON data to the output.
- * @param mixed $data
+ * @param mixed
* @return void
* @throws Nette\Application\AbortException
*/
@@ -746,7 +750,8 @@ public function canonicalize()
if (!$this->isAjax() && ($this->request->isMethod('get') || $this->request->isMethod('head'))) {
try {
$url = $this->createRequest($this, $this->action, $this->getGlobalState() + $this->request->getParameters(), 'redirectX');
- } catch (InvalidLinkException $e) {}
+ } catch (InvalidLinkException $e) {
+ }
if (isset($url) && !$this->httpRequest->getUrl()->isEqual($url)) {
$this->sendResponse(new Responses\RedirectResponse($url, Http\IResponse::S301_MOVED_PERMANENTLY));
}
@@ -817,7 +822,7 @@ protected function createRequest($component, $destination, array $args, $mode)
}
// 4) signal or empty
- if (!$component instanceof Presenter || substr($destination, -1) === '!') {
+ if (!$component instanceof self || substr($destination, -1) === '!') {
$signal = rtrim($destination, '!');
$a = strrpos($signal, ':');
if ($a !== FALSE) {
@@ -825,13 +830,13 @@ protected function createRequest($component, $destination, array $args, $mode)
$signal = (string) substr($signal, $a + 1);
}
if ($signal == NULL) { // intentionally ==
- throw new InvalidLinkException("Signal must be non-empty string.");
+ throw new InvalidLinkException('Signal must be non-empty string.');
}
$destination = 'this';
}
if ($destination == NULL) { // intentionally ==
- throw new InvalidLinkException("Destination must be non-empty string.");
+ throw new InvalidLinkException('Destination must be non-empty string.');
}
// 5) presenter: action
@@ -1325,7 +1330,7 @@ public function injectPrimary(Nette\DI\Container $context = NULL, Application\IP
Http\IRequest $httpRequest, Http\IResponse $httpResponse, Http\Session $session = NULL, Nette\Security\User $user = NULL, ITemplateFactory $templateFactory = NULL)
{
if ($this->presenterFactory !== NULL) {
- throw new Nette\InvalidStateException("Method " . __METHOD__ . " is intended for initialization and should not be called more than once.");
+ throw new Nette\InvalidStateException('Method ' . __METHOD__ . ' is intended for initialization and should not be called more than once.');
}
$this->context = $context;
diff --git a/src/Application/UI/PresenterComponentReflection.php b/src/Application/UI/PresenterComponentReflection.php
index 438c1be75..0fea0d041 100644
--- a/src/Application/UI/PresenterComponentReflection.php
+++ b/src/Application/UI/PresenterComponentReflection.php
@@ -7,8 +7,8 @@
namespace Nette\Application\UI;
-use Nette,
- Nette\Application\BadRequestException;
+use Nette;
+use Nette\Application\BadRequestException;
/**
@@ -101,11 +101,13 @@ public function hasCallableMethod($method)
{
$class = $this->getName();
$cache = & self::$mcCache[strtolower($class . ':' . $method)];
- if ($cache === NULL) try {
- $cache = FALSE;
- $rm = Nette\Reflection\Method::from($class, $method);
- $cache = $this->isInstantiable() && $rm->isPublic() && !$rm->isAbstract() && !$rm->isStatic();
- } catch (\ReflectionException $e) {
+ if ($cache === NULL) {
+ try {
+ $cache = FALSE;
+ $rm = Nette\Reflection\Method::from($class, $method);
+ $cache = $this->isInstantiable() && $rm->isPublic() && !$rm->isAbstract() && !$rm->isStatic();
+ } catch (\ReflectionException $e) {
+ }
}
return $cache;
}
diff --git a/src/Application/exceptions.php b/src/Application/exceptions.php
index 19655a190..12b985fda 100644
--- a/src/Application/exceptions.php
+++ b/src/Application/exceptions.php
@@ -7,8 +7,6 @@
namespace Nette\Application;
-use Nette;
-
/**
* The exception that is thrown when user attempts to terminate the current presenter or application.
diff --git a/src/Bridges/ApplicationLatte/ILatteFactory.php b/src/Bridges/ApplicationLatte/ILatteFactory.php
index ac3df059e..7f5b3dcf7 100644
--- a/src/Bridges/ApplicationLatte/ILatteFactory.php
+++ b/src/Bridges/ApplicationLatte/ILatteFactory.php
@@ -7,9 +7,6 @@
namespace Nette\Bridges\ApplicationLatte;
-use Nette,
- Latte;
-
interface ILatteFactory
{
diff --git a/src/Bridges/ApplicationLatte/Loader.php b/src/Bridges/ApplicationLatte/Loader.php
index 69817259b..5a3db2921 100644
--- a/src/Bridges/ApplicationLatte/Loader.php
+++ b/src/Bridges/ApplicationLatte/Loader.php
@@ -7,8 +7,8 @@
namespace Nette\Bridges\ApplicationLatte;
-use Nette,
- Latte;
+use Nette;
+use Latte;
/**
diff --git a/src/Bridges/ApplicationLatte/Template.php b/src/Bridges/ApplicationLatte/Template.php
index 7c3cecbad..f2f738b56 100644
--- a/src/Bridges/ApplicationLatte/Template.php
+++ b/src/Bridges/ApplicationLatte/Template.php
@@ -7,8 +7,8 @@
namespace Nette\Bridges\ApplicationLatte;
-use Nette,
- Latte;
+use Nette;
+use Latte;
/**
@@ -105,7 +105,7 @@ public function registerHelperLoader($loader)
{
//trigger_error(__METHOD__ . '() is deprecated, use dynamic getLatte()->addFilter().', E_USER_DEPRECATED);
$latte = $this->latte;
- $this->latte->addFilter(NULL, function($name) use ($loader, $latte) {
+ $this->latte->addFilter(NULL, function ($name) use ($loader, $latte) {
if ($callback = call_user_func($loader, $name)) {
$latte->addFilter($name, $callback);
}
diff --git a/src/Bridges/ApplicationLatte/TemplateFactory.php b/src/Bridges/ApplicationLatte/TemplateFactory.php
index 5bf872950..b58588a7e 100644
--- a/src/Bridges/ApplicationLatte/TemplateFactory.php
+++ b/src/Bridges/ApplicationLatte/TemplateFactory.php
@@ -11,8 +11,8 @@
namespace Nette\Bridges\ApplicationLatte;
-use Nette,
- Nette\Application\UI;
+use Nette;
+use Nette\Application\UI;
/**
@@ -66,7 +66,7 @@ public function createTemplate(UI\Control $control)
$latte->onCompile = iterator_to_array($latte->onCompile);
}
- array_unshift($latte->onCompile, function($latte) use ($control, $template) {
+ array_unshift($latte->onCompile, function ($latte) use ($control, $template) {
$latte->getParser()->shortNoEscape = TRUE;
$latte->getCompiler()->addMacro('cache', new Nette\Bridges\CacheLatte\CacheMacro($latte->getCompiler()));
UIMacros::install($latte->getCompiler());
@@ -80,11 +80,11 @@ public function createTemplate(UI\Control $control)
foreach (array('normalize', 'toAscii', 'webalize', 'padLeft', 'padRight', 'reverse') as $name) {
$latte->addFilter($name, 'Nette\Utils\Strings::' . $name);
}
- $latte->addFilter('null', function() {});
- $latte->addFilter('length', function($var) {
+ $latte->addFilter('null', function () {});
+ $latte->addFilter('length', function ($var) {
return is_string($var) ? Nette\Utils\Strings::length($var) : count($var);
});
- $latte->addFilter('modifyDate', function($time, $delta, $unit = NULL) {
+ $latte->addFilter('modifyDate', function ($time, $delta, $unit = NULL) {
return $time == NULL ? NULL : Nette\Utils\DateTime::from($time)->modify($delta . $unit); // intentionally ==
});
diff --git a/src/Bridges/ApplicationLatte/UIMacros.php b/src/Bridges/ApplicationLatte/UIMacros.php
index 853d03589..014b78561 100644
--- a/src/Bridges/ApplicationLatte/UIMacros.php
+++ b/src/Bridges/ApplicationLatte/UIMacros.php
@@ -7,12 +7,12 @@
namespace Nette\Bridges\ApplicationLatte;
-use Nette,
- Latte,
- Latte\MacroNode,
- Latte\PhpWriter,
- Latte\CompileException,
- Nette\Utils\Strings;
+use Nette;
+use Latte;
+use Latte\MacroNode;
+use Latte\PhpWriter;
+use Latte\CompileException;
+use Nette\Utils\Strings;
/**
@@ -32,7 +32,7 @@ public static function install(Latte\Compiler $compiler)
$me = new static($compiler);
$me->addMacro('control', array($me, 'macroControl'));
- $me->addMacro('href', NULL, NULL, function(MacroNode $node, PhpWriter $writer) use ($me) {
+ $me->addMacro('href', NULL, NULL, function (MacroNode $node, PhpWriter $writer) use ($me) {
return ' ?> href="macroLink($node, $writer) . ' ?>"addMacro('plink', array($me, 'macroLink'));
@@ -73,7 +73,7 @@ public function macroControl(MacroNode $node, PhpWriter $writer)
$method = Strings::match($method, '#^\w*\z#') ? "render$method" : "{\"render$method\"}";
$param = $writer->formatArray();
if (!Strings::contains($node->args, '=>')) {
- $param = substr($param, 6, -1); // removes array()
+ $param = substr($param, $param[0] === '[' ? 1 : 6, -1); // removes array() or []
}
return ($name[0] === '$' ? "if (is_object($name)) \$_l->tmp = $name; else " : '')
. '$_l->tmp = $_control->getComponent(' . $name . '); '
@@ -116,13 +116,13 @@ public static function renderSnippets(Nette\Application\UI\Control $control, \st
$payload = $control->getPresenter()->getPayload();
if (isset($local->blocks)) {
foreach ($local->blocks as $name => $function) {
- if ($name[0] !== '_' || !$control->isControlInvalid(substr($name, 1))) {
+ if ($name[0] !== '_' || !$control->isControlInvalid((string) substr($name, 1))) {
continue;
}
ob_start();
$function = reset($function);
$snippets = $function($local, $params + array('_snippetMode' => TRUE));
- $payload->snippets[$id = $control->getSnippetId(substr($name, 1))] = ob_get_clean();
+ $payload->snippets[$id = $control->getSnippetId((string) substr($name, 1))] = ob_get_clean();
if ($snippets !== NULL) { // pass FALSE from snippetArea
if ($snippets) {
$payload->snippets += $snippets;
diff --git a/src/Bridges/ApplicationTracy/RoutingPanel.php b/src/Bridges/ApplicationTracy/RoutingPanel.php
index 1896aed28..3abe1d89e 100644
--- a/src/Bridges/ApplicationTracy/RoutingPanel.php
+++ b/src/Bridges/ApplicationTracy/RoutingPanel.php
@@ -7,10 +7,10 @@
namespace Nette\Bridges\ApplicationTracy;
-use Nette,
- Nette\Application\Routers,
- Nette\Application\UI\Presenter,
- Tracy;
+use Nette;
+use Nette\Application\Routers;
+use Nette\Application\UI\Presenter;
+use Tracy;
/**
@@ -41,11 +41,11 @@ class RoutingPanel extends Nette\Object implements Tracy\IBarPanel
public static function initializePanel(Nette\Application\Application $application)
{
- Tracy\Debugger::getBlueScreen()->addPanel(function($e) use ($application) {
+ Tracy\Debugger::getBlueScreen()->addPanel(function ($e) use ($application) {
return $e ? NULL : array(
'tab' => 'Nette Application',
'panel' => '
Requests
' . Tracy\Dumper::toHtml($application->getRequests())
- . 'Presenter
' . Tracy\Dumper::toHtml($application->getPresenter())
+ . 'Presenter
' . Tracy\Dumper::toHtml($application->getPresenter()),
);
});
}
@@ -121,7 +121,7 @@ private function analyse($router, $module = '')
'defaults' => $router instanceof Routers\Route || $router instanceof Routers\SimpleRouter ? $router->getDefaults() : array(),
'mask' => $router instanceof Routers\Route ? $router->getMask() : NULL,
'request' => $request,
- 'module' => rtrim($module, ':')
+ 'module' => rtrim($module, ':'),
);
}
diff --git a/tests/Application.Latte/Template.filters.phpt b/tests/Application.Latte/Template.filters.phpt
index c11afa3a1..4ed129f6f 100644
--- a/tests/Application.Latte/Template.filters.phpt
+++ b/tests/Application.Latte/Template.filters.phpt
@@ -4,8 +4,8 @@
* Test: Template filters
*/
-use Nette\Bridges\ApplicationLatte\Template,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\Template;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -19,4 +19,4 @@ Assert::exception(function () use ($template) {
$engine->addFilter('length', 'strlen');
-Assert::same( 3, $template->length('abc') );
+Assert::same(3, $template->length('abc'));
diff --git a/tests/Application.Latte/TemplateFactory.filters.phpt b/tests/Application.Latte/TemplateFactory.filters.phpt
index e335b2753..ceee45169 100644
--- a/tests/Application.Latte/TemplateFactory.filters.phpt
+++ b/tests/Application.Latte/TemplateFactory.filters.phpt
@@ -4,8 +4,8 @@
* Test: TemplateFactory filters
*/
-use Nette\Bridges\ApplicationLatte\TemplateFactory,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\TemplateFactory;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -37,19 +37,19 @@ $latte = $factory->createTemplate(new ControlMock)->getLatte();
setlocale(LC_TIME, 'C');
date_default_timezone_set('Europe/Prague');
-Assert::null( $latte->invokeFilter('modifyDate', array(NULL, NULL)) );
-Assert::same( '1978-01-24 11:40:00', (string) $latte->invokeFilter('modifyDate', array(254400000, '+1 day')) );
-Assert::same( '1978-05-06 00:00:00', (string) $latte->invokeFilter('modifyDate', array('1978-05-05', '+1 day')) );
-Assert::same( '1978-05-06 00:00:00', (string) $latte->invokeFilter('modifyDate', array(new DateTime('1978-05-05'), '1day')) );
-Assert::same( '1978-01-22 11:40:00', (string) $latte->invokeFilter('modifyDate', array(254400000, -1, 'day')) );
-
-
-Assert::same( '%25', $latte->invokeFilter('url', array('%')) );
-Assert::same( 3, $latte->invokeFilter('length', array('abc')) );
-Assert::same( 2, $latte->invokeFilter('length', array(array(1, 2))) );
-Assert::null( $latte->invokeFilter('null', array('x')) );
-Assert::same( '', $latte->invokeFilter('normalize', array(' ')) );
-Assert::same( 'a-b', $latte->invokeFilter('webalize', array('a b')) );
-Assert::same( ' a', $latte->invokeFilter('padLeft', array('a', 3)) );
-Assert::same( 'a ', $latte->invokeFilter('padRight', array('a', 3)) );
-Assert::same( 'cba', $latte->invokeFilter('reverse', array('abc')) );
+Assert::null($latte->invokeFilter('modifyDate', array(NULL, NULL)));
+Assert::same('1978-01-24 11:40:00', (string) $latte->invokeFilter('modifyDate', array(254400000, '+1 day')));
+Assert::same('1978-05-06 00:00:00', (string) $latte->invokeFilter('modifyDate', array('1978-05-05', '+1 day')));
+Assert::same('1978-05-06 00:00:00', (string) $latte->invokeFilter('modifyDate', array(new DateTime('1978-05-05'), '1day')));
+Assert::same('1978-01-22 11:40:00', (string) $latte->invokeFilter('modifyDate', array(254400000, -1, 'day')));
+
+
+Assert::same('%25', $latte->invokeFilter('url', array('%')));
+Assert::same(3, $latte->invokeFilter('length', array('abc')));
+Assert::same(2, $latte->invokeFilter('length', array(array(1, 2))));
+Assert::null($latte->invokeFilter('null', array('x')));
+Assert::same('', $latte->invokeFilter('normalize', array(' ')));
+Assert::same('a-b', $latte->invokeFilter('webalize', array('a b')));
+Assert::same(' a', $latte->invokeFilter('padLeft', array('a', 3)));
+Assert::same('a ', $latte->invokeFilter('padRight', array('a', 3)));
+Assert::same('cba', $latte->invokeFilter('reverse', array('abc')));
diff --git a/tests/Application.Latte/TemplateFactory.onCompile.phpt b/tests/Application.Latte/TemplateFactory.onCompile.phpt
index 03334b41b..79ca6d13d 100644
--- a/tests/Application.Latte/TemplateFactory.onCompile.phpt
+++ b/tests/Application.Latte/TemplateFactory.onCompile.phpt
@@ -4,9 +4,9 @@
* Test: TemplateFactory in Bridge properly handles Latte::onCompile
*/
-use Nette\Bridges\ApplicationLatte\TemplateFactory,
- Nette\Http,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\TemplateFactory;
+use Nette\Http;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -33,10 +33,10 @@ class LatteFactoryMock implements Nette\Bridges\ApplicationLatte\ILatteFactory
-test(function() {
+test(function () {
$engine = new Latte\Engine;
$factory = new TemplateFactory(new LatteFactoryMock($engine), new Http\Request(new Http\UrlScript('http://nette.org')));
- $engine->onCompile[] = $callback = function() { };
+ $engine->onCompile[] = $callback = function () { };
$factory->createTemplate(new ControlMock);
@@ -46,10 +46,10 @@ test(function() {
});
-test(function() {
+test(function () {
$engine = new Latte\Engine;
$factory = new TemplateFactory(new LatteFactoryMock($engine), new Http\Request(new Http\UrlScript('http://nette.org')));
- $engine->onCompile = new ArrayIterator(array($callback = function() {}));
+ $engine->onCompile = new ArrayIterator(array($callback = function () {}));
$factory->createTemplate(new ControlMock);
@@ -59,7 +59,7 @@ test(function() {
});
-test(function() {
+test(function () {
class Event implements IteratorAggregate
{
public $events;
@@ -77,7 +77,7 @@ test(function() {
$engine = new Latte\Engine;
$factory = new TemplateFactory(new LatteFactoryMock($engine), new Http\Request(new Http\UrlScript('http://nette.org')));
- $engine->onCompile = new Event(array($callback = function() {}));
+ $engine->onCompile = new Event(array($callback = function () {}));
$factory->createTemplate(new ControlMock);
diff --git a/tests/Application.Latte/UIMacros.control.2.phpt b/tests/Application.Latte/UIMacros.control.2.phpt
index 91941c861..db5b75ff9 100644
--- a/tests/Application.Latte/UIMacros.control.2.phpt
+++ b/tests/Application.Latte/UIMacros.control.2.phpt
@@ -4,9 +4,9 @@
* Test: {control ...}
*/
-use Nette\Object,
- Nette\Bridges\ApplicationLatte\UIMacros,
- Tester\Assert;
+use Nette\Object;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -16,8 +16,8 @@ class MockComponent extends Object
{
function getComponent($name)
{
- Notes::add( __METHOD__ );
- Notes::add( func_get_args() );
+ Notes::add(__METHOD__);
+ Notes::add(func_get_args());
return new MockControl;
}
@@ -29,8 +29,8 @@ class MockControl extends Object
function __call($name, $args)
{
- Notes::add( __METHOD__ );
- Notes::add( func_get_args() );
+ Notes::add(__METHOD__);
+ Notes::add(func_get_args());
}
}
@@ -64,22 +64,22 @@ $latte->renderToString('
{control form var1 => 5, 1, 2}
', $params);
-Assert::same( array(
- "MockComponent::getComponent", array("name"),
- "MockControl::__call", array("render", array()),
- "MockComponent::getComponent", array("form"),
- "MockControl::__call", array("render", array()),
- "MockComponent::getComponent", array("form"),
- "MockControl::__call", array("renderTest", array()),
- "MockControl::__call", array("renderTest", array()),
- "MockComponent::getComponent", array("form"),
- "MockControl::__call", array("renderTest", array()),
- "MockComponent::getComponent", array("form"),
- "MockControl::__call", array("renderform", array()),
- "MockComponent::getComponent", array("form"),
- "MockControl::__call", array("render", array("var1")),
- "MockComponent::getComponent", array("form"),
- "MockControl::__call", array("render", array("var1", 1, 2)),
- "MockComponent::getComponent", array("form"),
- "MockControl::__call", array("render", array(array("var1" => 5, 0 => 1, 1 => 2))),
-), Notes::fetch() );
+Assert::same(array(
+ 'MockComponent::getComponent', array('name'),
+ 'MockControl::__call', array('render', array()),
+ 'MockComponent::getComponent', array('form'),
+ 'MockControl::__call', array('render', array()),
+ 'MockComponent::getComponent', array('form'),
+ 'MockControl::__call', array('renderTest', array()),
+ 'MockControl::__call', array('renderTest', array()),
+ 'MockComponent::getComponent', array('form'),
+ 'MockControl::__call', array('renderTest', array()),
+ 'MockComponent::getComponent', array('form'),
+ 'MockControl::__call', array('renderform', array()),
+ 'MockComponent::getComponent', array('form'),
+ 'MockControl::__call', array('render', array('var1')),
+ 'MockComponent::getComponent', array('form'),
+ 'MockControl::__call', array('render', array('var1', 1, 2)),
+ 'MockComponent::getComponent', array('form'),
+ 'MockControl::__call', array('render', array(array('var1' => 5, 0 => 1, 1 => 2))),
+), Notes::fetch());
diff --git a/tests/Application.Latte/UIMacros.control.phpt b/tests/Application.Latte/UIMacros.control.phpt
index 3ac9cde37..daaa25562 100644
--- a/tests/Application.Latte/UIMacros.control.phpt
+++ b/tests/Application.Latte/UIMacros.control.phpt
@@ -4,8 +4,8 @@
* Test: UIMacros: {control ...}
*/
-use Nette\Bridges\ApplicationLatte\UIMacros,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -15,12 +15,12 @@ $compiler = new Latte\Compiler;
UIMacros::install($compiler);
// {control ...}
-Assert::match( 'getComponent("form"); %a%->render() ?>', $compiler->expandMacro('control', 'form', '')->openingCode );
-Assert::match( 'getComponent("form"); %a%->render(); echo $template->filter(%a%) ?>', $compiler->expandMacro('control', 'form', 'filter')->openingCode );
-Assert::match( 'getComponent($form); %a%->render() ?>', $compiler->expandMacro('control', '$form', '')->openingCode );
-Assert::match( 'getComponent("form"); %a%->renderType() ?>', $compiler->expandMacro('control', 'form:type', '')->openingCode );
-Assert::match( 'getComponent("form"); %a%->{"render$type"}() ?>', $compiler->expandMacro('control', 'form:$type', '')->openingCode );
-Assert::match( 'getComponent("form"); %a%->renderType(\'param\') ?>', $compiler->expandMacro('control', 'form:type param', '')->openingCode );
-Assert::match( 'getComponent("form"); %a%->renderType(array(\'param\' => 123)) ?>', $compiler->expandMacro('control', 'form:type param => 123', '')->openingCode );
-Assert::match( 'getComponent("form"); %a%->renderType(array(\'param\' => 123)) ?>', $compiler->expandMacro('control', 'form:type, param => 123', '')->openingCode );
-Assert::match( 'getComponent("form"); %a%->render(); echo $template->striptags(%a%) ?>', $compiler->expandMacro('control', 'form', 'striptags')->openingCode );
+Assert::match('getComponent("form"); %a%->render() ?>', $compiler->expandMacro('control', 'form', '')->openingCode);
+Assert::match('getComponent("form"); %a%->render(); echo $template->filter(%a%) ?>', $compiler->expandMacro('control', 'form', 'filter')->openingCode);
+Assert::match('getComponent($form); %a%->render() ?>', $compiler->expandMacro('control', '$form', '')->openingCode);
+Assert::match('getComponent("form"); %a%->renderType() ?>', $compiler->expandMacro('control', 'form:type', '')->openingCode);
+Assert::match('getComponent("form"); %a%->{"render$type"}() ?>', $compiler->expandMacro('control', 'form:$type', '')->openingCode);
+Assert::match('getComponent("form"); %a%->renderType(\'param\') ?>', $compiler->expandMacro('control', 'form:type param', '')->openingCode);
+Assert::match('getComponent("form"); %a%->renderType(array(\'param\' => 123)) ?>', $compiler->expandMacro('control', 'form:type param => 123', '')->openingCode);
+Assert::match('getComponent("form"); %a%->renderType(array(\'param\' => 123)) ?>', $compiler->expandMacro('control', 'form:type, param => 123', '')->openingCode);
+Assert::match('getComponent("form"); %a%->render(); echo $template->striptags(%a%) ?>', $compiler->expandMacro('control', 'form', 'striptags')->openingCode);
diff --git a/tests/Application.Latte/UIMacros.dynamicsnippets.alt.phpt b/tests/Application.Latte/UIMacros.dynamicsnippets.alt.phpt
index 45dd230fc..874af914e 100644
--- a/tests/Application.Latte/UIMacros.dynamicsnippets.alt.phpt
+++ b/tests/Application.Latte/UIMacros.dynamicsnippets.alt.phpt
@@ -4,8 +4,8 @@
* Test: dynamic snippets test.
*/
-use Nette\Bridges\ApplicationLatte\UIMacros,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Latte/UIMacros.dynamicsnippets.phpt b/tests/Application.Latte/UIMacros.dynamicsnippets.phpt
index d5e29c4b3..b29feba30 100644
--- a/tests/Application.Latte/UIMacros.dynamicsnippets.phpt
+++ b/tests/Application.Latte/UIMacros.dynamicsnippets.phpt
@@ -4,8 +4,8 @@
* Test: dynamic snippets test.
*/
-use Nette\Bridges\ApplicationLatte\UIMacros,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Latte/UIMacros.isLinkCurrent.phpt b/tests/Application.Latte/UIMacros.isLinkCurrent.phpt
index 9ea908619..2cb0e31bb 100644
--- a/tests/Application.Latte/UIMacros.isLinkCurrent.phpt
+++ b/tests/Application.Latte/UIMacros.isLinkCurrent.phpt
@@ -4,8 +4,8 @@
* Test: isLinkCurrent()
*/
-use Nette\Bridges\ApplicationLatte\UIMacros,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Latte/UIMacros.link.2.phpt b/tests/Application.Latte/UIMacros.link.2.phpt
index 227a604bc..c1d88eac0 100644
--- a/tests/Application.Latte/UIMacros.link.2.phpt
+++ b/tests/Application.Latte/UIMacros.link.2.phpt
@@ -4,8 +4,8 @@
* Test: {link ...}, {plink ...}
*/
-use Nette\Bridges\ApplicationLatte\UIMacros,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -38,7 +38,8 @@ class MockPresenter extends MockControl
return 'plink:' . strtr(json_encode($args), '"', "'");
}
- public function isAjax() {
+ public function isAjax()
+ {
return FALSE;
}
diff --git a/tests/Application.Latte/UIMacros.link.phpt b/tests/Application.Latte/UIMacros.link.phpt
index 2a1d7cd77..f40e528c0 100644
--- a/tests/Application.Latte/UIMacros.link.phpt
+++ b/tests/Application.Latte/UIMacros.link.phpt
@@ -4,8 +4,8 @@
* Test: UIMacros: {link ...}
*/
-use Nette\Bridges\ApplicationLatte\UIMacros,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -16,15 +16,15 @@ $compiler->setContentType($compiler::CONTENT_TEXT);
UIMacros::install($compiler);
// {link ...}
-Assert::same( 'link("p") ?>', $compiler->expandMacro('link', 'p', '')->openingCode );
-Assert::same( 'filter($_control->link("p")) ?>', $compiler->expandMacro('link', 'p', 'filter')->openingCode );
-Assert::same( 'link("p:a") ?>', $compiler->expandMacro('link', 'p:a', '')->openingCode );
-Assert::same( 'link($dest) ?>', $compiler->expandMacro('link', '$dest', '')->openingCode );
-Assert::same( 'link($p:$a) ?>', $compiler->expandMacro('link', '$p:$a', '')->openingCode );
-Assert::same( 'link("$p:$a") ?>', $compiler->expandMacro('link', '"$p:$a"', '')->openingCode );
-Assert::same( 'link("p:a") ?>', $compiler->expandMacro('link', '"p:a"', '')->openingCode );
-Assert::same( 'link(\'p:a\') ?>', $compiler->expandMacro('link', "'p:a'", '')->openingCode );
-
-Assert::same( 'link("p", array(\'param\')) ?>', $compiler->expandMacro('link', 'p param', '')->openingCode );
-Assert::same( 'link("p", array(\'param\' => 123)) ?>', $compiler->expandMacro('link', 'p param => 123', '')->openingCode );
-Assert::same( 'link("p", array(\'param\' => 123)) ?>', $compiler->expandMacro('link', 'p, param => 123', '')->openingCode );
+Assert::same('link("p") ?>', $compiler->expandMacro('link', 'p', '')->openingCode);
+Assert::same('filter($_control->link("p")) ?>', $compiler->expandMacro('link', 'p', 'filter')->openingCode);
+Assert::same('link("p:a") ?>', $compiler->expandMacro('link', 'p:a', '')->openingCode);
+Assert::same('link($dest) ?>', $compiler->expandMacro('link', '$dest', '')->openingCode);
+Assert::same('link($p:$a) ?>', $compiler->expandMacro('link', '$p:$a', '')->openingCode);
+Assert::same('link("$p:$a") ?>', $compiler->expandMacro('link', '"$p:$a"', '')->openingCode);
+Assert::same('link("p:a") ?>', $compiler->expandMacro('link', '"p:a"', '')->openingCode);
+Assert::same('link(\'p:a\') ?>', $compiler->expandMacro('link', "'p:a'", '')->openingCode);
+
+Assert::same('link("p", array(\'param\')) ?>', $compiler->expandMacro('link', 'p param', '')->openingCode);
+Assert::same('link("p", array(\'param\' => 123)) ?>', $compiler->expandMacro('link', 'p param => 123', '')->openingCode);
+Assert::same('link("p", array(\'param\' => 123)) ?>', $compiler->expandMacro('link', 'p, param => 123', '')->openingCode);
diff --git a/tests/Application.Latte/UIMacros.renderSnippets.extends.phpt b/tests/Application.Latte/UIMacros.renderSnippets.extends.phpt
index eca0c94ad..76fd44344 100644
--- a/tests/Application.Latte/UIMacros.renderSnippets.extends.phpt
+++ b/tests/Application.Latte/UIMacros.renderSnippets.extends.phpt
@@ -4,8 +4,8 @@
* Test: UIMacros, renderSnippets and template with layout
*/
-use Nette\Bridges\ApplicationLatte\UIMacros,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -27,7 +27,7 @@ class TestPresenter extends Nette\Application\UI\Presenter
$presenter = new TestPresenter;
$presenter->snippetMode = TRUE;
-$presenter->redrawControl('foo');;
+$presenter->redrawControl('foo');
$content = $presenter->render();
Assert::same('', $content);
Assert::same(array(
diff --git a/tests/Application.Latte/UIMacros.renderSnippets.phpt b/tests/Application.Latte/UIMacros.renderSnippets.phpt
index 45b13400f..4c6095798 100644
--- a/tests/Application.Latte/UIMacros.renderSnippets.phpt
+++ b/tests/Application.Latte/UIMacros.renderSnippets.phpt
@@ -4,8 +4,8 @@
* Test: UIMacros and renderSnippets.
*/
-use Nette\Bridges\ApplicationLatte\UIMacros,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -28,7 +28,7 @@ class TestPresenter extends Nette\Application\UI\Presenter
{
function createComponentMulti()
{
- return new Nette\Application\UI\Multiplier(function() {
+ return new Nette\Application\UI\Multiplier(function () {
$control = new InnerControl();
$control->redrawControl();
return $control;
diff --git a/tests/Application.Latte/UIMacros.renderSnippets2.phpt b/tests/Application.Latte/UIMacros.renderSnippets2.phpt
index 99fadc894..779bec8ce 100644
--- a/tests/Application.Latte/UIMacros.renderSnippets2.phpt
+++ b/tests/Application.Latte/UIMacros.renderSnippets2.phpt
@@ -4,8 +4,8 @@
* Test: UIMacros, renderSnippets and control with two templates.
*/
-use Nette\Bridges\ApplicationLatte\UIMacros,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -47,7 +47,7 @@ class TestPresenter extends Nette\Application\UI\Presenter
{
function createComponentMulti()
{
- return new Nette\Application\UI\Multiplier(function() {
+ return new Nette\Application\UI\Multiplier(function () {
return new InnerControl();
});
}
diff --git a/tests/Application.Latte/UIMacros.snippet.alt.phpt b/tests/Application.Latte/UIMacros.snippet.alt.phpt
index 003833ed6..b4f2b83de 100644
--- a/tests/Application.Latte/UIMacros.snippet.alt.phpt
+++ b/tests/Application.Latte/UIMacros.snippet.alt.phpt
@@ -4,9 +4,9 @@
* Test: general snippets test.
*/
-use Nette\Utils\Html,
- Nette\Bridges\ApplicationLatte\UIMacros,
- Tester\Assert;
+use Nette\Utils\Html;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Latte/UIMacros.snippet.phpt b/tests/Application.Latte/UIMacros.snippet.phpt
index 7ee55b328..a414803dc 100644
--- a/tests/Application.Latte/UIMacros.snippet.phpt
+++ b/tests/Application.Latte/UIMacros.snippet.phpt
@@ -4,9 +4,9 @@
* Test: general snippets test.
*/
-use Nette\Bridges\ApplicationLatte\UIMacros,
- Nette\Utils\Html,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Nette\Utils\Html;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Latte/UIMacros.snippet1.phpt b/tests/Application.Latte/UIMacros.snippet1.phpt
index 63573288b..f40da5aa0 100644
--- a/tests/Application.Latte/UIMacros.snippet1.phpt
+++ b/tests/Application.Latte/UIMacros.snippet1.phpt
@@ -4,8 +4,8 @@
* Test: snippets.
*/
-use Nette\Bridges\ApplicationLatte\UIMacros,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Latte/UIMacros.snippet2.phpt b/tests/Application.Latte/UIMacros.snippet2.phpt
index 4ed9abe89..de73fa522 100644
--- a/tests/Application.Latte/UIMacros.snippet2.phpt
+++ b/tests/Application.Latte/UIMacros.snippet2.phpt
@@ -4,8 +4,8 @@
* Test: snippets.
*/
-use Nette\Bridges\ApplicationLatte\UIMacros,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Latte/UIMacros.snippet3.phpt b/tests/Application.Latte/UIMacros.snippet3.phpt
index 18ec58dbb..9b7a8fe9c 100644
--- a/tests/Application.Latte/UIMacros.snippet3.phpt
+++ b/tests/Application.Latte/UIMacros.snippet3.phpt
@@ -4,8 +4,8 @@
* Test: snippets.
*/
-use Nette\Bridges\ApplicationLatte\UIMacros,
- Tester\Assert;
+use Nette\Bridges\ApplicationLatte\UIMacros;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Latte/expected/UIMacros.snippet.phtml b/tests/Application.Latte/expected/UIMacros.snippet.phtml
index f819ad3aa..320e30d5c 100644
--- a/tests/Application.Latte/expected/UIMacros.snippet.phtml
+++ b/tests/Application.Latte/expected/UIMacros.snippet.phtml
@@ -1,7 +1,7 @@
%A%
// block _
//
-if (!function_exists($_b->blocks['_'][] = '_%[a-z0-9]+%__')) { function _%[a-z0-9]+%__($_b, $_args) { foreach ($_args as $__k => $__v) $$__k = $__v; $_control->redrawControl(false, FALSE)
+if (!function_exists($_b->blocks['_'][] = '_%[a-z0-9]+%__')) { function _%[a-z0-9]+%__($_b, $_args) { foreach ($_args as $__k => $__v) $$__k = $__v; $_control->redrawControl(%[false']+%, FALSE)
;
}}
diff --git a/tests/Application.Routers/CliRouter.invalid.phpt b/tests/Application.Routers/CliRouter.invalid.phpt
index 03fa204b0..a2afa278f 100644
--- a/tests/Application.Routers/CliRouter.invalid.phpt
+++ b/tests/Application.Routers/CliRouter.invalid.phpt
@@ -4,9 +4,9 @@
* Test: Nette\Application\Routers\CliRouter invalid argument
*/
-use Nette\Http,
- Nette\Application\Routers\CliRouter,
- Tester\Assert;
+use Nette\Http;
+use Nette\Application\Routers\CliRouter;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -16,4 +16,4 @@ $_SERVER['argv'] = 1;
$httpRequest = new Http\Request(new Http\UrlScript());
$router = new CliRouter;
-Assert::null( $router->match($httpRequest) );
+Assert::null($router->match($httpRequest));
diff --git a/tests/Application.Routers/CliRouter.phpt b/tests/Application.Routers/CliRouter.phpt
index d2eeff6f2..cb6acac52 100644
--- a/tests/Application.Routers/CliRouter.phpt
+++ b/tests/Application.Routers/CliRouter.phpt
@@ -4,9 +4,9 @@
* Test: Nette\Application\Routers\CliRouter basic usage
*/
-use Nette\Http,
- Nette\Application\Routers\CliRouter,
- Tester\Assert;
+use Nette\Http;
+use Nette\Application\Routers\CliRouter;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -32,9 +32,9 @@ $router = new CliRouter(array(
));
$req = $router->match($httpRequest);
-Assert::same( 'homepage', $req->getPresenterName() );
+Assert::same('homepage', $req->getPresenterName());
-Assert::same( array(
+Assert::same(array(
'id' => 12,
'user' => 'john doe',
'action' => 'default',
@@ -42,9 +42,9 @@ Assert::same( array(
'verbose' => TRUE,
'pass' => 'se cret',
'wait' => TRUE,
-), $req->getParameters() );
+), $req->getParameters());
-Assert::true( $req->isMethod('cli') );
+Assert::true($req->isMethod('cli'));
-Assert::null( $router->constructUrl($req, $httpRequest->getUrl()) );
+Assert::null($router->constructUrl($req, $httpRequest->getUrl()));
diff --git a/tests/Application.Routers/Route.arrayParams.phpt b/tests/Application.Routers/Route.arrayParams.phpt
index fbdf44e99..6311763fc 100644
--- a/tests/Application.Routers/Route.arrayParams.phpt
+++ b/tests/Application.Routers/Route.arrayParams.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with ArrayParams
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.basic.phpt b/tests/Application.Routers/Route.basic.phpt
index 8967e1059..cf3a7ca27 100644
--- a/tests/Application.Routers/Route.basic.phpt
+++ b/tests/Application.Routers/Route.basic.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route default usage.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -15,13 +15,13 @@ require __DIR__ . '/Route.inc';
$route = new Route('//');
-Assert::same( 'http://example.com/homepage/', testRouteOut($route, 'Homepage') );
+Assert::same('http://example.com/homepage/', testRouteOut($route, 'Homepage'));
-Assert::same( 'http://example.com/homepage/', testRouteOut($route, 'Homepage', array('action' => 'default')) );
+Assert::same('http://example.com/homepage/', testRouteOut($route, 'Homepage', array('action' => 'default')));
-Assert::null( testRouteOut($route, 'Homepage', array('id' => 'word')) );
+Assert::null(testRouteOut($route, 'Homepage', array('id' => 'word')));
-Assert::same( 'http://example.com/front.homepage/', testRouteOut($route, 'Front:Homepage') );
+Assert::same('http://example.com/front.homepage/', testRouteOut($route, 'Front:Homepage'));
testRouteIn($route, '/presenter/action/12/any');
diff --git a/tests/Application.Routers/Route.camelcapsVsDash.phpt b/tests/Application.Routers/Route.camelcapsVsDash.phpt
index 046b6e0cd..6eaa75c11 100644
--- a/tests/Application.Routers/Route.camelcapsVsDash.phpt
+++ b/tests/Application.Routers/Route.camelcapsVsDash.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with CamelcapsVsDash
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.combinedUrlParam.phpt b/tests/Application.Routers/Route.combinedUrlParam.phpt
index 26238bd27..e5f0265da 100644
--- a/tests/Application.Routers/Route.combinedUrlParam.phpt
+++ b/tests/Application.Routers/Route.combinedUrlParam.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with CombinedUrlParam
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.extraDefaultParam.phpt b/tests/Application.Routers/Route.extraDefaultParam.phpt
index 69f32b193..d643db6b4 100644
--- a/tests/Application.Routers/Route.extraDefaultParam.phpt
+++ b/tests/Application.Routers/Route.extraDefaultParam.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with ExtraDefaultParam
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.filter.global.phpt b/tests/Application.Routers/Route.filter.global.phpt
index 2b6c09d42..bace394b3 100644
--- a/tests/Application.Routers/Route.filter.global.phpt
+++ b/tests/Application.Routers/Route.filter.global.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with FILTER_IN & FILTER_OUT
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -15,7 +15,7 @@ require __DIR__ . '/Route.inc';
$route = new Route('', array(
NULL => array(
- Route::FILTER_IN => function(array $arr) {
+ Route::FILTER_IN => function (array $arr) {
if (substr($arr['presenter'], 0, 3) !== 'Abc') {
return NULL;
}
@@ -23,7 +23,7 @@ $route = new Route('', array(
$arr['param'] .= '.in';
return $arr;
},
- Route::FILTER_OUT => function(array $arr) {
+ Route::FILTER_OUT => function (array $arr) {
if (substr($arr['presenter'], 0, 3) !== 'Abc') {
return NULL;
}
diff --git a/tests/Application.Routers/Route.filter.query.phpt b/tests/Application.Routers/Route.filter.query.phpt
index 6c38e7535..b8e628ec7 100644
--- a/tests/Application.Routers/Route.filter.query.phpt
+++ b/tests/Application.Routers/Route.filter.query.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with FILTER_IN & FILTER_OUT
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -15,10 +15,10 @@ require __DIR__ . '/Route.inc';
$route = new Route(' ? action=', array(
'presenter' => array(
- Route::FILTER_IN => function($s) {
+ Route::FILTER_IN => function ($s) {
return strrev($s);
},
- Route::FILTER_OUT => function($s) {
+ Route::FILTER_OUT => function ($s) {
return strtoupper(strrev($s));
},
),
diff --git a/tests/Application.Routers/Route.filter.url.object.phpt b/tests/Application.Routers/Route.filter.url.object.phpt
index a14fe102d..2e7b853f2 100644
--- a/tests/Application.Routers/Route.filter.url.object.phpt
+++ b/tests/Application.Routers/Route.filter.url.object.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with FILTER_IN & FILTER_OUT using string <=> object conversion
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
@@ -22,10 +22,10 @@ $identityMap[2] = new Object(2);
$route = new Route('', array(
'presenter' => 'presenter',
'parameter' => array(
- Route::FILTER_IN => function($s) use ($identityMap) {
+ Route::FILTER_IN => function ($s) use ($identityMap) {
return isset($identityMap[$s]) ? $identityMap[$s] : NULL;
},
- Route::FILTER_OUT => function($obj) {
+ Route::FILTER_OUT => function ($obj) {
return $obj instanceof Object ? $obj->getId() : NULL;
},
),
@@ -46,7 +46,7 @@ Assert::same('http://example.com/1', testRouteOut($route, 'presenter', array(
// Doesn't match
testRouteIn($route, '/3/');
-Assert::null( testRouteOut($route, 'presenter', array(
+Assert::null(testRouteOut($route, 'presenter', array(
'parameter' => NULL,
)));
diff --git a/tests/Application.Routers/Route.filter.url.phpt b/tests/Application.Routers/Route.filter.url.phpt
index 31064723c..35bdd22d0 100644
--- a/tests/Application.Routers/Route.filter.url.phpt
+++ b/tests/Application.Routers/Route.filter.url.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with FILTER_IN & FILTER_OUT
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -15,10 +15,10 @@ require __DIR__ . '/Route.inc';
$route = new Route('', array(
'presenter' => array(
- Route::FILTER_IN => function($s) {
+ Route::FILTER_IN => function ($s) {
return strrev($s);
},
- Route::FILTER_OUT => function($s) {
+ Route::FILTER_OUT => function ($s) {
return strtoupper(strrev($s));
},
),
diff --git a/tests/Application.Routers/Route.filterTable.query.phpt b/tests/Application.Routers/Route.filterTable.query.phpt
index 7e380d0ed..74dc15b2d 100644
--- a/tests/Application.Routers/Route.filterTable.query.phpt
+++ b/tests/Application.Routers/Route.filterTable.query.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with FilterTable
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.filterTable.strict.phpt b/tests/Application.Routers/Route.filterTable.strict.phpt
index df0aacbe5..376ff4885 100644
--- a/tests/Application.Routers/Route.filterTable.strict.phpt
+++ b/tests/Application.Routers/Route.filterTable.strict.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with FilterTable
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.filterTable.url.phpt b/tests/Application.Routers/Route.filterTable.url.phpt
index 5a0558738..7ab810194 100644
--- a/tests/Application.Routers/Route.filterTable.url.phpt
+++ b/tests/Application.Routers/Route.filterTable.url.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with FilterTable
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.firstOptionalParam.phpt b/tests/Application.Routers/Route.firstOptionalParam.phpt
index df25615ea..ab1ecb675 100644
--- a/tests/Application.Routers/Route.firstOptionalParam.phpt
+++ b/tests/Application.Routers/Route.firstOptionalParam.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route first optional parameter.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.fooParameter.default.phpt b/tests/Application.Routers/Route.fooParameter.default.phpt
index 355687867..4a17de8f0 100644
--- a/tests/Application.Routers/Route.fooParameter.default.phpt
+++ b/tests/Application.Routers/Route.fooParameter.default.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with FooParameter
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.fooParameter.phpt b/tests/Application.Routers/Route.fooParameter.phpt
index 66190dbe0..a2a63b9c4 100644
--- a/tests/Application.Routers/Route.fooParameter.phpt
+++ b/tests/Application.Routers/Route.fooParameter.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with FooParameter
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.fullMatchParam.phpt b/tests/Application.Routers/Route.fullMatchParam.phpt
index 7d5220cbb..571c17d9e 100644
--- a/tests/Application.Routers/Route.fullMatchParam.phpt
+++ b/tests/Application.Routers/Route.fullMatchParam.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route and full match parameter.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.inc b/tests/Application.Routers/Route.inc
index 71cb872ea..15761f4de 100644
--- a/tests/Application.Routers/Route.inc
+++ b/tests/Application.Routers/Route.inc
@@ -7,10 +7,8 @@
use Tester\Assert;
-function testRouteIn(Nette\Application\IRouter $route, $url, $expectedPresenter=NULL, $expectedParams=NULL, $expectedUrl=NULL)
+function testRouteIn(Nette\Application\IRouter $route, $url, $expectedPresenter = NULL, $expectedParams = NULL, $expectedUrl = NULL)
{
- // ==> $url
-
$url = new Nette\Http\UrlScript("http://example.com$url");
$url->appendQuery(array(
'test' => 'testvalue',
@@ -25,17 +23,17 @@ function testRouteIn(Nette\Application\IRouter $route, $url, $expectedPresenter=
$params = $request->getParameters();
asort($params);
asort($expectedParams);
- Assert::same( $expectedPresenter, $request->getPresenterName() );
- Assert::same( $expectedParams, $params );
+ Assert::same($expectedPresenter, $request->getPresenterName());
+ Assert::same($expectedParams, $params);
unset($params['extra']);
$request->setParameters($params);
$result = $route->constructUrl($request, $url);
$result = strncmp($result, 'http://example.com', 18) ? $result : substr($result, 18);
- Assert::same( $expectedUrl, $result );
+ Assert::same($expectedUrl, $result);
} else { // not matched
- Assert::null( $expectedPresenter );
+ Assert::null($expectedPresenter);
}
}
diff --git a/tests/Application.Routers/Route.longParameter.phpt b/tests/Application.Routers/Route.longParameter.phpt
index df58e2043..73ed9bb49 100644
--- a/tests/Application.Routers/Route.longParameter.phpt
+++ b/tests/Application.Routers/Route.longParameter.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with LongParameter
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.mandatoryAction.phpt b/tests/Application.Routers/Route.mandatoryAction.phpt
index 512625154..044457a7b 100644
--- a/tests/Application.Routers/Route.mandatoryAction.phpt
+++ b/tests/Application.Routers/Route.mandatoryAction.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route and non-optional action.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.modules.phpt b/tests/Application.Routers/Route.modules.phpt
index 559651262..39411fc4e 100644
--- a/tests/Application.Routers/Route.modules.phpt
+++ b/tests/Application.Routers/Route.modules.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with Modules
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -22,9 +22,9 @@ testRouteIn($route, '/abc', 'module:submodule:Abc', array(
), '/abc?test=testvalue');
testRouteIn($route, '/');
-Assert::null( testRouteOut($route, 'Homepage') );
-Assert::null( testRouteOut($route, 'Module:Homepage') );
-Assert::same( 'http://example.com/homepage', testRouteOut($route, 'Module:Submodule:Homepage') );
+Assert::null(testRouteOut($route, 'Homepage'));
+Assert::null(testRouteOut($route, 'Module:Homepage'));
+Assert::same('http://example.com/homepage', testRouteOut($route, 'Module:Submodule:Homepage'));
$route = new Route('', array(
@@ -36,9 +36,9 @@ testRouteIn($route, '/', 'Module:Submodule:Default', array(
'test' => 'testvalue',
), '/?test=testvalue');
-Assert::null( testRouteOut($route, 'Homepage') );
-Assert::null( testRouteOut($route, 'Module:Homepage') );
-Assert::same( 'http://example.com/homepage', testRouteOut($route, 'Module:Submodule:Homepage') );
+Assert::null(testRouteOut($route, 'Homepage'));
+Assert::null(testRouteOut($route, 'Module:Homepage'));
+Assert::same('http://example.com/homepage', testRouteOut($route, 'Module:Submodule:Homepage'));
$route = new Route('/', array(
@@ -49,9 +49,9 @@ testRouteIn($route, '/module.submodule', 'Module:Submodule:AnyDefault', array(
'test' => 'testvalue',
), '/module.submodule/?test=testvalue');
-Assert::null( testRouteOut($route, 'Homepage') );
-Assert::same( 'http://example.com/module/homepage', testRouteOut($route, 'Module:Homepage') );
-Assert::same( 'http://example.com/module.submodule/homepage', testRouteOut($route, 'Module:Submodule:Homepage') );
+Assert::null(testRouteOut($route, 'Homepage'));
+Assert::same('http://example.com/module/homepage', testRouteOut($route, 'Module:Homepage'));
+Assert::same('http://example.com/module.submodule/homepage', testRouteOut($route, 'Module:Submodule:Homepage'));
$route = new Route('/', array(
@@ -63,6 +63,6 @@ testRouteIn($route, '/module.submodule', 'Module:Submodule:Default', array(
'test' => 'testvalue',
), '/?test=testvalue');
-Assert::null( testRouteOut($route, 'Homepage') );
-Assert::same( 'http://example.com/module/homepage', testRouteOut($route, 'Module:Homepage') );
-Assert::same( 'http://example.com/module.submodule/homepage', testRouteOut($route, 'Module:Submodule:Homepage') );
+Assert::null(testRouteOut($route, 'Homepage'));
+Assert::same('http://example.com/module/homepage', testRouteOut($route, 'Module:Homepage'));
+Assert::same('http://example.com/module.submodule/homepage', testRouteOut($route, 'Module:Submodule:Homepage'));
diff --git a/tests/Application.Routers/Route.noDefaultParams.phpt b/tests/Application.Routers/Route.noDefaultParams.phpt
index 55f697df9..2030d6672 100644
--- a/tests/Application.Routers/Route.noDefaultParams.phpt
+++ b/tests/Application.Routers/Route.noDefaultParams.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with NoDefaultParams
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.noParams.phpt b/tests/Application.Routers/Route.noParams.phpt
index 80b43b991..c0b6442d6 100644
--- a/tests/Application.Routers/Route.noParams.phpt
+++ b/tests/Application.Routers/Route.noParams.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route default usage.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.oneWay.phpt b/tests/Application.Routers/Route.oneWay.phpt
index 3565a8d40..36a87c25b 100644
--- a/tests/Application.Routers/Route.oneWay.phpt
+++ b/tests/Application.Routers/Route.oneWay.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with OneWay
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.optional.autooptional1.phpt b/tests/Application.Routers/Route.optional.autooptional1.phpt
index 5fe6d0881..e3cb191b9 100644
--- a/tests/Application.Routers/Route.optional.autooptional1.phpt
+++ b/tests/Application.Routers/Route.optional.autooptional1.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route and auto-optional as optional sequences.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.optional.autooptional2.phpt b/tests/Application.Routers/Route.optional.autooptional2.phpt
index 72ee19164..2f625af32 100644
--- a/tests/Application.Routers/Route.optional.autooptional2.phpt
+++ b/tests/Application.Routers/Route.optional.autooptional2.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route and auto-optional as optional sequences II.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.optional.module.phpt b/tests/Application.Routers/Route.optional.module.phpt
index 372b57c84..869c8ae28 100644
--- a/tests/Application.Routers/Route.optional.module.phpt
+++ b/tests/Application.Routers/Route.optional.module.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with module in optional sequence.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.optional.nested.phpt b/tests/Application.Routers/Route.optional.nested.phpt
index a5d45f019..fc97e416d 100644
--- a/tests/Application.Routers/Route.optional.nested.phpt
+++ b/tests/Application.Routers/Route.optional.nested.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with nested optional sequences.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.optional.phpt b/tests/Application.Routers/Route.optional.phpt
index 2652e1132..bffd80366 100644
--- a/tests/Application.Routers/Route.optional.phpt
+++ b/tests/Application.Routers/Route.optional.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with optional sequence.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.optional.precedence.phpt b/tests/Application.Routers/Route.optional.precedence.phpt
index 7e21eec6e..d17f9e917 100644
--- a/tests/Application.Routers/Route.optional.precedence.phpt
+++ b/tests/Application.Routers/Route.optional.precedence.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with optional sequence precedence.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.optional.preferred.nested1.phpt b/tests/Application.Routers/Route.optional.preferred.nested1.phpt
index 923cba90c..4b9b8dd60 100644
--- a/tests/Application.Routers/Route.optional.preferred.nested1.phpt
+++ b/tests/Application.Routers/Route.optional.preferred.nested1.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with 'required' optional sequences I.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.optional.preferred.nested2.phpt b/tests/Application.Routers/Route.optional.preferred.nested2.phpt
index 6014324e4..63cd0cc65 100644
--- a/tests/Application.Routers/Route.optional.preferred.nested2.phpt
+++ b/tests/Application.Routers/Route.optional.preferred.nested2.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with 'required' optional sequences II.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.optional.preferred.nested3.phpt b/tests/Application.Routers/Route.optional.preferred.nested3.phpt
index 04e495204..47b6d00de 100644
--- a/tests/Application.Routers/Route.optional.preferred.nested3.phpt
+++ b/tests/Application.Routers/Route.optional.preferred.nested3.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with 'required' optional sequences III.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.optional.preferred.phpt b/tests/Application.Routers/Route.optional.preferred.phpt
index e9136b093..bf5c9a101 100644
--- a/tests/Application.Routers/Route.optional.preferred.phpt
+++ b/tests/Application.Routers/Route.optional.preferred.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with 'required' optional sequence.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.optional.regexp.phpt b/tests/Application.Routers/Route.optional.regexp.phpt
index f35f1b1af..9732cdd4f 100644
--- a/tests/Application.Routers/Route.optional.regexp.phpt
+++ b/tests/Application.Routers/Route.optional.regexp.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with optional sequence and two parameters.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.secured.phpt b/tests/Application.Routers/Route.secured.phpt
index e3d988d3c..073f9200a 100644
--- a/tests/Application.Routers/Route.secured.phpt
+++ b/tests/Application.Routers/Route.secured.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with Secured
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.slash.phpt b/tests/Application.Routers/Route.slash.phpt
index 4bf765259..f03854c4a 100644
--- a/tests/Application.Routers/Route.slash.phpt
+++ b/tests/Application.Routers/Route.slash.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with slash in path.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -18,7 +18,7 @@ $route = new Route('', array(
));
testRouteIn($route, '/a/b');
-Assert::null( testRouteOut($route, 'Presenter', array('param' => 'a/b')) );
+Assert::null(testRouteOut($route, 'Presenter', array('param' => 'a/b')));
$route = new Route('', array(
diff --git a/tests/Application.Routers/Route.urlEncoding.phpt b/tests/Application.Routers/Route.urlEncoding.phpt
index 0ba9af97d..a414838e8 100644
--- a/tests/Application.Routers/Route.urlEncoding.phpt
+++ b/tests/Application.Routers/Route.urlEncoding.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with UrlEncoding
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.utf8Param.phpt b/tests/Application.Routers/Route.utf8Param.phpt
index 3d38f60fa..ecc729630 100644
--- a/tests/Application.Routers/Route.utf8Param.phpt
+++ b/tests/Application.Routers/Route.utf8Param.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route UTF-8 parameter.
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.variables.phpt b/tests/Application.Routers/Route.variables.phpt
index 0989959a1..3df2ed366 100644
--- a/tests/Application.Routers/Route.variables.phpt
+++ b/tests/Application.Routers/Route.variables.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with %variables%
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.withAbsolutePath.phpt b/tests/Application.Routers/Route.withAbsolutePath.phpt
index 19c696890..34b70d8f8 100644
--- a/tests/Application.Routers/Route.withAbsolutePath.phpt
+++ b/tests/Application.Routers/Route.withAbsolutePath.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with WithAbsolutePath
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.withDefaultPresenterAndAction.phpt b/tests/Application.Routers/Route.withDefaultPresenterAndAction.phpt
index 0c836ddf1..3680d8f18 100644
--- a/tests/Application.Routers/Route.withDefaultPresenterAndAction.phpt
+++ b/tests/Application.Routers/Route.withDefaultPresenterAndAction.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with WithDefaultPresenterAndAction
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.withHost.phpt b/tests/Application.Routers/Route.withHost.phpt
index 1b2b79fc0..d79e4947a 100644
--- a/tests/Application.Routers/Route.withHost.phpt
+++ b/tests/Application.Routers/Route.withHost.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with WithHost
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.withNamedParamsInQuery.phpt b/tests/Application.Routers/Route.withNamedParamsInQuery.phpt
index 33a0ec0e8..a6db1fc72 100644
--- a/tests/Application.Routers/Route.withNamedParamsInQuery.phpt
+++ b/tests/Application.Routers/Route.withNamedParamsInQuery.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with WithNamedParamsInQuery
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.withParamsInQuery.phpt b/tests/Application.Routers/Route.withParamsInQuery.phpt
index 1a14dc531..2ebbfb048 100644
--- a/tests/Application.Routers/Route.withParamsInQuery.phpt
+++ b/tests/Application.Routers/Route.withParamsInQuery.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with WithParamsInQuery
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.withUserClass.phpt b/tests/Application.Routers/Route.withUserClass.phpt
index 33ff6551b..71a222b51 100644
--- a/tests/Application.Routers/Route.withUserClass.phpt
+++ b/tests/Application.Routers/Route.withUserClass.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with WithUserClass
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.withUserClassAlt.phpt b/tests/Application.Routers/Route.withUserClassAlt.phpt
index 67cf4a6d7..2fa33986f 100644
--- a/tests/Application.Routers/Route.withUserClassAlt.phpt
+++ b/tests/Application.Routers/Route.withUserClassAlt.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with WithUserClassAlt
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/Route.withUserClassAndUserPattern.phpt b/tests/Application.Routers/Route.withUserClassAndUserPattern.phpt
index d988fc317..012d850fe 100644
--- a/tests/Application.Routers/Route.withUserClassAndUserPattern.phpt
+++ b/tests/Application.Routers/Route.withUserClassAndUserPattern.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\Routers\Route with WithUserClassAndUserPattern
*/
-use Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/RouteList.basic.phpt b/tests/Application.Routers/RouteList.basic.phpt
index 92755e238..2abc0c2cc 100644
--- a/tests/Application.Routers/RouteList.basic.phpt
+++ b/tests/Application.Routers/RouteList.basic.phpt
@@ -4,9 +4,9 @@
* Test: Nette\Application\Routers\RouteList default usage.
*/
-use Nette\Application\Routers\RouteList,
- Nette\Application\Routers\Route,
- Tester\Assert;
+use Nette\Application\Routers\RouteList;
+use Nette\Application\Routers\Route;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Application.Routers/SimpleRouter.invalid.phpt b/tests/Application.Routers/SimpleRouter.invalid.phpt
index 5b40d1546..7c35fa3c4 100644
--- a/tests/Application.Routers/SimpleRouter.invalid.phpt
+++ b/tests/Application.Routers/SimpleRouter.invalid.phpt
@@ -4,9 +4,9 @@
* Test: Nette\Application\Routers\SimpleRouter invalid request.
*/
-use Nette\Http,
- Nette\Application\Routers\SimpleRouter,
- Tester\Assert;
+use Nette\Http;
+use Nette\Application\Routers\SimpleRouter;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -14,20 +14,20 @@ require __DIR__ . '/../bootstrap.php';
-test(function() {
+test(function () {
$router = new SimpleRouter();
$url = new Http\UrlScript('http://nette.org?presenter[]=foo');
$httpRequest = new Http\Request($url);
$req = $router->match($httpRequest);
- Assert::null( $req );
+ Assert::null($req);
});
-test(function() {
+test(function () {
$router = new SimpleRouter();
$url = new Http\UrlScript('http://nette.org');
$httpRequest = new Http\Request($url);
$req = $router->match($httpRequest);
- Assert::null( $req );
+ Assert::null($req);
});
diff --git a/tests/Application.Routers/SimpleRouter.module.phpt b/tests/Application.Routers/SimpleRouter.module.phpt
index 0cd447958..f0734cc89 100644
--- a/tests/Application.Routers/SimpleRouter.module.phpt
+++ b/tests/Application.Routers/SimpleRouter.module.phpt
@@ -4,9 +4,9 @@
* Test: Nette\Application\Routers\SimpleRouter and modules.
*/
-use Nette\Http,
- Nette\Application,
- Tester\Assert;
+use Nette\Http;
+use Nette\Application;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -24,10 +24,10 @@ $url->setQuery(array(
$httpRequest = new Http\Request($url);
$req = $router->match($httpRequest);
-Assert::same( 'main:sub:myPresenter', $req->getPresenterName() );
+Assert::same('main:sub:myPresenter', $req->getPresenterName());
$url = $router->constructUrl($req, $httpRequest->getUrl());
-Assert::same( 'http://nette.org/file.php?presenter=myPresenter', $url );
+Assert::same('http://nette.org/file.php?presenter=myPresenter', $url);
$req = new Application\Request(
'othermodule:presenter',
@@ -35,4 +35,4 @@ $req = new Application\Request(
array()
);
$url = $router->constructUrl($req, $httpRequest->getUrl());
-Assert::null( $url );
+Assert::null($url);
diff --git a/tests/Application.Routers/SimpleRouter.phpt b/tests/Application.Routers/SimpleRouter.phpt
index 2fa31e52d..83238d559 100644
--- a/tests/Application.Routers/SimpleRouter.phpt
+++ b/tests/Application.Routers/SimpleRouter.phpt
@@ -4,9 +4,9 @@
* Test: Nette\Application\Routers\SimpleRouter basic functions.
*/
-use Nette\Http,
- Nette\Application\Routers\SimpleRouter,
- Tester\Assert;
+use Nette\Http;
+use Nette\Application\Routers\SimpleRouter;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -28,11 +28,11 @@ $url->setQuery(array(
$httpRequest = new Http\Request($url);
$req = $router->match($httpRequest);
-Assert::same( 'myPresenter', $req->getPresenterName() );
-Assert::same( 'action', $req->parameters['action'] );
-Assert::same( '12', $req->parameters['id'] );
-Assert::same( 'testvalue', $req->parameters['test'] );
-Assert::same( 'anyvalue', $req->parameters['any'] );
+Assert::same('myPresenter', $req->getPresenterName());
+Assert::same('action', $req->parameters['action']);
+Assert::same('12', $req->parameters['id']);
+Assert::same('testvalue', $req->parameters['test']);
+Assert::same('anyvalue', $req->parameters['any']);
$url = $router->constructUrl($req, $httpRequest->getUrl());
-Assert::same( 'http://nette.org/file.php?action=action&test=testvalue&presenter=myPresenter', $url );
+Assert::same('http://nette.org/file.php?action=action&test=testvalue&presenter=myPresenter', $url);
diff --git a/tests/Application.Routers/SimpleRouter.secured.phpt b/tests/Application.Routers/SimpleRouter.secured.phpt
index 4083531c8..456d56f32 100644
--- a/tests/Application.Routers/SimpleRouter.secured.phpt
+++ b/tests/Application.Routers/SimpleRouter.secured.phpt
@@ -4,9 +4,9 @@
* Test: Nette\Application\Routers\SimpleRouter with secured connection.
*/
-use Nette\Http,
- Nette\Application,
- Tester\Assert;
+use Nette\Http;
+use Nette\Application;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -31,4 +31,4 @@ $req = new Application\Request(
);
$url = $router->constructUrl($req, $httpRequest->getUrl());
-Assert::same( 'https://nette.org/file.php?presenter=othermodule%3Apresenter', $url );
+Assert::same('https://nette.org/file.php?presenter=othermodule%3Apresenter', $url);
diff --git a/tests/Application.templates/Presenter.formatLayoutTemplateFiles.phpt b/tests/Application.templates/Presenter.formatLayoutTemplateFiles.phpt
index 86e65c9ef..545b444ca 100644
--- a/tests/Application.templates/Presenter.formatLayoutTemplateFiles.phpt
+++ b/tests/Application.templates/Presenter.formatLayoutTemplateFiles.phpt
@@ -4,8 +4,8 @@
* Test: Presenter::formatLayoutTemplateFiles.
*/
-use Nette\Application\UI\Presenter,
- Tester\Assert;
+use Nette\Application\UI\Presenter;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -13,42 +13,42 @@ require __DIR__ . '/one/Presenter1.inc';
require __DIR__ . '/two/Presenter2.inc';
-test(function() { // with subdir templates
+test(function () { // with subdir templates
$presenter = new Presenter1;
$presenter->setParent(NULL, 'One');
$presenter->setLayout('my');
- Assert::same( array(
+ Assert::same(array(
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One/@my.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One.@my.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One/@my.phtml',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One.@my.phtml',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/@my.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/@my.phtml',
- ), $presenter->formatLayoutTemplateFiles() );
+ ), $presenter->formatLayoutTemplateFiles());
});
-test(function() { // without subdir templates
+test(function () { // without subdir templates
$presenter = new Presenter2;
$presenter->setParent(NULL, 'Two');
- Assert::same( array(
+ Assert::same(array(
__DIR__ . '/templates/Two/@layout.latte',
__DIR__ . '/templates/Two.@layout.latte',
__DIR__ . '/templates/Two/@layout.phtml',
__DIR__ . '/templates/Two.@layout.phtml',
__DIR__ . '/templates/@layout.latte',
__DIR__ . '/templates/@layout.phtml',
- ), $presenter->formatLayoutTemplateFiles() );
+ ), $presenter->formatLayoutTemplateFiles());
});
-test(function() { // with module & subdir templates
+test(function () { // with module & subdir templates
$presenter = new Presenter1;
$presenter->setParent(NULL, 'Module:SubModule:One');
- Assert::same( array(
+ Assert::same(array(
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One/@layout.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One.@layout.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One/@layout.phtml',
@@ -59,15 +59,15 @@ test(function() { // with module & subdir templates
__DIR__ . '/templates/@layout.phtml',
dirname(__DIR__) . '/templates/@layout.latte',
dirname(__DIR__) . '/templates/@layout.phtml',
- ), $presenter->formatLayoutTemplateFiles() );
+ ), $presenter->formatLayoutTemplateFiles());
});
-test(function() { // with module & without subdir templates
+test(function () { // with module & without subdir templates
$presenter = new Presenter2;
$presenter->setParent(NULL, 'Module:SubModule:Two');
- Assert::same( array(
+ Assert::same(array(
__DIR__ . '/templates/Two/@layout.latte',
__DIR__ . '/templates/Two.@layout.latte',
__DIR__ . '/templates/Two/@layout.phtml',
@@ -78,5 +78,5 @@ test(function() { // with module & without subdir templates
dirname(__DIR__) . '/templates/@layout.phtml',
dirname(dirname(__DIR__)) . '/templates/@layout.latte',
dirname(dirname(__DIR__)) . '/templates/@layout.phtml',
- ), $presenter->formatLayoutTemplateFiles() );
+ ), $presenter->formatLayoutTemplateFiles());
});
diff --git a/tests/Application.templates/Presenter.formatTemplateFiles.phpt b/tests/Application.templates/Presenter.formatTemplateFiles.phpt
index 0b261ecb6..784d709aa 100644
--- a/tests/Application.templates/Presenter.formatTemplateFiles.phpt
+++ b/tests/Application.templates/Presenter.formatTemplateFiles.phpt
@@ -4,8 +4,8 @@
* Test: Presenter::formatTemplateFiles.
*/
-use Nette\Application\UI\Presenter,
- Tester\Assert;
+use Nette\Application\UI\Presenter;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -13,57 +13,57 @@ require __DIR__ . '/one/Presenter1.inc';
require __DIR__ . '/two/Presenter2.inc';
-test(function() { // with subdir templates
+test(function () { // with subdir templates
$presenter = new Presenter1;
$presenter->setParent(NULL, 'One');
$presenter->setView('view');
- Assert::same( array(
+ Assert::same(array(
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One/view.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One.view.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One/view.phtml',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One.view.phtml',
- ), $presenter->formatTemplateFiles() );
+ ), $presenter->formatTemplateFiles());
});
-test(function() { // without subdir templates
+test(function () { // without subdir templates
$presenter = new Presenter2;
$presenter->setParent(NULL, 'Two');
$presenter->setView('view');
- Assert::same( array(
+ Assert::same(array(
__DIR__ . '/templates/Two/view.latte',
__DIR__ . '/templates/Two.view.latte',
__DIR__ . '/templates/Two/view.phtml',
__DIR__ . '/templates/Two.view.phtml',
- ), $presenter->formatTemplateFiles() );
+ ), $presenter->formatTemplateFiles());
});
-test(function() { // with module & subdir templates
+test(function () { // with module & subdir templates
$presenter = new Presenter1;
$presenter->setParent(NULL, 'Module:One');
$presenter->setView('view');
- Assert::same( array(
+ Assert::same(array(
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One/view.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One.view.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One/view.phtml',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One.view.phtml',
- ), $presenter->formatTemplateFiles() );
+ ), $presenter->formatTemplateFiles());
});
-test(function() { // with module & without subdir templates
+test(function () { // with module & without subdir templates
$presenter = new Presenter2;
$presenter->setParent(NULL, 'Module:Two');
$presenter->setView('view');
- Assert::same( array(
+ Assert::same(array(
__DIR__ . '/templates/Two/view.latte',
__DIR__ . '/templates/Two.view.latte',
__DIR__ . '/templates/Two/view.phtml',
__DIR__ . '/templates/Two.view.phtml',
- ), $presenter->formatTemplateFiles() );
+ ), $presenter->formatTemplateFiles());
});
diff --git a/tests/Application/Control.isControlInvalid.phpt b/tests/Application/Control.isControlInvalid.phpt
index 476583edc..dc7e2a9fd 100644
--- a/tests/Application/Control.isControlInvalid.phpt
+++ b/tests/Application/Control.isControlInvalid.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\UI\Control::isControlInvalid()
*/
-use Nette\Application\UI,
- Tester\Assert;
+use Nette\Application\UI;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -17,7 +17,7 @@ class TestControl extends UI\Control
}
-test(function() {
+test(function () {
$control = new TestControl();
$child = new TestControl();
$control->addComponent($child, 'foo');
@@ -28,7 +28,7 @@ test(function() {
});
-test(function() {
+test(function () {
$control = new TestControl();
$child = new Nette\ComponentModel\Container();
$grandChild = new TestControl();
diff --git a/tests/Application/FileResponse.contentDisposition.phpt b/tests/Application/FileResponse.contentDisposition.phpt
index 673e9fb48..c940a284f 100644
--- a/tests/Application/FileResponse.contentDisposition.phpt
+++ b/tests/Application/FileResponse.contentDisposition.phpt
@@ -4,9 +4,9 @@
* Test: Nette\Application\Responses\FileResponse.
*/
-use Nette\Application\Responses\FileResponse,
- Nette\Http,
- Tester\Assert;
+use Nette\Application\Responses\FileResponse;
+use Nette\Http;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -16,7 +16,7 @@ if (PHP_SAPI === 'cli') {
}
-test(function() {
+test(function () {
$file = __FILE__;
$fileResponse = new FileResponse($file);
$origData = file_get_contents($file);
@@ -27,12 +27,12 @@ test(function() {
ob_start();
$fileResponse->send(new Http\Request(new Http\UrlScript), $response = new Http\Response);
- Assert::same( $origData, ob_get_clean() );
- Assert::same( 'attachment; filename="' . $fileName . '"; filename*=utf-8\'\'' . rawurlencode($fileName), $response->getHeader('Content-Disposition') );
+ Assert::same($origData, ob_get_clean());
+ Assert::same('attachment; filename="' . $fileName . '"; filename*=utf-8\'\'' . rawurlencode($fileName), $response->getHeader('Content-Disposition'));
});
-test(function() {
+test(function () {
$file = __FILE__;
$fileResponse = new FileResponse($file, NULL, NULL, FALSE);
$origData = file_get_contents($file);
@@ -43,12 +43,12 @@ test(function() {
ob_start();
$fileResponse->send(new Http\Request(new Http\UrlScript), $response = new Http\Response);
- Assert::same( $origData, ob_get_clean() );
+ Assert::same($origData, ob_get_clean());
Assert::same('inline; filename="' . $fileName . '"; filename*=utf-8\'\'' . rawurlencode($fileName), $response->getHeader('Content-Disposition'));
});
-test(function() {
+test(function () {
$file = __FILE__;
$fileName = 'žluťoučký kůň.txt';
$fileResponse = new FileResponse($file, $fileName);
@@ -57,6 +57,6 @@ test(function() {
ob_start();
$fileResponse->send(new Http\Request(new Http\UrlScript), $response = new Http\Response);
- Assert::same( $origData, ob_get_clean() );
+ Assert::same($origData, ob_get_clean());
Assert::same('attachment; filename="' . $fileName . '"; filename*=utf-8\'\'' . rawurlencode($fileName), $response->getHeader('Content-Disposition'));
});
diff --git a/tests/Application/FileResponse.full.phpt b/tests/Application/FileResponse.full.phpt
index 9e16fc8d8..364733695 100644
--- a/tests/Application/FileResponse.full.phpt
+++ b/tests/Application/FileResponse.full.phpt
@@ -4,20 +4,20 @@
* Test: Nette\Application\Responses\FileResponse.
*/
-use Nette\Application\Responses\FileResponse,
- Nette\Http,
- Tester\Assert;
+use Nette\Application\Responses\FileResponse;
+use Nette\Http;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
-test(function() {
+test(function () {
$file = __FILE__;
$fileResponse = new FileResponse($file);
$origData = file_get_contents($file);
ob_start();
$fileResponse->send(new Http\Request(new Http\UrlScript), new Http\Response);
- Assert::same( $origData, ob_get_clean() );
+ Assert::same($origData, ob_get_clean());
});
diff --git a/tests/Application/FileResponse.range.phpt b/tests/Application/FileResponse.range.phpt
index 45be28716..802e70cd9 100644
--- a/tests/Application/FileResponse.range.phpt
+++ b/tests/Application/FileResponse.range.phpt
@@ -5,9 +5,9 @@
* @httpCode -
*/
-use Nette\Application\Responses\FileResponse,
- Nette\Http,
- Tester\Assert;
+use Nette\Application\Responses\FileResponse;
+use Nette\Http;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -17,83 +17,83 @@ $file = __FILE__;
$fileResponse = new FileResponse($file);
$origData = file_get_contents($file);
-test(function() use ($fileResponse, $origData) {
+test(function () use ($fileResponse, $origData) {
ob_start();
$fileResponse->send(
new Http\Request(new Http\UrlScript, NULL, NULL, NULL, NULL, array('range' => 'bytes=10-20')),
$response = new Http\Response
);
- Assert::same( substr($origData, 10, 11), ob_get_clean() );
- Assert::same( 206, $response->getCode() );
+ Assert::same(substr($origData, 10, 11), ob_get_clean());
+ Assert::same(206, $response->getCode());
});
-test(function() use ($fileResponse, $origData) {
+test(function () use ($fileResponse, $origData) {
ob_start();
$fileResponse->send(
new Http\Request(new Http\UrlScript, NULL, NULL, NULL, NULL, array('range' => 'bytes=10-10')),
new Http\Response
);
- Assert::same( substr($origData, 10, 1), ob_get_clean() );
+ Assert::same(substr($origData, 10, 1), ob_get_clean());
});
-test(function() use ($fileResponse, $origData, $file) {
+test(function () use ($fileResponse, $origData, $file) {
ob_start();
$fileResponse->send(
new Http\Request(new Http\UrlScript, NULL, NULL, NULL, NULL, array('range' => 'bytes=10-' . filesize($file))),
new Http\Response
);
- Assert::same( substr($origData, 10), ob_get_clean() );
+ Assert::same(substr($origData, 10), ob_get_clean());
});
-test(function() use ($fileResponse, $origData) { // prefix
+test(function () use ($fileResponse, $origData) { // prefix
ob_start();
$fileResponse->send(
new Http\Request(new Http\UrlScript, NULL, NULL, NULL, NULL, array('range' => 'bytes=20-')),
new Http\Response
);
- Assert::same( substr($origData, 20), ob_get_clean() );
+ Assert::same(substr($origData, 20), ob_get_clean());
});
-test(function() use ($fileResponse, $origData, $file) { // prefix
+test(function () use ($fileResponse, $origData, $file) { // prefix
ob_start();
$fileResponse->send(
new Http\Request(new Http\UrlScript, NULL, NULL, NULL, NULL, array('range' => 'bytes=' . (filesize($file) - 1) . '-')),
new Http\Response
);
- Assert::same( substr($origData, -1), ob_get_clean() );
+ Assert::same(substr($origData, -1), ob_get_clean());
});
-test(function() use ($fileResponse, $file) { // prefix
+test(function () use ($fileResponse, $file) { // prefix
ob_start();
$fileResponse->send(
new Http\Request(new Http\UrlScript, NULL, NULL, NULL, NULL, array('range' => 'bytes=' . filesize($file) . '-')),
$response = new Http\Response
);
- Assert::same( '', ob_get_clean() );
- Assert::same( 416, $response->getCode() );
+ Assert::same('', ob_get_clean());
+ Assert::same(416, $response->getCode());
});
-test(function() use ($fileResponse, $origData) { // suffix
+test(function () use ($fileResponse, $origData) { // suffix
ob_start();
$fileResponse->send(
new Http\Request(new Http\UrlScript, NULL, NULL, NULL, NULL, array('range' => 'bytes=-20')),
new Http\Response
);
- Assert::same( substr($origData, -20), ob_get_clean() );
+ Assert::same(substr($origData, -20), ob_get_clean());
});
-test(function() use ($fileResponse, $origData, $file) { // suffix
+test(function () use ($fileResponse, $origData, $file) { // suffix
ob_start();
$fileResponse->send(
new Http\Request(new Http\UrlScript, NULL, NULL, NULL, NULL, array('range' => 'bytes=-' . filesize($file))),
new Http\Response
);
- Assert::same( $origData, ob_get_clean() );
+ Assert::same($origData, ob_get_clean());
});
diff --git a/tests/Application/Form.phpt b/tests/Application/Form.phpt
index 0adfb9cde..0c0f13171 100644
--- a/tests/Application/Form.phpt
+++ b/tests/Application/Form.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\UI\Form
*/
-use Nette\Application\UI,
- Tester\Assert;
+use Nette\Application\UI;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -17,14 +17,14 @@ class TestPresenter extends UI\Presenter
}
-test(function() {
+test(function () {
$presenter = new TestPresenter;
$form = new UI\Form($presenter, 'name');
$form->setMethod($form::GET); // must not throw exception
});
-test(function() { // compatibility with 2.0
+test(function () { // compatibility with 2.0
$presenter = new TestPresenter;
$form = new UI\Form;
$form->setAction('action');
diff --git a/tests/Application/MicroPresenter.invoke.phpt b/tests/Application/MicroPresenter.invoke.phpt
index 1222db3ca..9c3645ba8 100644
--- a/tests/Application/MicroPresenter.invoke.phpt
+++ b/tests/Application/MicroPresenter.invoke.phpt
@@ -4,8 +4,8 @@
* Test: NetteModule\MicroPresenter
*/
-use Nette\Application\Request,
- Tester\Assert;
+use Nette\Application\Request;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -20,11 +20,11 @@ class Invokable extends Nette\Object
}
-test(function() {
+test(function () {
$presenter = $p = new NetteModule\MicroPresenter;
$presenter->run(new Request('Nette:Micro', 'GET', array(
- 'callback' => function($id, $page, $presenter) use ($p) {
+ 'callback' => function ($id, $page, $presenter) use ($p) {
Assert::same($p, $presenter);
Notes::add('Callback id ' . $id . ' page ' . $page);
},
@@ -32,12 +32,12 @@ test(function() {
'page' => 2,
)));
Assert::same(array(
- 'Callback id 1 page 2'
+ 'Callback id 1 page 2',
), Notes::fetch());
});
-test(function() {
+test(function () {
$presenter = new NetteModule\MicroPresenter;
$presenter->run(new Request('Nette:Micro', 'GET', array(
@@ -46,6 +46,6 @@ test(function() {
'page' => 2,
)));
Assert::same(array(
- 'Callback id 1 page 2'
+ 'Callback id 1 page 2',
), Notes::fetch());
});
diff --git a/tests/Application/MicroPresenter.response.phpt b/tests/Application/MicroPresenter.response.phpt
index d5d9e67bf..eca845b58 100644
--- a/tests/Application/MicroPresenter.response.phpt
+++ b/tests/Application/MicroPresenter.response.phpt
@@ -4,9 +4,9 @@
* Test: NetteModule\MicroPresenter
*/
-use Nette\Application\Request,
- Nette\Http,
- Tester\Assert;
+use Nette\Application\Request;
+use Nette\Http;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -14,166 +14,166 @@ require __DIR__ . '/../bootstrap.php';
class LatteFactory implements Nette\Bridges\ApplicationLatte\ILatteFactory
{
- private $engine;
+ private $engine;
- public function __construct(Latte\Engine $engine)
- {
- $this->engine = $engine;
- }
+ public function __construct(Latte\Engine $engine)
+ {
+ $this->engine = $engine;
+ }
- public function create()
- {
- return $this->engine;
- }
+ public function create()
+ {
+ return $this->engine;
+ }
}
class MicroContainer extends Nette\DI\Container
{
- protected $meta = array(
- 'types' => array(
- 'nette\\bridges\\applicationlatte\\ilattefactory' => array('latte.latteFactory'),
- 'Nette\\Bridges\\ApplicationLatte\\ILatteFactory' => array(1 => array('latte.latteFactory')),
- ),
- );
-
- public static function create()
- {
- $container = new self();
- $container->addService('latte.latteFactory', new LatteFactory(new Latte\Engine()));
- return $container;
- }
+ protected $meta = array(
+ 'types' => array(
+ 'nette\\bridges\\applicationlatte\\ilattefactory' => array('latte.latteFactory'),
+ 'Nette\\Bridges\\ApplicationLatte\\ILatteFactory' => array(1 => array('latte.latteFactory')),
+ ),
+ );
+
+ public static function create()
+ {
+ $container = new self();
+ $container->addService('latte.latteFactory', new LatteFactory(new Latte\Engine()));
+ return $container;
+ }
}
class Responder
{
- public static function render(Nette\Application\Responses\TextResponse $response)
- {
- ob_start();
- $response->send(new Http\Request(new Http\UrlScript()), new Http\Response(NULL));
- return ob_get_clean();
- }
+ public static function render(Nette\Application\Responses\TextResponse $response)
+ {
+ ob_start();
+ $response->send(new Http\Request(new Http\UrlScript()), new Http\Response(NULL));
+ return ob_get_clean();
+ }
}
test(function () {
- $presenter = new NetteModule\MicroPresenter(MicroContainer::create());
- $response = $presenter->run(new Request('Nette:Micro', 'GET', array(
- 'callback' => function () {
- return 'test';
- },
- )));
-
- Assert::type('Nette\Application\Responses\TextResponse', $response);
- Assert::same('test', Responder::render($response));
+ $presenter = new NetteModule\MicroPresenter(MicroContainer::create());
+ $response = $presenter->run(new Request('Nette:Micro', 'GET', array(
+ 'callback' => function () {
+ return 'test';
+ },
+ )));
+
+ Assert::type('Nette\Application\Responses\TextResponse', $response);
+ Assert::same('test', Responder::render($response));
});
test(function () {
- $presenter = new NetteModule\MicroPresenter(MicroContainer::create());
- $response = $presenter->run(new Request('Nette:Micro', 'GET', array(
- 'callback' => function ($param) {
- return $param;
- },
- 'param' => 'test'
- )));
-
- Assert::type('Nette\Application\Responses\TextResponse', $response);
- Assert::same('test', Responder::render($response));
+ $presenter = new NetteModule\MicroPresenter(MicroContainer::create());
+ $response = $presenter->run(new Request('Nette:Micro', 'GET', array(
+ 'callback' => function ($param) {
+ return $param;
+ },
+ 'param' => 'test',
+ )));
+
+ Assert::type('Nette\Application\Responses\TextResponse', $response);
+ Assert::same('test', Responder::render($response));
});
test(function () {
- $presenter = new NetteModule\MicroPresenter(MicroContainer::create());
- $response = $presenter->run(new Request('Nette:Micro', 'GET', array(
- 'callback' => function () {
- return '{=date(Y)}';
- },
- )));
-
- Assert::type('Nette\Application\Responses\TextResponse', $response);
- Assert::same(date('Y'), Responder::render($response));
+ $presenter = new NetteModule\MicroPresenter(MicroContainer::create());
+ $response = $presenter->run(new Request('Nette:Micro', 'GET', array(
+ 'callback' => function () {
+ return '{=date(Y)}';
+ },
+ )));
+
+ Assert::type('Nette\Application\Responses\TextResponse', $response);
+ Assert::same(date('Y'), Responder::render($response));
});
test(function () {
- $presenter = new NetteModule\MicroPresenter(MicroContainer::create());
- $response = $presenter->run(new Request('Nette:Micro', 'GET', array(
- 'callback' => function () {
- return array(new SplFileInfo(Tester\FileMock::create('{$param}')), array());
- },
- 'param' => 'test',
- )));
-
- Assert::type('Nette\Application\Responses\TextResponse', $response);
- Assert::same('test', Responder::render($response));
+ $presenter = new NetteModule\MicroPresenter(MicroContainer::create());
+ $response = $presenter->run(new Request('Nette:Micro', 'GET', array(
+ 'callback' => function () {
+ return array(new SplFileInfo(Tester\FileMock::create('{$param}')), array());
+ },
+ 'param' => 'test',
+ )));
+
+ Assert::type('Nette\Application\Responses\TextResponse', $response);
+ Assert::same('test', Responder::render($response));
});
test(function () {
- $latteFactory = new LatteFactory(new Latte\Engine());
- $presenter = new NetteModule\MicroPresenter;
-
- $response = $presenter->run(new Request('Nette:Micro', 'GET', array(
- 'callback' => function ($presenter) use ($latteFactory) {
- $template = $presenter->createTemplate(NULL, function () use ($latteFactory) {
- return $latteFactory->create();
- });
- $template->getLatte()->setLoader(new Latte\Loaders\StringLoader);
- $template->setFile('test');
-
- return $template;
- },
- )));
-
- Assert::type('Nette\Application\Responses\TextResponse', $response);
- Assert::same('test', Responder::render($response));
+ $latteFactory = new LatteFactory(new Latte\Engine());
+ $presenter = new NetteModule\MicroPresenter;
+
+ $response = $presenter->run(new Request('Nette:Micro', 'GET', array(
+ 'callback' => function ($presenter) use ($latteFactory) {
+ $template = $presenter->createTemplate(NULL, function () use ($latteFactory) {
+ return $latteFactory->create();
+ });
+ $template->getLatte()->setLoader(new Latte\Loaders\StringLoader);
+ $template->setFile('test');
+
+ return $template;
+ },
+ )));
+
+ Assert::type('Nette\Application\Responses\TextResponse', $response);
+ Assert::same('test', Responder::render($response));
});
test(function () {
- $latteFactory = new LatteFactory(new Latte\Engine());
- $presenter = new NetteModule\MicroPresenter;
-
- $response = $presenter->run(new Request('Nette:Micro', 'GET', array(
- 'callback' => function ($presenter) use ($latteFactory) {
- $template = $presenter->createTemplate(NULL, function () use ($latteFactory) {
- return $latteFactory->create();
- });
- $template->getLatte()->setLoader(new Latte\Loaders\FileLoader());
- $template->setFile(new SplFileInfo(Tester\FileMock::create('{$param}')));
- $template->setParameters(array('param' => 'test'));
-
- return $template;
- },
- )));
-
- Assert::type('Nette\Application\Responses\TextResponse', $response);
- Assert::same('test', Responder::render($response));
+ $latteFactory = new LatteFactory(new Latte\Engine());
+ $presenter = new NetteModule\MicroPresenter;
+
+ $response = $presenter->run(new Request('Nette:Micro', 'GET', array(
+ 'callback' => function ($presenter) use ($latteFactory) {
+ $template = $presenter->createTemplate(NULL, function () use ($latteFactory) {
+ return $latteFactory->create();
+ });
+ $template->getLatte()->setLoader(new Latte\Loaders\FileLoader());
+ $template->setFile(new SplFileInfo(Tester\FileMock::create('{$param}')));
+ $template->setParameters(array('param' => 'test'));
+
+ return $template;
+ },
+ )));
+
+ Assert::type('Nette\Application\Responses\TextResponse', $response);
+ Assert::same('test', Responder::render($response));
});
test(function () {
- $filename = 'notfound.latte';
- Assert::throws(function () use ($filename) {
- $latteFactory = new LatteFactory(new Latte\Engine());
- $presenter = new NetteModule\MicroPresenter;
-
- $response = $presenter->run(new Request('Nette:Micro', 'GET', array(
- 'callback' => function ($presenter) use ($latteFactory, $filename) {
- $template = $presenter->createTemplate(NULL, function () use ($latteFactory) {
- return $latteFactory->create();
- });
- $template->getLatte()->setLoader(new Latte\Loaders\FileLoader());
- $template->setFile($filename);
- $template->setParameters(array('param' => 'test'));
-
- return $template;
- },
- )));
-
- Responder::render($response);
- }, '\RuntimeException', "Missing template file '$filename'.");
+ $filename = 'notfound.latte';
+ Assert::exception(function () use ($filename) {
+ $latteFactory = new LatteFactory(new Latte\Engine());
+ $presenter = new NetteModule\MicroPresenter;
+
+ $response = $presenter->run(new Request('Nette:Micro', 'GET', array(
+ 'callback' => function ($presenter) use ($latteFactory, $filename) {
+ $template = $presenter->createTemplate(NULL, function () use ($latteFactory) {
+ return $latteFactory->create();
+ });
+ $template->getLatte()->setLoader(new Latte\Loaders\FileLoader());
+ $template->setFile($filename);
+ $template->setParameters(array('param' => 'test'));
+
+ return $template;
+ },
+ )));
+
+ Responder::render($response);
+ }, '\RuntimeException', "Missing template file '$filename'.");
});
diff --git a/tests/Application/Presenter.link().phpt b/tests/Application/Presenter.link().phpt
index 019cdfddb..0663edc02 100644
--- a/tests/Application/Presenter.link().phpt
+++ b/tests/Application/Presenter.link().phpt
@@ -4,9 +4,9 @@
* Test: Nette\Application\UI\Presenter::link()
*/
-use Nette\Http,
- Nette\Application,
- Tester\Assert;
+use Nette\Http;
+use Nette\Application;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -79,62 +79,62 @@ class TestPresenter extends Application\UI\Presenter
$this['mycontrol'] = new TestControl;
// Presenter & action link
- Assert::same( '/index.php?action=product&presenter=Test', $this->link('product', array('var1' => $this->var1)) );
- Assert::same( '/index.php?var1=20&action=product&presenter=Test', $this->link('product', array('var1' => $this->var1 * 2, 'ok' => TRUE)) );
- Assert::same( '/index.php?var1=1&ok=0&action=product&presenter=Test', $this->link('product', array('var1' => TRUE, 'ok' => '0')) );
- Assert::same( "#error: Invalid value for persistent parameter 'ok' in 'Test', expected boolean.", $this->link('product', array('var1' => NULL, 'ok' => 'a')) );
- Assert::same( "#error: Invalid value for persistent parameter 'var1' in 'Test', expected integer.", $this->link('product', array('var1' => array(1), 'ok' => FALSE)) );
- Assert::same( "#error: Unable to pass parameters to action 'Test:product', missing corresponding method.", $this->link('product', 1, 2) );
- Assert::same( '/index.php?x=1&y=2&action=product&presenter=Test', $this->link('product', array('x' => 1, 'y' => 2)) );
- Assert::same( '/index.php?action=product&presenter=Test', $this->link('product') );
- Assert::same( '#error: Destination must be non-empty string.', $this->link('') );
- Assert::same( '/index.php?x=1&y=2&action=product&presenter=Test', $this->link('product?x=1&y=2') );
- Assert::same( '/index.php?x=1&y=2&action=product&presenter=Test#fragment', $this->link('product?x=1&y=2#fragment') );
- Assert::same( 'http://localhost/index.php?x=1&y=2&action=product&presenter=Test#fragment', $this->link('//product?x=1&y=2#fragment') );
+ Assert::same('/index.php?action=product&presenter=Test', $this->link('product', array('var1' => $this->var1)));
+ Assert::same('/index.php?var1=20&action=product&presenter=Test', $this->link('product', array('var1' => $this->var1 * 2, 'ok' => TRUE)));
+ Assert::same('/index.php?var1=1&ok=0&action=product&presenter=Test', $this->link('product', array('var1' => TRUE, 'ok' => '0')));
+ Assert::same("#error: Invalid value for persistent parameter 'ok' in 'Test', expected boolean.", $this->link('product', array('var1' => NULL, 'ok' => 'a')));
+ Assert::same("#error: Invalid value for persistent parameter 'var1' in 'Test', expected integer.", $this->link('product', array('var1' => array(1), 'ok' => FALSE)));
+ Assert::same("#error: Unable to pass parameters to action 'Test:product', missing corresponding method.", $this->link('product', 1, 2));
+ Assert::same('/index.php?x=1&y=2&action=product&presenter=Test', $this->link('product', array('x' => 1, 'y' => 2)));
+ Assert::same('/index.php?action=product&presenter=Test', $this->link('product'));
+ Assert::same('#error: Destination must be non-empty string.', $this->link(''));
+ Assert::same('/index.php?x=1&y=2&action=product&presenter=Test', $this->link('product?x=1&y=2'));
+ Assert::same('/index.php?x=1&y=2&action=product&presenter=Test#fragment', $this->link('product?x=1&y=2#fragment'));
+ Assert::same('http://localhost/index.php?x=1&y=2&action=product&presenter=Test#fragment', $this->link('//product?x=1&y=2#fragment'));
// Other presenter & action link
- Assert::same( '/index.php?var1=10&action=product&presenter=Other', $this->link('Other:product', array('var1' => $this->var1)) );
- Assert::same( '/index.php?action=product&presenter=Other', $this->link('Other:product', array('var1' => $this->var1 * 2)) );
- Assert::same( '/index.php?var1=123&presenter=Nette%3AMicro', $this->link('Nette:Micro:', array('var1' => 123)) );
+ Assert::same('/index.php?var1=10&action=product&presenter=Other', $this->link('Other:product', array('var1' => $this->var1)));
+ Assert::same('/index.php?action=product&presenter=Other', $this->link('Other:product', array('var1' => $this->var1 * 2)));
+ Assert::same('/index.php?var1=123&presenter=Nette%3AMicro', $this->link('Nette:Micro:', array('var1' => 123)));
// Presenter & signal link
- Assert::same( '/index.php?action=default&do=buy&presenter=Test', $this->link('buy!', array('var1' => $this->var1)) );
- Assert::same( '/index.php?var1=20&action=default&do=buy&presenter=Test', $this->link('buy!', array('var1' => $this->var1 * 2)) );
- Assert::same( '/index.php?y=2&action=default&do=buy&presenter=Test', $this->link('buy!', 1, 2) );
- Assert::same( '/index.php?y=2&bool=1&str=1&action=default&do=buy&presenter=Test', $this->link('buy!', '1', '2', TRUE, TRUE) );
- Assert::same( '/index.php?y=2&str=0&action=default&do=buy&presenter=Test', $this->link('buy!', '1', '2', FALSE, FALSE) );
- Assert::same( '/index.php?action=default&do=buy&presenter=Test', $this->link('buy!', array(1), (object) array(1)) );
- Assert::same( '/index.php?y=2&action=default&do=buy&presenter=Test', $this->link('buy!', array(1, 'y' => 2)) );
- Assert::same( '/index.php?y=2&action=default&do=buy&presenter=Test', $this->link('buy!', array('x' => 1, 'y' => 2, 'var1' => $this->var1)) );
- Assert::same( '#error: Signal must be non-empty string.', $this->link('!') );
- Assert::same( '/index.php?action=default&presenter=Test', $this->link('this', array('var1' => $this->var1)) );
- Assert::same( '/index.php?action=default&presenter=Test', $this->link('this!', array('var1' => $this->var1)) );
- Assert::same( '/index.php?sort%5By%5D%5Basc%5D=1&action=default&presenter=Test', $this->link('this', array('sort' => array('y' => array('asc' => TRUE)))) );
+ Assert::same('/index.php?action=default&do=buy&presenter=Test', $this->link('buy!', array('var1' => $this->var1)));
+ Assert::same('/index.php?var1=20&action=default&do=buy&presenter=Test', $this->link('buy!', array('var1' => $this->var1 * 2)));
+ Assert::same('/index.php?y=2&action=default&do=buy&presenter=Test', $this->link('buy!', 1, 2));
+ Assert::same('/index.php?y=2&bool=1&str=1&action=default&do=buy&presenter=Test', $this->link('buy!', '1', '2', TRUE, TRUE));
+ Assert::same('/index.php?y=2&str=0&action=default&do=buy&presenter=Test', $this->link('buy!', '1', '2', FALSE, FALSE));
+ Assert::same('/index.php?action=default&do=buy&presenter=Test', $this->link('buy!', array(1), (object) array(1)));
+ Assert::same('/index.php?y=2&action=default&do=buy&presenter=Test', $this->link('buy!', array(1, 'y' => 2)));
+ Assert::same('/index.php?y=2&action=default&do=buy&presenter=Test', $this->link('buy!', array('x' => 1, 'y' => 2, 'var1' => $this->var1)));
+ Assert::same('#error: Signal must be non-empty string.', $this->link('!'));
+ Assert::same('/index.php?action=default&presenter=Test', $this->link('this', array('var1' => $this->var1)));
+ Assert::same('/index.php?action=default&presenter=Test', $this->link('this!', array('var1' => $this->var1)));
+ Assert::same('/index.php?sort%5By%5D%5Basc%5D=1&action=default&presenter=Test', $this->link('this', array('sort' => array('y' => array('asc' => TRUE)))));
// Presenter & signal link type checking
- Assert::same( "#error: Invalid value for parameter 'x' in method TestPresenter::handlebuy(), expected integer.", $this->link('buy!', array(array())) );
- Assert::same( "/index.php?action=default&do=buy&presenter=Test", $this->link('buy!', array(new stdClass)) );
+ Assert::same("#error: Invalid value for parameter 'x' in method TestPresenter::handlebuy(), expected integer.", $this->link('buy!', array(array())));
+ Assert::same('/index.php?action=default&do=buy&presenter=Test', $this->link('buy!', array(new stdClass)));
// Component link
- Assert::same( '#error: Signal must be non-empty string.', $this['mycontrol']->link('', 0, 1) );
- Assert::same( '/index.php?mycontrol-x=0&mycontrol-y=1&action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click', 0, 1) );
- Assert::same( '/index.php?mycontrol-x=0a&mycontrol-y=1a&action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click', '0a', '1a') );
- Assert::same( '/index.php?mycontrol-x=1&action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click', array(1), (object) array(1)) );
- Assert::same( '/index.php?mycontrol-x=1&action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click', TRUE, FALSE) );
- Assert::same( '/index.php?action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click', NULL, '') );
- Assert::same( "#error: Passed more parameters than method TestControl::handleClick() expects.", $this['mycontrol']->link('click', 1, 2, 3) );
- Assert::same( '/index.php?mycontrol-x=1&mycontrol-y=2&action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click!', array('x' => 1, 'y' => 2, 'round' => 0)) );
- Assert::same( '/index.php?mycontrol-x=1&mycontrol-round=1&action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click', array('x' => 1, 'round' => 1)) );
- Assert::same( '/index.php?mycontrol-x=1&mycontrol-round=1&action=default&presenter=Test', $this['mycontrol']->link('this', array('x' => 1, 'round' => 1)) );
- Assert::same( '/index.php?mycontrol-x=1&mycontrol-round=1&action=default&presenter=Test', $this['mycontrol']->link('this?x=1&round=1') );
- Assert::same( '/index.php?mycontrol-x=1&mycontrol-round=1&action=default&presenter=Test#frag', $this['mycontrol']->link('this?x=1&round=1#frag') );
- Assert::same( 'http://localhost/index.php?mycontrol-x=1&mycontrol-round=1&action=default&presenter=Test#frag', $this['mycontrol']->link('//this?x=1&round=1#frag') );
+ Assert::same('#error: Signal must be non-empty string.', $this['mycontrol']->link('', 0, 1));
+ Assert::same('/index.php?mycontrol-x=0&mycontrol-y=1&action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click', 0, 1));
+ Assert::same('/index.php?mycontrol-x=0a&mycontrol-y=1a&action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click', '0a', '1a'));
+ Assert::same('/index.php?mycontrol-x=1&action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click', array(1), (object) array(1)));
+ Assert::same('/index.php?mycontrol-x=1&action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click', TRUE, FALSE));
+ Assert::same('/index.php?action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click', NULL, ''));
+ Assert::same('#error: Passed more parameters than method TestControl::handleClick() expects.', $this['mycontrol']->link('click', 1, 2, 3));
+ Assert::same('/index.php?mycontrol-x=1&mycontrol-y=2&action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click!', array('x' => 1, 'y' => 2, 'round' => 0)));
+ Assert::same('/index.php?mycontrol-x=1&mycontrol-round=1&action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click', array('x' => 1, 'round' => 1)));
+ Assert::same('/index.php?mycontrol-x=1&mycontrol-round=1&action=default&presenter=Test', $this['mycontrol']->link('this', array('x' => 1, 'round' => 1)));
+ Assert::same('/index.php?mycontrol-x=1&mycontrol-round=1&action=default&presenter=Test', $this['mycontrol']->link('this?x=1&round=1'));
+ Assert::same('/index.php?mycontrol-x=1&mycontrol-round=1&action=default&presenter=Test#frag', $this['mycontrol']->link('this?x=1&round=1#frag'));
+ Assert::same('http://localhost/index.php?mycontrol-x=1&mycontrol-round=1&action=default&presenter=Test#frag', $this['mycontrol']->link('//this?x=1&round=1#frag'));
// Component link type checking
- Assert::same( "#error: Invalid value for persistent parameter 'order' in 'mycontrol', expected array.", $this['mycontrol']->link('click', array('order' => 1)) );
- Assert::same( "#error: Invalid value for persistent parameter 'round' in 'mycontrol', expected integer.", $this['mycontrol']->link('click', array('round' => array())) );
+ Assert::same("#error: Invalid value for persistent parameter 'order' in 'mycontrol', expected array.", $this['mycontrol']->link('click', array('order' => 1)));
+ Assert::same("#error: Invalid value for persistent parameter 'round' in 'mycontrol', expected integer.", $this['mycontrol']->link('click', array('round' => array())));
$this['mycontrol']->order = 1;
- Assert::same( "#error: Invalid value for persistent parameter 'order' in 'mycontrol', expected array.", $this['mycontrol']->link('click') );
+ Assert::same("#error: Invalid value for persistent parameter 'order' in 'mycontrol', expected array.", $this['mycontrol']->link('click'));
$this['mycontrol']->order = NULL;
}
diff --git a/tests/Application/Presenter.paramChecking.phpt b/tests/Application/Presenter.paramChecking.phpt
index baed26754..24e26ef4c 100644
--- a/tests/Application/Presenter.paramChecking.phpt
+++ b/tests/Application/Presenter.paramChecking.phpt
@@ -4,9 +4,9 @@
* Test: Nette\Application\UI\Presenter and checking params.
*/
-use Nette\Http,
- Nette\Application,
- Tester\Assert;
+use Nette\Http;
+use Nette\Application;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -33,66 +33,66 @@ $presenter->injectPrimary(
);
-Assert::exception(function() use ($presenter) {
+Assert::exception(function () use ($presenter) {
$request = new Application\Request('Test', Http\Request::GET, array('action' => array()));
$presenter->run($request);
}, 'Nette\Application\BadRequestException', 'Action name is not alphanumeric string.');
-Assert::exception(function() use ($presenter) {
+Assert::exception(function () use ($presenter) {
$request = new Application\Request('Test', Http\Request::GET, array('do' => array()));
$presenter->run($request);
}, 'Nette\Application\BadRequestException', 'Signal name is not string.');
-Assert::exception(function() use ($presenter) {
+Assert::exception(function () use ($presenter) {
$request = new Application\Request('Test', Http\Request::GET, array('a' => array()));
$presenter->run($request);
}, 'Nette\Application\BadRequestException', "Invalid value for parameter 'a' in method TestPresenter::actionDefault(), expected scalar.");
-Assert::exception(function() use ($presenter) {
+Assert::exception(function () use ($presenter) {
$request = new Application\Request('Test', Http\Request::GET, array('b' => array()));
$presenter->run($request);
}, 'Nette\Application\BadRequestException', "Invalid value for parameter 'b' in method TestPresenter::actionDefault(), expected scalar.");
-Assert::exception(function() use ($presenter) {
+Assert::exception(function () use ($presenter) {
$request = new Application\Request('Test', Http\Request::GET, array('c' => 1));
$presenter->run($request);
}, 'Nette\Application\BadRequestException', "Invalid value for parameter 'c' in method TestPresenter::actionDefault(), expected array.");
-Assert::exception(function() use ($presenter) {
+Assert::exception(function () use ($presenter) {
$request = new Application\Request('Test', Http\Request::GET, array('d' => 1));
$presenter->run($request);
}, 'Nette\Application\BadRequestException', "Invalid value for parameter 'd' in method TestPresenter::actionDefault(), expected array.");
-Assert::exception(function() use ($presenter) {
+Assert::exception(function () use ($presenter) {
$request = new Application\Request('Test', Http\Request::GET, array('e' => 1.1));
$presenter->run($request);
}, 'Nette\Application\BadRequestException', "Invalid value for parameter 'e' in method TestPresenter::actionDefault(), expected integer.");
-Assert::exception(function() use ($presenter) {
+Assert::exception(function () use ($presenter) {
$request = new Application\Request('Test', Http\Request::GET, array('e' => '1 '));
$presenter->run($request);
}, 'Nette\Application\BadRequestException', "Invalid value for parameter 'e' in method TestPresenter::actionDefault(), expected integer.");
-Assert::exception(function() use ($presenter) {
+Assert::exception(function () use ($presenter) {
$request = new Application\Request('Test', Http\Request::GET, array('f' => '1 '));
$presenter->run($request);
}, 'Nette\Application\BadRequestException', "Invalid value for parameter 'f' in method TestPresenter::actionDefault(), expected double.");
-Assert::exception(function() use ($presenter) {
+Assert::exception(function () use ($presenter) {
$request = new Application\Request('Test', Http\Request::GET, array('g' => ''));
$presenter->run($request);
}, 'Nette\Application\BadRequestException', "Invalid value for parameter 'g' in method TestPresenter::actionDefault(), expected boolean.");
-Assert::exception(function() use ($presenter) {
+Assert::exception(function () use ($presenter) {
$request = new Application\Request('Test', Http\Request::GET, array('bool' => array()));
$presenter->run($request);
}, 'Nette\Application\BadRequestException', "Invalid value for persistent parameter 'bool' in 'Test', expected boolean.");
diff --git a/tests/Application/Presenter.storeRequest().phpt b/tests/Application/Presenter.storeRequest().phpt
index 795db9a7f..38e1efc6b 100644
--- a/tests/Application/Presenter.storeRequest().phpt
+++ b/tests/Application/Presenter.storeRequest().phpt
@@ -4,11 +4,11 @@
* Test: Nette\Application\UI\Presenter::storeRequest()
*/
-use Nette\Http,
- Nette\Application,
- Nette\DI,
- Nette\Security,
- Tester\Assert;
+use Nette\Http;
+use Nette\Application;
+use Nette\DI;
+use Nette\Security;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -42,7 +42,7 @@ class MockSessionSection extends Nette\Object implements \ArrayAccess
public function __isset($name)
{
$this->testedKeyExistence = $name;
- return false;
+ return FALSE;
}
public function __set($name, $value)
diff --git a/tests/Application/PresenterComponent.redirect().phpt b/tests/Application/PresenterComponent.redirect().phpt
index c717ba9da..f8fbdff0a 100644
--- a/tests/Application/PresenterComponent.redirect().phpt
+++ b/tests/Application/PresenterComponent.redirect().phpt
@@ -4,9 +4,9 @@
* Test: Nette\Application\UI\PresenterComponent::redirect()
*/
-use Nette\Http,
- Nette\Application,
- Tester\Assert;
+use Nette\Http;
+use Nette\Application;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -38,7 +38,7 @@ $presenter->injectPrimary(
);
-test(function() use ($presenter) {
+test(function () use ($presenter) {
$presenter->redirect('foo');
Assert::type('Nette\Application\Responses\RedirectResponse', $presenter->response);
Assert::same(302, $presenter->response->getCode());
@@ -46,7 +46,7 @@ test(function() use ($presenter) {
});
-test(function() use ($presenter) {
+test(function () use ($presenter) {
$presenter->redirect('foo', array('arg' => 1));
Assert::type('Nette\Application\Responses\RedirectResponse', $presenter->response);
Assert::same(302, $presenter->response->getCode());
@@ -54,7 +54,7 @@ test(function() use ($presenter) {
});
-test(function() use ($presenter) {
+test(function () use ($presenter) {
$presenter->redirect('foo', 2);
Assert::type('Nette\Application\Responses\RedirectResponse', $presenter->response);
Assert::same(302, $presenter->response->getCode());
@@ -62,7 +62,7 @@ test(function() use ($presenter) {
});
-test(function() use ($presenter) {
+test(function () use ($presenter) {
$presenter->redirect(301, 'foo', array('arg' => 1));
Assert::type('Nette\Application\Responses\RedirectResponse', $presenter->response);
Assert::same(301, $presenter->response->getCode());
@@ -70,7 +70,7 @@ test(function() use ($presenter) {
});
-test(function() use ($presenter) {
+test(function () use ($presenter) {
$presenter->redirect(301, 'foo', 2);
Assert::type('Nette\Application\Responses\RedirectResponse', $presenter->response);
Assert::same(301, $presenter->response->getCode());
diff --git a/tests/Application/PresenterFactory.formatPresenterClass.phpt b/tests/Application/PresenterFactory.formatPresenterClass.phpt
index a5fb1dc2c..89630db67 100644
--- a/tests/Application/PresenterFactory.formatPresenterClass.phpt
+++ b/tests/Application/PresenterFactory.formatPresenterClass.phpt
@@ -4,14 +4,14 @@
* Test: Nette\Application\PresenterFactory.
*/
-use Nette\Application\PresenterFactory,
- Tester\Assert;
+use Nette\Application\PresenterFactory;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
-test(function() {
+test(function () {
$factory = new PresenterFactory(NULL, new Nette\DI\Container);
$factory->setMapping(array(
@@ -19,22 +19,22 @@ test(function() {
'Foo3' => 'My\App\*Mod\*Presenter',
));
- Assert::same( 'FooPresenter', $factory->formatPresenterClass('Foo') );
- Assert::same( 'FooModule\BarPresenter', $factory->formatPresenterClass('Foo:Bar') );
- Assert::same( 'FooModule\BarModule\BazPresenter', $factory->formatPresenterClass('Foo:Bar:Baz') );
+ Assert::same('FooPresenter', $factory->formatPresenterClass('Foo'));
+ Assert::same('FooModule\BarPresenter', $factory->formatPresenterClass('Foo:Bar'));
+ Assert::same('FooModule\BarModule\BazPresenter', $factory->formatPresenterClass('Foo:Bar:Baz'));
- Assert::same( 'Foo2Presenter', $factory->formatPresenterClass('Foo2') );
- Assert::same( 'App2\BarPresenter', $factory->formatPresenterClass('Foo2:Bar') );
- Assert::same( 'App2\Bar\BazPresenter', $factory->formatPresenterClass('Foo2:Bar:Baz') );
+ Assert::same('Foo2Presenter', $factory->formatPresenterClass('Foo2'));
+ Assert::same('App2\BarPresenter', $factory->formatPresenterClass('Foo2:Bar'));
+ Assert::same('App2\Bar\BazPresenter', $factory->formatPresenterClass('Foo2:Bar:Baz'));
- Assert::same( 'My\App\BarPresenter', $factory->formatPresenterClass('Foo3:Bar') );
- Assert::same( 'My\App\BarMod\BazPresenter', $factory->formatPresenterClass('Foo3:Bar:Baz') );
+ Assert::same('My\App\BarPresenter', $factory->formatPresenterClass('Foo3:Bar'));
+ Assert::same('My\App\BarMod\BazPresenter', $factory->formatPresenterClass('Foo3:Bar:Baz'));
- Assert::same( 'NetteModule\FooPresenter', $factory->formatPresenterClass('Nette:Foo') );
+ Assert::same('NetteModule\FooPresenter', $factory->formatPresenterClass('Nette:Foo'));
});
-test(function() {
+test(function () {
$factory = new PresenterFactory(NULL, new Nette\DI\Container);
$factory->setMapping(array(
@@ -42,10 +42,10 @@ test(function() {
'Foo3' => 'My\App\*Presenter',
));
- Assert::same( 'Foo2Presenter', $factory->formatPresenterClass('Foo2') );
- Assert::same( 'App2\BarPresenter', $factory->formatPresenterClass('Foo2:Bar') );
- Assert::same( 'App2\BarModule\BazPresenter', $factory->formatPresenterClass('Foo2:Bar:Baz') );
+ Assert::same('Foo2Presenter', $factory->formatPresenterClass('Foo2'));
+ Assert::same('App2\BarPresenter', $factory->formatPresenterClass('Foo2:Bar'));
+ Assert::same('App2\BarModule\BazPresenter', $factory->formatPresenterClass('Foo2:Bar:Baz'));
- Assert::same( 'My\App\BarPresenter', $factory->formatPresenterClass('Foo3:Bar') );
- Assert::same( 'My\App\BarModule\BazPresenter', $factory->formatPresenterClass('Foo3:Bar:Baz') );
+ Assert::same('My\App\BarPresenter', $factory->formatPresenterClass('Foo3:Bar'));
+ Assert::same('My\App\BarModule\BazPresenter', $factory->formatPresenterClass('Foo3:Bar:Baz'));
});
diff --git a/tests/Application/PresenterFactory.formatPresenterFile.phpt b/tests/Application/PresenterFactory.formatPresenterFile.phpt
index ecbbded37..d2203e0d8 100644
--- a/tests/Application/PresenterFactory.formatPresenterFile.phpt
+++ b/tests/Application/PresenterFactory.formatPresenterFile.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\PresenterFactory.
*/
-use Nette\Application\PresenterFactory,
- Tester\Assert;
+use Nette\Application\PresenterFactory;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -13,27 +13,27 @@ require __DIR__ . '/../bootstrap.php';
$factory = new PresenterFactory('base', new Nette\DI\Container);
-test(function() use ($factory) {
+test(function () use ($factory) {
$factory->setMapping(array(
'Foo2' => 'App2\*\*Presenter',
));
- Assert::same( 'base/presenters/FooPresenter.php', $factory->formatPresenterFile('Foo') );
- Assert::same( 'base/FooModule/presenters/BarPresenter.php', $factory->formatPresenterFile('Foo:Bar') );
- Assert::same( 'base/FooModule/BarModule/presenters/BazPresenter.php', $factory->formatPresenterFile('Foo:Bar:Baz') );
+ Assert::same('base/presenters/FooPresenter.php', $factory->formatPresenterFile('Foo'));
+ Assert::same('base/FooModule/presenters/BarPresenter.php', $factory->formatPresenterFile('Foo:Bar'));
+ Assert::same('base/FooModule/BarModule/presenters/BazPresenter.php', $factory->formatPresenterFile('Foo:Bar:Baz'));
- Assert::same( 'base/presenters/Foo2Presenter.php', $factory->formatPresenterFile('Foo2') );
- Assert::same( 'base/Foo2Module/presenters/BarPresenter.php', $factory->formatPresenterFile('Foo2:Bar') );
- Assert::same( 'base/Foo2Module/BarModule/presenters/BazPresenter.php', $factory->formatPresenterFile('Foo2:Bar:Baz') );
+ Assert::same('base/presenters/Foo2Presenter.php', $factory->formatPresenterFile('Foo2'));
+ Assert::same('base/Foo2Module/presenters/BarPresenter.php', $factory->formatPresenterFile('Foo2:Bar'));
+ Assert::same('base/Foo2Module/BarModule/presenters/BazPresenter.php', $factory->formatPresenterFile('Foo2:Bar:Baz'));
});
-test(function() use ($factory) {
+test(function () use ($factory) {
$factory->setMapping(array(
'Foo2' => 'App2\*Presenter',
));
- Assert::same( 'base/presenters/Foo2Presenter.php', $factory->formatPresenterFile('Foo2') );
- Assert::same( 'base/Foo2Module/presenters/BarPresenter.php', $factory->formatPresenterFile('Foo2:Bar') );
- Assert::same( 'base/Foo2Module/BarModule/presenters/BazPresenter.php', $factory->formatPresenterFile('Foo2:Bar:Baz') );
+ Assert::same('base/presenters/Foo2Presenter.php', $factory->formatPresenterFile('Foo2'));
+ Assert::same('base/Foo2Module/presenters/BarPresenter.php', $factory->formatPresenterFile('Foo2:Bar'));
+ Assert::same('base/Foo2Module/BarModule/presenters/BazPresenter.php', $factory->formatPresenterFile('Foo2:Bar:Baz'));
});
diff --git a/tests/Application/PresenterFactory.unformatPresenterClass.phpt b/tests/Application/PresenterFactory.unformatPresenterClass.phpt
index a985821f9..e87114d41 100644
--- a/tests/Application/PresenterFactory.unformatPresenterClass.phpt
+++ b/tests/Application/PresenterFactory.unformatPresenterClass.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Application\PresenterFactory.
*/
-use Nette\Application\PresenterFactory,
- Tester\Assert;
+use Nette\Application\PresenterFactory;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -13,41 +13,41 @@ require __DIR__ . '/../bootstrap.php';
$factory = new PresenterFactory(NULL, new Nette\DI\Container);
-test(function() use ($factory) {
+test(function () use ($factory) {
$factory->setMapping(array(
'Foo2' => 'App2\*\*Presenter',
'Foo3' => 'My\App\*Mod\*Presenter',
));
- Assert::same( 'Foo', $factory->unformatPresenterClass('FooPresenter') );
- Assert::same( 'Foo:Bar', $factory->unformatPresenterClass('FooModule\BarPresenter') );
- Assert::same( 'Foo:Bar:Baz', $factory->unformatPresenterClass('FooModule\BarModule\BazPresenter') );
+ Assert::same('Foo', $factory->unformatPresenterClass('FooPresenter'));
+ Assert::same('Foo:Bar', $factory->unformatPresenterClass('FooModule\BarPresenter'));
+ Assert::same('Foo:Bar:Baz', $factory->unformatPresenterClass('FooModule\BarModule\BazPresenter'));
- Assert::same( 'Foo2', $factory->unformatPresenterClass('Foo2Presenter') );
- Assert::same( 'Foo2:Bar', $factory->unformatPresenterClass('App2\BarPresenter') );
- Assert::same( 'Foo2:Bar:Baz', $factory->unformatPresenterClass('App2\Bar\BazPresenter') );
+ Assert::same('Foo2', $factory->unformatPresenterClass('Foo2Presenter'));
+ Assert::same('Foo2:Bar', $factory->unformatPresenterClass('App2\BarPresenter'));
+ Assert::same('Foo2:Bar:Baz', $factory->unformatPresenterClass('App2\Bar\BazPresenter'));
- Assert::same( 'Foo3:Bar', $factory->unformatPresenterClass('My\App\BarPresenter') );
- Assert::same( 'Foo3:Bar:Baz', $factory->unformatPresenterClass('My\App\BarMod\BazPresenter') );
+ Assert::same('Foo3:Bar', $factory->unformatPresenterClass('My\App\BarPresenter'));
+ Assert::same('Foo3:Bar:Baz', $factory->unformatPresenterClass('My\App\BarMod\BazPresenter'));
- Assert::null( $factory->unformatPresenterClass('Foo') );
- Assert::null( $factory->unformatPresenterClass('FooMod\BarPresenter') );
+ Assert::null($factory->unformatPresenterClass('Foo'));
+ Assert::null($factory->unformatPresenterClass('FooMod\BarPresenter'));
});
-test(function() use ($factory) {
+test(function () use ($factory) {
$factory->setMapping(array(
'Foo2' => 'App2\*Presenter',
'Foo3' => 'My\App\*Presenter',
));
- Assert::same( 'Foo2', $factory->unformatPresenterClass('Foo2Presenter') );
- Assert::same( 'Foo2:Bar', $factory->unformatPresenterClass('App2\BarPresenter') );
- Assert::same( 'Foo2:Bar:Baz', $factory->unformatPresenterClass('App2\BarModule\BazPresenter') );
+ Assert::same('Foo2', $factory->unformatPresenterClass('Foo2Presenter'));
+ Assert::same('Foo2:Bar', $factory->unformatPresenterClass('App2\BarPresenter'));
+ Assert::same('Foo2:Bar:Baz', $factory->unformatPresenterClass('App2\BarModule\BazPresenter'));
- Assert::same( 'Foo3:Bar', $factory->unformatPresenterClass('My\App\BarPresenter') );
- Assert::same( 'Foo3:Bar:Baz', $factory->unformatPresenterClass('My\App\BarModule\BazPresenter') );
+ Assert::same('Foo3:Bar', $factory->unformatPresenterClass('My\App\BarPresenter'));
+ Assert::same('Foo3:Bar:Baz', $factory->unformatPresenterClass('My\App\BarModule\BazPresenter'));
- Assert::null( $factory->unformatPresenterClass('App2\Bar\BazPresenter') );
- Assert::null( $factory->unformatPresenterClass('My\App\BarMod\BazPresenter') );
+ Assert::null($factory->unformatPresenterClass('App2\Bar\BazPresenter'));
+ Assert::null($factory->unformatPresenterClass('My\App\BarMod\BazPresenter'));
});