1 | <?php |
||
13 | class PartialUserFormControllerTest extends FunctionalTest |
||
14 | { |
||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | protected static $fixture_file = '../fixtures/partialformtest.yml'; |
||
19 | |||
20 | public function testPartialPage() |
||
21 | { |
||
22 | $result = $this->get("partial"); |
||
23 | $this->assertEquals(404, $result->getStatusCode()); |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @todo |
||
28 | */ |
||
29 | public function testPartialValidKeyToken() |
||
30 | { |
||
31 | $this->markTestSkipped('Revisit and set up themes for testing'); |
||
32 | |||
33 | $token = 'q1w2e3r4t5y6u7i8'; |
||
34 | // No Parent |
||
35 | $key = singleton(PartialFormSubmission::class)->generateKey($token); |
||
36 | $result = $this->get("partial/{$key}/{$token}"); |
||
37 | $this->assertEquals(404, $result->getStatusCode()); |
||
38 | |||
39 | // Partial with UserDefinedForm |
||
40 | $key = $this->objFromFixture(PartialFormSubmission::class, 'submission1')->generateKey($token); |
||
41 | $result = $this->get("partial/{$key}/{$token}"); |
||
42 | $this->assertEquals(200, $result->getStatusCode()); |
||
43 | $this->assertContains('Field 1', $result->getBody()); |
||
44 | } |
||
45 | |||
46 | public function testPartialInvalidToken() |
||
47 | { |
||
48 | $token = 'abcdef'; |
||
49 | $key = singleton(PartialFormSubmission::class)->generateKey($token); |
||
50 | |||
51 | $result = $this->get("partial/{$key}/{$token}"); |
||
52 | $this->assertEquals(404, $result->getStatusCode()); |
||
53 | } |
||
54 | |||
55 | public function testPartialInvalidKey() |
||
56 | { |
||
57 | $token = 'e6b27462211e1711'; |
||
58 | $key = 'abcdef'; |
||
59 | |||
60 | $result = $this->get("partial/{$key}/{$token}"); |
||
61 | $this->assertEquals(404, $result->getStatusCode()); |
||
62 | |||
63 | $token = 'qwerty'; |
||
64 | $key = 'abcdef'; |
||
65 | |||
66 | $result = $this->get("partial/{$key}/{$token}"); |
||
67 | $this->assertEquals(404, $result->getStatusCode()); |
||
68 | } |
||
69 | |||
70 | public function setUp() |
||
71 | { |
||
72 | parent::setUp(); |
||
73 | $this->objFromFixture(UserDefinedForm::class, 'form1')->publishRecursive(); |
||
74 | } |
||
75 | } |
||
76 |