<?php

namespace tests\codeception\frontend\_pages;

use tests\codeception\common\_pages\MyBasePage;

/**
 * Represents signup page
 * @property \codeception_frontend\AcceptanceTester|\codeception_frontend\FunctionalTester $actor
 */
class SignupPage extends MyBasePage
{
    public $route = 'site/signup';

    /**
     * @param array $signupData
     */
    public function submit(array $signupData)
    {
        foreach ($signupData as $field => $value) {
            $selector = '[name="SignupForm[' . $field . ']"]';
            if($field == 'id_tax_rate_default' || $field == 'id_producer') {
                $this->actor->selectOption('select'.$selector, $value);
            }
            else {
                $this->actor->fillField('input'.$selector, $value);
            }

        }
        $this->actor->click('signup-button');
    }
}
