public function testCreate() { // simulate the Dyn API response $this->accounts->getApiClient()->getHttpClient()->getAdapter()->setResponse("HTTP/1.1 200 OK" . "\r\n" . "Content-type: application/json" . "\r\n\r\n" . '{"response":{"status":200,"message":"OK","data":{"apikey": "abcdefghijklmnopqrstuvwxyz"}}}'); $account = new Account(); $account->setUsername('*****@*****.**')->setPassword('notarealpassword')->setCompanyName('Dyn')->setPhone('603-123-1234'); $result = $this->accounts->create($account); $this->assertInstanceOf('Dyn\\MessageManagement\\Account', $result); $this->assertEquals('abcdefghijklmnopqrstuvwxyz', $account->getApiKey()); }
<?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);
public function testValidUsername() { $account = new Account(); $account->setUsername('*****@*****.**'); $this->assertEquals('*****@*****.**', $account->getUsername()); }