<?php

namespace tests\codeception\frontend\_pages;

use tests\codeception\common\_pages\MyBasePage;

/**
 * Represents contact page
 * @property \codeception_frontend\AcceptanceTester|\codeception_frontend\FunctionalTester $actor
 */
class UserProfilePage extends MyBasePage
{
    public $route = 'user/update';

    /**
     * @param array $contactData
     */
    public function submit(array $contactData)
    {
        foreach ($contactData as $field => $value) {
            $inputType = $field === 'address' ? 'textarea' : 'input';
            $this->actor->fillField($inputType . '[name="User[' . $field . ']"]', $value);
        }
        $this->actor->click('user-profile-button');
    }
}
