Blame view

tests/codeception/frontend/_pages/SignupPage.php 761 Bytes
4ca21c3e   Alexey Boroda   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  <?php
  
  namespace tests\codeception\frontend\_pages;
  
  use yii\codeception\BasePage;
  use frontend\models\SignupForm;
  
  /**
   * Represents signup page
   * @property \codeception_frontend\AcceptanceTester|\codeception_frontend\FunctionalTester $actor
   */
  class SignupPage extends BasePage
  {
  
      public $route = 'site/signup';
  
      /**
       * @param array $signupData
       */
      public function submit(array $signupData)
      {
          $signupForm = new SignupForm;
  
          foreach ($signupData as $field => $value) {
              $inputType = $field === 'body' ? 'textarea' : 'input';
              $this->actor->fillField($inputType . '[name="' . $signupForm->formName() . '[' . $field . ']"]', $value);
          }
          $this->actor->click('signup-button');
      }
  }