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