| @@ 59-80 (lines=22) @@ | ||
| 56 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
| 57 | * @link http://datasift.github.io/storyplayer |
|
| 58 | */ |
|
| 59 | class ExpectsForm extends ExpectsBrowser |
|
| 60 | { |
|
| 61 | protected $formId; |
|
| 62 | ||
| 63 | protected function initActions() |
|
| 64 | { |
|
| 65 | // shorthand |
|
| 66 | $formId = $this->args[0]; |
|
| 67 | ||
| 68 | // find the form |
|
| 69 | $formElement = Browser::fromBrowser()->get()->elementById($formId); |
|
| 70 | ||
| 71 | // is it really a form? |
|
| 72 | if (strtolower($formElement->name()) !== 'form') { |
|
| 73 | throw new E5xx_ActionFailed('form'); |
|
| 74 | } |
|
| 75 | ||
| 76 | // yes, it really is a form |
|
| 77 | $this->formId = $formId; |
|
| 78 | $this->setTopElement($formElement); |
|
| 79 | } |
|
| 80 | } |
|
| 81 | ||
| @@ 59-80 (lines=22) @@ | ||
| 56 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
| 57 | * @link http://datasift.github.io/storyplayer |
|
| 58 | */ |
|
| 59 | class FromForm extends FromBrowser |
|
| 60 | { |
|
| 61 | protected $formId; |
|
| 62 | ||
| 63 | protected function initActions() |
|
| 64 | { |
|
| 65 | // shorthand |
|
| 66 | $formId = $this->args[0]; |
|
| 67 | ||
| 68 | // find the form |
|
| 69 | $formElement = Browser::fromBrowser()->get()->elementById($formId); |
|
| 70 | ||
| 71 | // is it really a form? |
|
| 72 | if (strtolower($formElement->name()) !== 'form') { |
|
| 73 | throw new E5xx_ActionFailed('form'); |
|
| 74 | } |
|
| 75 | ||
| 76 | // yes, it really is a form |
|
| 77 | $this->formId = $formId; |
|
| 78 | $this->setTopElement($formElement); |
|
| 79 | } |
|
| 80 | } |
|
| 81 | ||