public function testCreateRequiresUsername() { $this->setExpectedException('RuntimeException'); $account = new Account(); $account->setPassword('notarealpassword')->setCompanyName('Dyn')->setPhone('603-123-1234'); $result = $this->accounts->create($account); }
<?php /** * This example creates a new sub account */ require '../../vendor/autoload.php'; use Dyn\MessageManagement; use Dyn\MessageManagement\Account; $mm = new MessageManagement('YOUR API KEY'); // setup the account $account = new Account(); $account->setUsername('*****@*****.**')->setPassword('hCQLNuOKsrt57Uf')->setCompanyName('Dyn')->setPhone('603-123-1234'); // create it $mm->accounts()->create($account);
/** * Delete an account * * @param Account $account * @return boolean */ public function delete(Account $account) { $params = array('username' => $account->getUsername()); $response = $this->getApiClient()->post('/accounts/delete', $params); if ($response && $response->isOk()) { return true; } return false; }
public function testValidUsername() { $account = new Account(); $account->setUsername('*****@*****.**'); $this->assertEquals('*****@*****.**', $account->getUsername()); }