/** * @param Login $login * @return string */ protected function createChannel(Login $login) { $channelName = 'Channel_' . mt_rand(); /** @var Channels $login */ $login->openChannels('OroCRM\\Bundle\\ChannelBundle')->assertTitle('All - Channels - System')->add()->assertTitle('Create Channel - Channels - System')->setType('B2B')->setName($channelName)->setStatus('Active')->save()->assertMessage('Channel saved'); return $channelName; }
/** * @param $userName * @param $password * * @return Login */ public function login($userName = null, $password = null, $args = []) { /** @var Login $login */ $login = new Login($this, $args); $login->setUsername($userName ? $userName : PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_LOGIN)->setPassword($password ? $password : PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_PASS)->submit(); return $login; }
/** * @param Login $login * @return string */ protected function createAccount(Login $login) { $accountName = 'Account_' . mt_rand(); /** @var Accounts $login */ $login->openAccounts('OroCRM\\Bundle\\AccountBundle')->add()->setAccountName($accountName)->setOwner('admin')->save(); return $accountName; }
/** * @param Login $login * @param string $account * @param string $channel * @return string */ protected function createB2BCustomer(Login $login, $account, $channel) { $name = 'B2BCustomer_' . mt_rand(); /** @var B2BCustomers $login */ $login->openB2BCustomers('OroCRM\\Bundle\\SalesBundle')->add()->setName($name)->setOwner('admin')->setAccount($account)->setChannel($channel)->save(); return $name; }
/** * @param $username * @depends testCreateUser * @depends testEditRole */ public function testViewAccountsContacts($username) { $login = new Login($this); $login->setUsername($username)->setPassword('123123q')->submit(); /** @var Accounts $login */ $login->openAccounts('OroCRM\\Bundle\\AccountBundle')->assertTitle('Accounts - Customers')->assertElementNotPresent("//div[@class='container-fluid']//a[@title='Create Account']"); /** @var Contacts $login */ $login->openContacts('OroCRM\\Bundle\\ContactBundle')->assertTitle('Contacts - Customers')->assertElementNotPresent("//div[@class='container-fluid']//a[@title='Create Contact']"); /** @var ContactGroups $login */ $login->openContactGroups('OroCRM\\Bundle\\ContactBundle')->assertTitle('Contact Groups - System')->assertElementNotPresent("//div[@class='container-fluid']//a[@title='Create Contact Group']"); /** @var AclCheck $login */ $login->openAclCheck('Oro\\Bundle\\SecurityBundle')->assertAcl('account/create')->assertAcl('contact/create')->assertAcl('contact/group/create')->assertAcl('contact/group/create'); }
/** * @param Login $login * @param $contactData */ public function createContact(Login $login, $contactData) { /** @var Contacts $login */ $login->openContacts('OroCRM\\Bundle\\ContactBundle')->add()->setFirstName($contactData['firstName'])->setLastName($contactData['secondName'])->setOwner('admin')->setEmail($contactData['email'])->save()->assertMessage('Contact saved'); }
/** * @Given /^Login as an existing "([^"]*)" user and "([^"]*)" password$/ */ public function loginAsAnExistingUserAndPassword($user, $password) { $login = new Login($this); $login->setUsername($user)->setPassword($password)->submit()->assertTitle('Dashboard'); }