Skip to content

Commit 4aedb23

Browse files
committed
tests: class moved to fixtures (doesn't suit CS)
1 parent faf0917 commit 4aedb23

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

tests/UI/Presenter.paramChecking.phpt

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,10 @@ use Tester\Assert;
1212

1313

1414
require __DIR__ . '/../bootstrap.php';
15+
require __DIR__ . '/fixtures/ParamPresenter.php';
1516

1617

17-
class TestPresenter extends Application\UI\Presenter
18-
{
19-
/** @persistent */
20-
public $bool = true;
21-
22-
23-
public function actionDefault($a, $b = null, array $c, array $d = null, $e = 1, $f = 1.0, $g = false)
24-
{
25-
}
26-
}
27-
28-
29-
$presenter = new TestPresenter;
18+
$presenter = new ParamPresenter;
3019
$presenter->injectPrimary(
3120
null,
3221
null,
@@ -51,49 +40,49 @@ Assert::exception(function () use ($presenter) {
5140
Assert::exception(function () use ($presenter) {
5241
$request = new Application\Request('Test', Http\Request::GET, ['a' => []]);
5342
$presenter->run($request);
54-
}, Nette\Application\BadRequestException::class, 'Argument $a passed to TestPresenter::actionDefault() must be scalar, array given.');
43+
}, Nette\Application\BadRequestException::class, 'Argument $a passed to ParamPresenter::actionDefault() must be scalar, array given.');
5544

5645

5746
Assert::exception(function () use ($presenter) {
5847
$request = new Application\Request('Test', Http\Request::GET, ['b' => []]);
5948
$presenter->run($request);
60-
}, Nette\Application\BadRequestException::class, 'Argument $b passed to TestPresenter::actionDefault() must be scalar, array given.');
49+
}, Nette\Application\BadRequestException::class, 'Argument $b passed to ParamPresenter::actionDefault() must be scalar, array given.');
6150

6251

6352
Assert::exception(function () use ($presenter) {
6453
$request = new Application\Request('Test', Http\Request::GET, ['c' => 1]);
6554
$presenter->run($request);
66-
}, Nette\Application\BadRequestException::class, 'Argument $c passed to TestPresenter::actionDefault() must be array, integer given.');
55+
}, Nette\Application\BadRequestException::class, 'Argument $c passed to ParamPresenter::actionDefault() must be array, integer given.');
6756

6857

6958
Assert::exception(function () use ($presenter) {
7059
$request = new Application\Request('Test', Http\Request::GET, ['d' => 1]);
7160
$presenter->run($request);
72-
}, Nette\Application\BadRequestException::class, 'Argument $d passed to TestPresenter::actionDefault() must be array, integer given.');
61+
}, Nette\Application\BadRequestException::class, 'Argument $d passed to ParamPresenter::actionDefault() must be array, integer given.');
7362

7463

7564
Assert::exception(function () use ($presenter) {
7665
$request = new Application\Request('Test', Http\Request::GET, ['e' => 1.1]);
7766
$presenter->run($request);
78-
}, Nette\Application\BadRequestException::class, 'Argument $e passed to TestPresenter::actionDefault() must be integer, double given.');
67+
}, Nette\Application\BadRequestException::class, 'Argument $e passed to ParamPresenter::actionDefault() must be integer, double given.');
7968

8069

8170
Assert::exception(function () use ($presenter) {
8271
$request = new Application\Request('Test', Http\Request::GET, ['e' => '1 ']);
8372
$presenter->run($request);
84-
}, Nette\Application\BadRequestException::class, 'Argument $e passed to TestPresenter::actionDefault() must be integer, string given.');
73+
}, Nette\Application\BadRequestException::class, 'Argument $e passed to ParamPresenter::actionDefault() must be integer, string given.');
8574

8675

8776
Assert::exception(function () use ($presenter) {
8877
$request = new Application\Request('Test', Http\Request::GET, ['f' => '1 ']);
8978
$presenter->run($request);
90-
}, Nette\Application\BadRequestException::class, 'Argument $f passed to TestPresenter::actionDefault() must be double, string given.');
79+
}, Nette\Application\BadRequestException::class, 'Argument $f passed to ParamPresenter::actionDefault() must be double, string given.');
9180

9281

9382
Assert::exception(function () use ($presenter) {
9483
$request = new Application\Request('Test', Http\Request::GET, ['g' => '']);
9584
$presenter->run($request);
96-
}, Nette\Application\BadRequestException::class, 'Argument $g passed to TestPresenter::actionDefault() must be boolean, string given.');
85+
}, Nette\Application\BadRequestException::class, 'Argument $g passed to ParamPresenter::actionDefault() must be boolean, string given.');
9786

9887
Assert::exception(function () use ($presenter) {
9988
$request = new Application\Request('Test', Http\Request::GET, ['bool' => []]);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
class ParamPresenter extends Nette\Application\UI\Presenter
5+
{
6+
/** @persistent */
7+
public $bool = true;
8+
9+
10+
public function actionDefault($a, $b = null, array $c, array $d = null, $e = 1, $f = 1.0, $g = false)
11+
{
12+
}
13+
}

0 commit comments

Comments
 (0)