1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-21 00:02:18 +02:00

[ticket/12983] Do not test invalid values until Symfony 2.4

PHPBB3-12983
This commit is contained in:
Joas Schilling 2014-09-06 17:16:56 +02:00
parent 647a75249c
commit d5801333f7

View File

@ -16,7 +16,7 @@
*/
class phpbb_functional_ucp_preferences_test extends phpbb_functional_test_case
{
public function test_submitting_profile_info()
public function test_submitting_preferences_view()
{
$this->add_lang('ucp');
$this->login();
@ -35,26 +35,44 @@ class phpbb_functional_ucp_preferences_test extends phpbb_functional_test_case
$crawler = self::submit($form);
$this->assertContainsLang('PREFERENCES_UPDATED', $crawler->filter('#message')->text());
}
public function test_submitting_invalid_preferences_view()
{
$this->add_lang('ucp');
$this->login();
$crawler = self::request('GET', 'ucp.php?i=ucp_prefs&mode=view');
$this->assertContainsLang('UCP_PREFS_VIEW', $crawler->filter('#cp-main h2')->text());
$form = $crawler->selectButton('Submit')->form();
$form = $crawler->selectButton('Submit')->form(array(
'topic_sk' => 'z',
'topic_sd' => 'z',
'topic_st' => 'test',
'post_sk' => 'z',
'post_sd' => 'z',
'post_st' => 'test',
));
if (!method_exists($form, 'disableValidation'))
{
$this->markTestIncomplete('The crawler cannot select invalid values, until Symfony 2.4!');
}
$form = $form->disableValidation();
$form['topic_sk']->select('z');
$form['topic_sd']->select('z');
$form['topic_st']->select('test');
$form['post_sk']->select('z');
$form['post_sd']->select('z');
$form['post_st']->select('test');
$crawler = self::submit($form);
$this->assertContainsLang('WRONG_DATA_POST_SD', $crawler->filter('#cp-main')->text());
$this->assertContainsLang('WRONG_DATA_POST_SK', $crawler->filter('#cp-main')->text());
$this->assertContainsLang('WRONG_DATA_TOPIC_SD', $crawler->filter('#cp-main')->text());
$this->assertContainsLang('WRONG_DATA_TOPIC_SK', $crawler->filter('#cp-main')->text());
}
public function test_read_preferences_view()
{
$this->add_lang('ucp');
$this->login();
$crawler = self::request('GET', 'ucp.php?i=ucp_prefs&mode=view');
$this->assertContainsLang('UCP_PREFS_VIEW', $crawler->filter('#cp-main h2')->text());
$form = $crawler->selectButton('Submit')->form();
$this->assertEquals('a', $form->get('topic_sk')->getValue());