| 48 | | isStatusCode(200)-> |
|---|
| 49 | | isRequestParameter('module', $this->urlPrefix)-> |
|---|
| 50 | | isRequestParameter('action', 'index')-> |
|---|
| 51 | | |
|---|
| 52 | | checkResponseElement('h1', ucfirst($this->urlPrefix).' List')-> |
|---|
| 53 | | |
|---|
| 54 | | checkResponseElement('table thead tr th:nth(0)', 'Id')-> |
|---|
| 55 | | checkResponseElement('table thead tr th:nth(1)', 'Title')-> |
|---|
| 56 | | checkResponseElement('table thead tr th:nth(2)', 'Body')-> |
|---|
| 57 | | checkResponseElement('table thead tr th:nth(3)', 'Online')-> |
|---|
| 58 | | checkResponseElement('table thead tr th:nth(4)', 'Excerpt')-> |
|---|
| 59 | | checkResponseElement('table thead tr th:nth(5)', 'Category')-> |
|---|
| 60 | | checkResponseElement('table thead tr th:nth(6)', 'Created at')-> |
|---|
| 61 | | checkResponseElement('table thead tr th:nth(7)', 'End date')-> |
|---|
| 62 | | checkResponseElement('table thead tr th:nth(8)', 'Book')-> |
|---|
| 63 | | |
|---|
| 64 | | checkResponseElement('table tbody tr td:nth(0)', '1')-> |
|---|
| 65 | | checkResponseElement('table tbody tr td:nth(1)', 'foo title')-> |
|---|
| 66 | | checkResponseElement('table tbody tr td:nth(2)', 'bar body')-> |
|---|
| 67 | | checkResponseElement('table tbody tr td:nth(3)', '1')-> |
|---|
| 68 | | checkResponseElement('table tbody tr td:nth(4)', 'foo excerpt')-> |
|---|
| 69 | | checkResponseElement('table tbody tr td:nth(5)', '1')-> |
|---|
| 70 | | checkResponseElement('table tbody tr td:nth(6)', '/^\d{4}\-\d{2}\-\d{2} \d{2}\:\d{2}\:\d{2}$/')-> |
|---|
| 71 | | checkResponseElement('table tbody tr td:nth(7)', '')-> |
|---|
| 72 | | checkResponseElement('table tbody tr td:nth(8)', '')-> |
|---|
| 73 | | checkResponseElement(sprintf('a[href*="/%s/new"]', $this->urlPrefix))-> |
|---|
| 74 | | checkResponseElement(sprintf('tbody a[href*="/%s/1%s"]', $this->urlPrefix, in_array('with-show', $options) ? '' : '/edit'))-> |
|---|
| 75 | | checkResponseElement(sprintf('tbody a[href*="/%s/2%s"]', $this->urlPrefix, in_array('with-show', $options) ? '' : '/edit')) |
|---|
| | 49 | with('request')->begin()-> |
|---|
| | 50 | isParameter('module', $this->urlPrefix)-> |
|---|
| | 51 | isParameter('action', 'index')-> |
|---|
| | 52 | end()-> |
|---|
| | 53 | with('response')->begin()-> |
|---|
| | 54 | isStatusCode(200)-> |
|---|
| | 55 | |
|---|
| | 56 | checkElement('h1', ucfirst($this->urlPrefix).' List')-> |
|---|
| | 57 | |
|---|
| | 58 | checkElement('table thead tr th:nth(0)', 'Id')-> |
|---|
| | 59 | checkElement('table thead tr th:nth(1)', 'Title')-> |
|---|
| | 60 | checkElement('table thead tr th:nth(2)', 'Body')-> |
|---|
| | 61 | checkElement('table thead tr th:nth(3)', 'Online')-> |
|---|
| | 62 | checkElement('table thead tr th:nth(4)', 'Excerpt')-> |
|---|
| | 63 | checkElement('table thead tr th:nth(5)', 'Category')-> |
|---|
| | 64 | checkElement('table thead tr th:nth(6)', 'Created at')-> |
|---|
| | 65 | checkElement('table thead tr th:nth(7)', 'End date')-> |
|---|
| | 66 | checkElement('table thead tr th:nth(8)', 'Book')-> |
|---|
| | 67 | |
|---|
| | 68 | checkElement('table tbody tr td:nth(0)', '1')-> |
|---|
| | 69 | checkElement('table tbody tr td:nth(1)', 'foo title')-> |
|---|
| | 70 | checkElement('table tbody tr td:nth(2)', 'bar body')-> |
|---|
| | 71 | checkElement('table tbody tr td:nth(3)', '1')-> |
|---|
| | 72 | checkElement('table tbody tr td:nth(4)', 'foo excerpt')-> |
|---|
| | 73 | checkElement('table tbody tr td:nth(5)', '1')-> |
|---|
| | 74 | checkElement('table tbody tr td:nth(6)', '/^\d{4}\-\d{2}\-\d{2} \d{2}\:\d{2}\:\d{2}$/')-> |
|---|
| | 75 | checkElement('table tbody tr td:nth(7)', '')-> |
|---|
| | 76 | checkElement('table tbody tr td:nth(8)', '')-> |
|---|
| | 77 | checkElement(sprintf('a[href*="/%s/new"]', $this->urlPrefix))-> |
|---|
| | 78 | checkElement(sprintf('tbody a[href*="/%s/1%s"]', $this->urlPrefix, in_array('with-show', $options) ? '' : '/edit'))-> |
|---|
| | 79 | checkElement(sprintf('tbody a[href*="/%s/2%s"]', $this->urlPrefix, in_array('with-show', $options) ? '' : '/edit'))-> |
|---|
| | 80 | end() |
|---|
| 82 | | isStatusCode(200)-> |
|---|
| 83 | | isRequestParameter('module', $this->urlPrefix)-> |
|---|
| 84 | | isRequestParameter('action', 'new')-> |
|---|
| 85 | | isRequestParameter('id', null)-> |
|---|
| 86 | | checkResponseElement('h1', 'New '.ucfirst($this->urlPrefix))-> |
|---|
| 87 | | checkResponseElement(sprintf('a[href*="/%s"]', $this->urlPrefix), 'Cancel')-> |
|---|
| 88 | | checkResponseElement(sprintf('a[href*="/%s/"]', $this->urlPrefix), false)-> |
|---|
| | 87 | with('request')->begin()-> |
|---|
| | 88 | isParameter('module', $this->urlPrefix)-> |
|---|
| | 89 | isParameter('action', 'new')-> |
|---|
| | 90 | isParameter('id', null)-> |
|---|
| | 91 | end()-> |
|---|
| | 92 | with('response')->begin()-> |
|---|
| | 93 | isStatusCode(200)-> |
|---|
| | 94 | checkElement('h1', 'New '.ucfirst($this->urlPrefix))-> |
|---|
| | 95 | checkElement(sprintf('a[href*="/%s"]', $this->urlPrefix), 'Cancel')-> |
|---|
| | 96 | checkElement(sprintf('a[href*="/%s/"]', $this->urlPrefix), false)-> |
|---|
| | 97 | end()-> |
|---|
| 101 | | $this->test()->diag('save'); |
|---|
| 102 | | $this->saveValues($options, array( |
|---|
| 103 | | 'title' => 'my real title', |
|---|
| 104 | | 'body' => 'my real body', |
|---|
| 105 | | 'online' => true, |
|---|
| 106 | | 'category_id' => 2, |
|---|
| 107 | | 'end_date' => array('year' => '', 'month' => '', 'day' => '', 'hour' => '', 'minute' => ''), |
|---|
| 108 | | 'book_id' => null, |
|---|
| 109 | | 'author_article_list' => array(1, 2), |
|---|
| 110 | | ), 3, true); |
|---|
| | 110 | $this-> |
|---|
| | 111 | info('save')-> |
|---|
| | 112 | saveValues($options, array( |
|---|
| | 113 | 'title' => 'my real title', |
|---|
| | 114 | 'body' => 'my real body', |
|---|
| | 115 | 'online' => true, |
|---|
| | 116 | 'category_id' => 2, |
|---|
| | 117 | 'end_date' => array('year' => '', 'month' => '', 'day' => '', 'hour' => '', 'minute' => ''), |
|---|
| | 118 | 'book_id' => null, |
|---|
| | 119 | 'author_article_list' => array(1, 2), |
|---|
| | 120 | ), 3, true) |
|---|
| | 121 | ; |
|---|
| 133 | | isStatusCode(200)-> |
|---|
| 134 | | isRequestParameter('module', $this->urlPrefix)-> |
|---|
| 135 | | isRequestParameter('action', 'edit')-> |
|---|
| 136 | | isRequestParameter('id', 3)-> |
|---|
| 137 | | checkResponseElement('h1', 'Edit '.ucfirst($this->urlPrefix))-> |
|---|
| 138 | | checkResponseElement(sprintf('a[href*="/%s"]', $this->urlPrefix), 'Cancel')-> |
|---|
| 139 | | checkResponseElement(sprintf('a[href*="/%s/3"]', $this->urlPrefix), 'Delete')-> |
|---|
| 140 | | checkResponseElement(sprintf('a[href*="/%s/3"][onclick*="confirm"]', $this->urlPrefix))-> |
|---|
| 141 | | checkResponseElement('table tbody th:nth(0)', 'Title')-> |
|---|
| 142 | | checkResponseElement('table tbody th:nth(1)', 'Body')-> |
|---|
| 143 | | checkResponseElement('table tbody th:nth(2)', 'Online')-> |
|---|
| 144 | | checkResponseElement('table tbody th:nth(3)', 'Excerpt')-> |
|---|
| 145 | | checkResponseElement('table tbody th:nth(4)', 'Category id')-> |
|---|
| 146 | | checkResponseElement('table tbody th:nth(5)', 'Created at')-> |
|---|
| 147 | | checkResponseElement('table tbody th:nth(6)', 'End date')-> |
|---|
| 148 | | checkResponseElement('table tbody th:nth(7)', 'Book id')-> |
|---|
| 149 | | checkResponseElement('table tbody th:nth(8)', 'Author article list')-> |
|---|
| 150 | | checkResponseElement('table tbody td select[id="article_category_id"][name="article[category_id]"] option', 2)-> |
|---|
| 151 | | checkResponseElement('table tbody td select[id="article_book_id"][name="article[book_id]"] option', 2) |
|---|
| | 144 | with('request')->begin()-> |
|---|
| | 145 | isParameter('module', $this->urlPrefix)-> |
|---|
| | 146 | isParameter('action', 'edit')-> |
|---|
| | 147 | isParameter('id', 3)-> |
|---|
| | 148 | end()-> |
|---|
| | 149 | with('response')->begin()-> |
|---|
| | 150 | isStatusCode(200)-> |
|---|
| | 151 | checkElement('h1', 'Edit '.ucfirst($this->urlPrefix))-> |
|---|
| | 152 | checkElement(sprintf('a[href*="/%s"]', $this->urlPrefix), 'Cancel')-> |
|---|
| | 153 | checkElement(sprintf('a[href*="/%s/3"]', $this->urlPrefix), 'Delete')-> |
|---|
| | 154 | checkElement(sprintf('a[href*="/%s/3"][onclick*="confirm"]', $this->urlPrefix))-> |
|---|
| | 155 | checkElement('table tbody th:nth(0)', 'Title')-> |
|---|
| | 156 | checkElement('table tbody th:nth(1)', 'Body')-> |
|---|
| | 157 | checkElement('table tbody th:nth(2)', 'Online')-> |
|---|
| | 158 | checkElement('table tbody th:nth(3)', 'Excerpt')-> |
|---|
| | 159 | checkElement('table tbody th:nth(4)', 'Category id')-> |
|---|
| | 160 | checkElement('table tbody th:nth(5)', 'Created at')-> |
|---|
| | 161 | checkElement('table tbody th:nth(6)', 'End date')-> |
|---|
| | 162 | checkElement('table tbody th:nth(7)', 'Book id')-> |
|---|
| | 163 | checkElement('table tbody th:nth(8)', 'Author article list')-> |
|---|
| | 164 | checkElement('table tbody td select[id="article_category_id"][name="article[category_id]"] option', 2)-> |
|---|
| | 165 | checkElement('table tbody td select[id="article_book_id"][name="article[book_id]"] option', 2)-> |
|---|
| | 166 | end() |
|---|
| 227 | | isStatusCode(200)-> |
|---|
| 228 | | isRequestParameter('module', $this->urlPrefix)-> |
|---|
| 229 | | isRequestParameter('action', 'show')-> |
|---|
| 230 | | isRequestParameter('id', 2)-> |
|---|
| 231 | | checkResponseElement(sprintf('a[href*="/%s/2%s"]', $this->urlPrefix, in_array('with-show', $options) ? '' : '/edit'), 'Edit')-> |
|---|
| 232 | | checkResponseElement(sprintf('a[href*="/%s"]', $this->urlPrefix), 'List', array('position' => 1))-> |
|---|
| 233 | | checkResponseElement('body table tbody tr:nth(0)', '/Id\:\s+2/')-> |
|---|
| 234 | | checkResponseElement('body table tbody tr:nth(1)', '/Title\:\s+foo foo title/')-> |
|---|
| 235 | | checkResponseElement('body table tbody tr:nth(2)', '/Body\:\s+bar bar body/')-> |
|---|
| 236 | | checkResponseElement('body table tbody tr:nth(3)', '/Online\:\s+/')-> |
|---|
| 237 | | checkResponseElement('body table tbody tr:nth(4)', '/Excerpt\:\s+foo excerpt/')-> |
|---|
| 238 | | checkResponseElement('body table tbody tr:nth(5)', '/Category\:\s+2/')-> |
|---|
| 239 | | checkResponseElement('body table tbody tr:nth(6)', '/Created at\:\s+[0-9\-\:\s]+/')-> |
|---|
| 240 | | checkResponseElement('body table tbody tr:nth(7)', '/End date\:\s+[0-9\-\:\s]+/')-> |
|---|
| 241 | | checkResponseElement('body table tbody tr:nth(8)', '/Book\:\s+/') |
|---|
| | 244 | with('request')->begin()-> |
|---|
| | 245 | isParameter('module', $this->urlPrefix)-> |
|---|
| | 246 | isParameter('action', 'show')-> |
|---|
| | 247 | isParameter('id', 2)-> |
|---|
| | 248 | end()-> |
|---|
| | 249 | with('response')->begin()-> |
|---|
| | 250 | isStatusCode(200)-> |
|---|
| | 251 | checkElement(sprintf('a[href*="/%s/2%s"]', $this->urlPrefix, in_array('with-show', $options) ? '' : '/edit'), 'Edit')-> |
|---|
| | 252 | checkElement(sprintf('a[href*="/%s"]', $this->urlPrefix), 'List', array('position' => 1))-> |
|---|
| | 253 | checkElement('body table tbody tr:nth(0)', '/Id\:\s+2/')-> |
|---|
| | 254 | checkElement('body table tbody tr:nth(1)', '/Title\:\s+foo foo title/')-> |
|---|
| | 255 | checkElement('body table tbody tr:nth(2)', '/Body\:\s+bar bar body/')-> |
|---|
| | 256 | checkElement('body table tbody tr:nth(3)', '/Online\:\s+/')-> |
|---|
| | 257 | checkElement('body table tbody tr:nth(4)', '/Excerpt\:\s+foo excerpt/')-> |
|---|
| | 258 | checkElement('body table tbody tr:nth(5)', '/Category\:\s+2/')-> |
|---|
| | 259 | checkElement('body table tbody tr:nth(6)', '/Created at\:\s+[0-9\-\:\s]+/')-> |
|---|
| | 260 | checkElement('body table tbody tr:nth(7)', '/End date\:\s+[0-9\-\:\s]+/')-> |
|---|
| | 261 | checkElement('body table tbody tr:nth(8)', '/Book\:\s+/')-> |
|---|
| | 262 | end() |
|---|
| 277 | | return $this-> |
|---|
| 278 | | checkResponseElement(sprintf('table tbody td input[id="article_title"][name="article[title]"][value="%s"]', $values['title']))-> |
|---|
| 279 | | |
|---|
| 280 | | checkResponseElement('table tbody td textarea[id="article_body"][name="article[body]"]', $values['body'])-> |
|---|
| 281 | | |
|---|
| 282 | | checkResponseElement(sprintf('table tbody td input[id="article_online"][name="article[online]"][type="checkbox"]%s', $values['online'] ? '[checked="checked"]' : ''))-> |
|---|
| 283 | | |
|---|
| 284 | | checkResponseElement(sprintf('table tbody td select[id="article_category_id"][name="article[category_id]"] option[value="1"]%s', $values['category_id'] == 1 ? '[selected="selected"]' : ''), 'Category 1')-> |
|---|
| 285 | | checkResponseElement(sprintf('table tbody td select[id="article_category_id"][name="article[category_id]"] option[value="2"]%s', $values['category_id'] == 2 ? '[selected="selected"]' : ''), 'Category 2')-> |
|---|
| 286 | | |
|---|
| 287 | | checkResponseElement(sprintf('table tbody td select[id="article_book_id"][name="article[book_id]"] option[value=""]%s', $values['book_id'] == '' ? '[selected="selected"]' : ''), '')-> |
|---|
| 288 | | checkResponseElement(sprintf('table tbody td select[id="article_book_id"][name="article[book_id]"] option[value="1"]%s', $values['book_id'] == 1 ? '[selected="selected"]' : ''), 'The definitive guide to symfony')-> |
|---|
| 289 | | |
|---|
| 290 | | checkResponseElement(sprintf('table tbody td select[id="article_author_article_list"][name="article[author_article_list][]"] option[value="1"]%s', in_array(1, $values['author_article_list']) ? '[selected="selected"]' : ''), 'Fabien')-> |
|---|
| 291 | | checkResponseElement(sprintf('table tbody td select[id="article_author_article_list"][name="article[author_article_list][]"] option[value="2"]%s', in_array(2, $values['author_article_list']) ? '[selected="selected"]' : ''), 'Thomas')-> |
|---|
| 292 | | checkResponseElement(sprintf('table tbody td select[id="article_author_article_list"][name="article[author_article_list][]"] option[value="3"]%s', in_array(3, $values['author_article_list']) ? '[selected="selected"]' : ''), 'Hélène')-> |
|---|
| 293 | | |
|---|
| 294 | | checkResponseElement('table tbody td select[id="article_end_date_year"][name="article[end_date][year]"] option[selected="selected"]', (string) $values['end_date']['year'])-> |
|---|
| 295 | | checkResponseElement('table tbody td select[id="article_end_date_month"][name="article[end_date][month]"] option[selected="selected"]', (string) $values['end_date']['month'])-> |
|---|
| 296 | | checkResponseElement('table tbody td select[id="article_end_date_day"][name="article[end_date][day]"] option[selected="selected"]', (string) $values['end_date']['day'])-> |
|---|
| 297 | | checkResponseElement('table tbody td select[id="article_end_date_hour"][name="article[end_date][hour]"] option[selected="selected"]', (string) $values['end_date']['hour'])-> |
|---|
| 298 | | checkResponseElement('table tbody td select[id="article_end_date_minute"][name="article[end_date][minute]"] option[selected="selected"]', (string) $values['end_date']['minute']) |
|---|
| 299 | | ; |
|---|
| | 298 | return $this->with('response')->begin()-> |
|---|
| | 299 | checkElement(sprintf('table tbody td input[id="article_title"][name="article[title]"][value="%s"]', $values['title']))-> |
|---|
| | 300 | |
|---|
| | 301 | checkElement('table tbody td textarea[id="article_body"][name="article[body]"]', $values['body'])-> |
|---|
| | 302 | |
|---|
| | 303 | checkElement(sprintf('table tbody td input[id="article_online"][name="article[online]"][type="checkbox"]%s', $values['online'] ? '[checked="checked"]' : ''))-> |
|---|
| | 304 | |
|---|
| | 305 | checkElement(sprintf('table tbody td select[id="article_category_id"][name="article[category_id]"] option[value="1"]%s', $values['category_id'] == 1 ? '[selected="selected"]' : ''), 'Category 1')-> |
|---|
| | 306 | checkElement(sprintf('table tbody td select[id="article_category_id"][name="article[category_id]"] option[value="2"]%s', $values['category_id'] == 2 ? '[selected="selected"]' : ''), 'Category 2')-> |
|---|
| | 307 | |
|---|
| | 308 | checkElement(sprintf('table tbody td select[id="article_book_id"][name="article[book_id]"] option[value=""]%s', $values['book_id'] == '' ? '[selected="selected"]' : ''), '')-> |
|---|
| | 309 | checkElement(sprintf('table tbody td select[id="article_book_id"][name="article[book_id]"] option[value="1"]%s', $values['book_id'] == 1 ? '[selected="selected"]' : ''), 'The definitive guide to symfony')-> |
|---|
| | 310 | |
|---|
| | 311 | checkElement(sprintf('table tbody td select[id="article_author_article_list"][name="article[author_article_list][]"] option[value="1"]%s', in_array(1, $values['author_article_list']) ? '[selected="selected"]' : ''), 'Fabien')-> |
|---|
| | 312 | checkElement(sprintf('table tbody td select[id="article_author_article_list"][name="article[author_article_list][]"] option[value="2"]%s', in_array(2, $values['author_article_list']) ? '[selected="selected"]' : ''), 'Thomas')-> |
|---|
| | 313 | checkElement(sprintf('table tbody td select[id="article_author_article_list"][name="article[author_article_list][]"] option[value="3"]%s', in_array(3, $values['author_article_list']) ? '[selected="selected"]' : ''), 'Hélène')-> |
|---|
| | 314 | |
|---|
| | 315 | checkElement('table tbody td select[id="article_end_date_year"][name="article[end_date][year]"] option[selected="selected"]', (string) $values['end_date']['year'])-> |
|---|
| | 316 | checkElement('table tbody td select[id="article_end_date_month"][name="article[end_date][month]"] option[selected="selected"]', (string) $values['end_date']['month'])-> |
|---|
| | 317 | checkElement('table tbody td select[id="article_end_date_day"][name="article[end_date][day]"] option[selected="selected"]', (string) $values['end_date']['day'])-> |
|---|
| | 318 | checkElement('table tbody td select[id="article_end_date_hour"][name="article[end_date][hour]"] option[selected="selected"]', (string) $values['end_date']['hour'])-> |
|---|
| | 319 | checkElement('table tbody td select[id="article_end_date_minute"][name="article[end_date][minute]"] option[selected="selected"]', (string) $values['end_date']['minute'])-> |
|---|
| | 320 | end(); |
|---|