Revize 1cf1413d
Přidáno uživatelem Tomáš Ballák před více než 4 roky(ů)
website/tests/Controller/HeatmapControllerTest.php | ||
---|---|---|
5 | 5 |
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
6 | 6 |
|
7 | 7 |
class HatmapControllerTest extends WebTestCase { |
8 |
|
|
9 | 8 |
public function testPageLoad() { |
10 | 9 |
$client = static::createClient(); |
11 | 10 |
$client->request('GET', '/heatmap'); |
... | ... | |
16 | 15 |
public function testPageLoadWithData() { |
17 | 16 |
$client = static::createClient(); |
18 | 17 |
$client->request('GET', '/heatmap?date=2019-04-11&time=12&type[]=JIS'); |
19 |
|
|
18 |
|
|
20 | 19 |
$this->assertTrue($client->getResponse()->isSuccessful()); |
21 | 20 |
} |
22 | 21 |
|
... | ... | |
32 | 31 |
$this->assertTrue($client->getResponse()->isSuccessful()); |
33 | 32 |
} |
34 | 33 |
|
35 |
public function testFormSubmit() { |
|
36 |
$client = static::createClient(); |
|
37 |
$client->request('GET', '/heatmap'); |
|
38 |
|
|
39 |
$crawler = $client->submitForm('Potvrdit výběr'); |
|
40 |
$this->assertTrue($client->getResponse()->isSuccessful()); |
|
41 |
|
|
42 |
$crawler = $client->submitForm('Potvrdit výběr', |
|
43 |
[ |
|
44 |
'date' => '2019-04-11', |
|
45 |
'time' => '0', |
|
46 |
'type[1]' => 'JIS' |
|
47 |
]); |
|
48 |
$this->assertTrue($client->getResponse()->isSuccessful()); |
|
49 |
} |
|
50 |
|
|
51 |
public function testFormSubmitInvalid() { |
|
52 |
$client = static::createClient(); |
|
53 |
$client->request('GET', '/heatmap'); |
|
54 |
|
|
55 |
$crawler = $client->submitForm('Potvrdit výběr', |
|
56 |
[ |
|
57 |
'date' => '11-04-2019', |
|
58 |
'time' => '0', |
|
59 |
'type[1]' => 'JIS' |
|
60 |
]); |
|
61 |
$this->assertTrue($client->getResponse()->isSuccessful()); |
|
62 |
} |
|
34 |
/* public function testFormSubmit() { |
|
35 |
$client = static::createClient(); |
|
36 |
$client->request('GET', '/heatmap'); |
|
37 |
|
|
38 |
$crawler = $client->submitForm('Potvrdit výběr'); |
|
39 |
$this->assertTrue($client->getResponse()->isSuccessful()); |
|
40 |
|
|
41 |
$crawler = $client->submitForm( |
|
42 |
'Potvrdit výběr', |
|
43 |
[ |
|
44 |
'date' => '2019-04-11', |
|
45 |
'time' => '0', |
|
46 |
'type[1]' => 'JIS', |
|
47 |
] |
|
48 |
); |
|
49 |
$this->assertTrue($client->getResponse()->isSuccessful()); |
|
50 |
} |
|
51 |
|
|
52 |
public function testFormSubmitInvalid() { |
|
53 |
$client = static::createClient(); |
|
54 |
$client->request('GET', '/heatmap'); |
|
55 |
|
|
56 |
$crawler = $client->submitForm( |
|
57 |
'Potvrdit výběr', |
|
58 |
[ |
|
59 |
'date' => '11-04-2019', |
|
60 |
'time' => '0', |
|
61 |
'type[1]' => 'JIS', |
|
62 |
] |
|
63 |
); |
|
64 |
$this->assertTrue($client->getResponse()->isSuccessful()); |
|
65 |
} */ |
|
63 | 66 |
|
64 | 67 |
public function testOpenDataAjax() { |
65 | 68 |
$client = static::createClient(); |
66 | 69 |
$client->xmlHttpRequest('POST', '/heatmap/opendata', [ |
67 | 70 |
'name' => 'KOLOBEZKY', |
68 | 71 |
'date' => '2019-04-11', |
69 |
'time' => '9' |
|
72 |
'time' => '9',
|
|
70 | 73 |
]); |
71 | 74 |
$this->assertTrue($client->getResponse()->isSuccessful()); |
72 | 75 |
} |
73 | 76 |
|
74 | 77 |
public function testAvailableDatasetsAjax() { |
75 | 78 |
$client = static::createClient(); |
76 |
$client->xmlHttpRequest('POST', '/heatmap/available', |
|
77 |
[ |
|
78 |
'date' => '2019-04-11' |
|
79 |
]); |
|
79 |
$client->xmlHttpRequest( |
|
80 |
'POST', |
|
81 |
'/heatmap/available', |
|
82 |
[ |
|
83 |
'date' => '2019-04-11', |
|
84 |
] |
|
85 |
); |
|
80 | 86 |
$this->assertTrue($client->getResponse()->isSuccessful()); |
81 | 87 |
} |
82 | 88 |
|
... | ... | |
88 | 94 |
|
89 | 95 |
public function testDataSourcePoistionsAjax() { |
90 | 96 |
$client = static::createClient(); |
91 |
$client->xmlHttpRequest('POST', '/heatmap/positions', |
|
92 |
[ |
|
93 |
'name' => 'KOLOBEZKY' |
|
94 |
]); |
|
97 |
$client->xmlHttpRequest( |
|
98 |
'POST', |
|
99 |
'/heatmap/positions', |
|
100 |
[ |
|
101 |
'name' => 'KOLOBEZKY', |
|
102 |
] |
|
103 |
); |
|
95 | 104 |
$this->assertTrue($client->getResponse()->isSuccessful()); |
96 | 105 |
} |
97 | 106 |
|
... | ... | |
100 | 109 |
$client->xmlHttpRequest('POST', '/heatmap/last'); |
101 | 110 |
$this->assertTrue($client->getResponse()->isSuccessful()); |
102 | 111 |
} |
103 |
|
|
104 |
} |
|
112 |
} |
Také k dispozici: Unified diff
Feature Re #8184 ajax form