2
2
3
3
namespace Uniform \Tests ;
4
4
5
- use Uniform \ Form ;
5
+ use Jevets \ Kirby \ Exceptions \ TokenMismatchException ;
6
6
use Jevets \Kirby \Flash ;
7
- use Uniform \ Guards \ Guard ;
7
+ use Kirby \ Cms \ App ;
8
8
use Uniform \Actions \Action ;
9
9
use Uniform \Exceptions \Exception ;
10
- use Mzur \ Kirby \ DefuseSession \ Defuse ;
11
- use Jevets \ Kirby \ Exceptions \ TokenMismatchException ;
10
+ use Uniform \ Form ;
11
+ use Uniform \ Guards \ Guard ;
12
12
13
13
class FormTest extends TestCase
14
14
{
@@ -17,20 +17,19 @@ class FormTest extends TestCase
17
17
public function setUp (): void
18
18
{
19
19
parent ::setUp ();
20
- Defuse::defuse (['options ' => ['debug ' => true ]]);
21
20
$ this ->form = new FormStub ;
22
21
}
23
22
24
- public function testValidateCsrfException ()
23
+ public function testValidateCsrfExceptionDebug ()
25
24
{
25
+ App::instance ()->extend (['options ' => ['debug ' => true ]]);
26
26
csrf (); // Generate a token.
27
27
$ this ->expectException (TokenMismatchException::class);
28
28
$ this ->form ->validate ();
29
29
}
30
30
31
31
public function testValidateCsrfExceptionNoDebug ()
32
32
{
33
- Defuse::defuse (['options ' => ['debug ' => false ]]);
34
33
csrf (); // Generate a token.
35
34
36
35
try {
@@ -66,6 +65,7 @@ public function testValidateRedirect()
66
65
67
66
public function testGuardValidates ()
68
67
{
68
+ App::instance ()->extend (['options ' => ['debug ' => true ]]);
69
69
$ this ->expectException (TokenMismatchException::class);
70
70
$ this ->form ->guard ();
71
71
}
@@ -131,12 +131,14 @@ public function testGuardMagicMethod()
131
131
132
132
public function testActionValidates ()
133
133
{
134
+ App::instance ()->extend (['options ' => ['debug ' => true ]]);
134
135
$ this ->expectException (TokenMismatchException::class);
135
136
$ this ->form ->action (Action::class);
136
137
}
137
138
138
139
public function testActionValidatesWithoutGuards ()
139
140
{
141
+ App::instance ()->extend (['options ' => ['debug ' => true ]]);
140
142
$ this ->expectException (TokenMismatchException::class);
141
143
$ this ->form ->withoutGuards ()->action (Action::class);
142
144
}
0 commit comments