Created
September 5, 2012 05:16
-
-
Save haruta/3630938 to your computer and use it in GitHub Desktop.
assert input field and value by symfony2 unit test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected function assertInuptValue($crawler, $key, $val) | |
{ | |
$input = $crawler->filter('input[name="'.$key.'"]'); | |
$this->assertEquals( | |
$val, $input->attr('value'), $key.' failed' | |
); | |
} | |
protected function assertSelectValue($crawler, $key, $val) | |
{ | |
$input = $crawler->filter('select[name="'.$key.'"]'); | |
$selected_option = $input->filter('option[selected="selected"]'); | |
$this->assertEquals($val, $selected_option->attr('value'), $key.' failed'); | |
} | |
protected function assertTextAreaValue($crawler, $key, $val) | |
{ | |
$input = $crawler->filter('textarea[name="'.$key.'"]'); | |
$this->assertEquals( | |
$val, $input->text(), $key.' failed' | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment