/**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $company)
 {
     $this->assertSame('CompanyModel', $company->getStructure()->getName());
     $this->assertSame('Acme Inc', $company->get('name'));
     $this->assertSame(array('acmeinc.com', 'acmeinc.net'), $company->get('domains'));
     $this->assertSame(array('employer_id' => '123456789'), $company->get('custom_fields'));
     $this->assertInstanceOf('DateTime', $company->get('created_at'));
     $this->assertSame(1373570905, $company->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $company->get('updated_at'));
     $this->assertSame(1373570905, $company->get('updated_at')->getTimestamp());
     $this->assertSame(array('employer_id' => '123456789'), $company->get('custom_fields'));
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $customer)
 {
     $this->assertSame('CustomerModel', $customer->getStructure()->getName());
     $this->assertSame('John', $customer->get('first_name'));
     $this->assertSame('Doe', $customer->get('last_name'));
     $this->assertSame('ACME, Inc', $customer->get('company'));
     $this->assertSame('Senior Ninja', $customer->get('title'));
     $this->assertInstanceOf('DateTime', $customer->get('created_at'));
     $this->assertSame(1369414202, $customer->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $customer->get('updated_at'));
     $this->assertSame(1369414202, $customer->get('updated_at')->getTimestamp());
 }
Esempio n. 3
0
 public function testValidateResponseInvalid()
 {
     $clientCommand = new ClientCommand($this->getMock('\\Desk\\Client'), $this->getMock('\\DeskModule\\Transaction\\Transaction'), $this->getMock('\\DeskModule\\Model\\Transaction\\Marshaller\\Guzzle\\Http\\Message\\RequestInterfaceToTransaction'));
     $clientCommand->setCommand(new EmbeddedCommand());
     $preExecute = new PreExecute($clientCommand);
     $response = new Model();
     $response->set('id', 0);
     $postExecute = new PostExecute($preExecute, $response);
     $this->assertFalse($postExecute->propagationIsStopped());
     $actual = $this->sut->validateResponse($postExecute);
     $this->assertTrue($postExecute->propagationIsStopped());
     $this->assertFalse($actual);
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $action)
 {
     $this->assertSame('MacroActionModel', $action->getStructure()->getName());
     $this->assertSame('set-case-description', $action->get('type'));
     $this->assertSame('From a VIP Customer', $action->get('value'));
     $this->assertSame(true, $action->get('enabled'));
     $this->assertInstanceOf('DateTime', $action->get('created_at'));
     $this->assertSame(1370375051, $action->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $action->get('updated_at'));
     $this->assertSame(1370375051, $action->get('updated_at')->getTimestamp());
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $note)
 {
     $this->assertSame('CaseNoteModel', $note->getStructure()->getName());
     $this->assertSame('Please assist me with this case', $note->get('body'));
     $this->assertInstanceOf('DateTime', $note->get('created_at'));
     $this->assertSame(1370375051, $note->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $note->get('updated_at'));
     $this->assertSame(1370375051, $note->get('updated_at')->getTimestamp());
     $this->assertSame(null, $note->get('erased_at'));
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $topic)
 {
     $this->assertSame('TopicTranslationModel', $topic->getStructure()->getName());
     $this->assertSame('Customer Support', $topic->get('name'));
     $this->assertSame('en_us', $topic->get('locale'));
     $this->assertInstanceOf('DateTime', $topic->get('created_at'));
     $this->assertSame(1369511651, $topic->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $topic->get('updated_at'));
     $this->assertSame(1369943651, $topic->get('updated_at')->getTimestamp());
 }
Esempio n. 7
0
 public function testDeprecateAllCompanies()
 {
     /** @var Company|\PHPUnit_Framework_MockObject_MockObject $clientService */
     $clientService = $this->getMock('DeskModule\\Client\\Company\\Company');
     $companyListPage = $this->getMock('\\Desk\\Relationship\\Resource\\Model');
     $clientService->expects($this->once())->method('getList')->will($this->returnValue($companyListPage));
     $deprecatedDeskCompany = new Model();
     $deprecatedDeskCompany->set('custom_fields', array('deprecated' => true));
     $deskCompany = new Model();
     $deskCompany->set('custom_fields', array('deprecated' => null));
     $companyListPage->expects($this->once())->method('getEmbedded')->with('entries')->will($this->returnValue(array($deprecatedDeskCompany, $deskCompany)));
     $eventManager = $this->getMock('DeskModule\\Client\\Company\\Event\\Manager');
     $this->sut->setCompanyClientService($clientService);
     $this->sut->setCompanyClientEventManager($eventManager);
     $this->sut->setLogger($this->getMock('\\Logger', array(), array(), '', false));
     $response = $this->sut->deprecateAllCompanies();
     $this->assertTrue($response);
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $macro)
 {
     $this->assertSame('MacroModel', $macro->getStructure()->getName());
     $this->assertSame('Macro Macro', $macro->get('name'));
     $this->assertSame('On repeat', $macro->get('description'));
     $this->assertSame(true, $macro->get('enabled'));
     $this->assertSame(1, $macro->get('position'));
     $this->assertSame(array('Sample Macros', 'Favorites'), $macro->get('folders'));
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $filter)
 {
     $this->assertSame('FilterModel', $filter->getStructure()->getName());
     $this->assertSame('My Active Cases', $filter->get('name'));
     $this->assertSame('priority', $filter->get('sort'));
     $this->assertSame('desc', $filter->get('sort_direction'));
     $this->assertSame(1, $filter->get('position'));
     $this->assertSame(true, $filter->get('active'));
 }
Esempio n. 10
0
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $article)
 {
     $this->assertSame('BrandModel', $article->getStructure()->getName());
     $this->assertSame('Brand Name', $article->get('name'));
     $this->assertInstanceOf('DateTime', $article->get('created_at'));
     $this->assertSame(1407967854, $article->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $article->get('updated_at'));
     $this->assertSame(1407967854, $article->get('updated_at')->getTimestamp());
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $macro)
 {
     $this->assertSame('MacroModel', $macro->getStructure()->getName());
     $this->assertSame('Assign to Engineering', $macro->get('name'));
     $this->assertSame("It's raining fire!", $macro->get('description'));
     $this->assertSame(true, $macro->get('enabled'));
     $this->assertSame(1, $macro->get('position'));
     $this->assertSame(array('Sample Macros', 'Favorites'), $macro->get('folders'));
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $field)
 {
     $this->assertSame('CustomFieldModel', $field->getStructure()->getName());
     $this->assertSame('frequent_buyer', $field->get('name'));
     $this->assertSame('Frequent Buyer', $field->get('label'));
     $this->assertSame('customer', $field->get('type'));
     $this->assertSame(true, $field->get('active'));
 }
Esempio n. 13
0
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $user)
 {
     $this->assertSame('UserModel', $user->getStructure()->getName());
     $this->assertSame('John Doe', $user->get('name'));
     $this->assertSame('John Doe', $user->get('public_name'));
     $this->assertSame('*****@*****.**', $user->get('email'));
     $this->assertSame('agent', $user->get('level'));
 }
 /**
  * Contains assertions to make about the results of the system test
  *
  * @param array $model Resulting model from system test
  */
 protected function assertSystem(Model $model)
 {
     $this->assertEquals('CaseHistoryModel', $model->getStructure()->getName());
     $this->assertEquals(2351, $model->get('id'));
     $this->assertTrue($model->hasLink('self'));
     $this->assertContains(2441978, $model->getPath('changes/*/to'));
     $this->assertInstanceOf('\\DateTime', $model->get('created_at'));
 }
 /**
  * {@inheritdoc}
  */
 public function assertSystem(Model $label)
 {
     $this->assertSame('LabelModel', $label->getStructure()->getName());
     $this->assertSame('My great label', $label->get('name'));
     $types = $label->get('types');
     $this->assertSame(2, count($types));
     $this->assertSame('case', $types[0]);
     $this->assertSame('macro', $types[1]);
     $this->assertSame('A label to use for great things.', $label->get('description'));
     $this->assertSame(true, $label->get('enabled'));
     $this->assertSame('default', $label->get('color'));
 }
Esempio n. 16
0
 /**
  * @covers Desk\Relationship\Resource\Model::getResource
  */
 public function testGetResourceNotEmbedded()
 {
     $command = \Mockery::mock('Guzzle\\Service\\Command\\OperationCommand')->shouldReceive('execute')->andReturn('bar')->getMock();
     $model = new Model(array('_links' => array('foo' => $command)));
     $resource = $model->getResource('foo');
     $this->assertSame('bar', $resource);
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $topic)
 {
     $this->assertSame('TopicModel', $topic->getStructure()->getName());
     $this->assertSame('Social Media', $topic->get('name'));
     $this->assertSame(null, $topic->get('description'));
     $this->assertSame(1, $topic->get('position'));
     $this->assertSame(true, $topic->get('allow_questions'));
     $this->assertSame(true, $topic->get('in_support_center'));
     $this->assertInstanceOf('DateTime', $topic->get('created_at'));
     $this->assertSame(1374868071, $topic->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $topic->get('updated_at'));
     $this->assertSame(1374868071, $topic->get('updated_at')->getTimestamp());
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $article)
 {
     $this->assertSame('ArticleTranslationModel', $article->getStructure()->getName());
     $this->assertSame('en', $article->get('locale'));
     $this->assertSame('Awesome Subject', $article->get('subject'));
     $this->assertSame('<p>Awesome apples</p>', $article->get('body'));
     $this->assertInstanceOf('DateTime', $article->get('publish_at'));
     $this->assertSame(1370375351, $article->get('publish_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $article->get('created_at'));
     $this->assertSame(1370375051, $article->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $article->get('updated_at'));
     $this->assertSame(1370375351, $article->get('updated_at')->getTimestamp());
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $article)
 {
     $this->assertSame('ArticleModel', $article->getStructure()->getName());
     $this->assertSame('Awesome Subject', $article->get('subject'));
     $this->assertSame('<p>Awesome apples</p>', $article->get('body'));
     $this->assertSame(1, $article->get('position'));
     $this->assertSame(false, $article->get('in_support_center'));
     $this->assertInstanceOf('DateTime', $article->get('publish_at'));
     $this->assertSame(1369414502, $article->get('publish_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $article->get('created_at'));
     $this->assertSame(1369414202, $article->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $article->get('updated_at'));
     $this->assertSame(1369414502, $article->get('updated_at')->getTimestamp());
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $reply)
 {
     $this->assertSame('CaseReplyModel', $reply->getStructure()->getName());
     $this->assertSame('Re: Please help', $reply->get('subject'));
     $this->assertSame('Thanks for your question. The answer is 42.', $reply->get('body'));
     $this->assertSame('out', $reply->get('direction'));
     $this->assertSame('pending', $reply->get('status'));
     $this->assertSame('*****@*****.**', $reply->get('to'));
     $this->assertSame('*****@*****.**', $reply->get('from'));
     $this->assertInstanceOf('DateTime', $reply->get('created_at'));
     $this->assertSame(1335994728, $reply->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $reply->get('updated_at'));
     $this->assertSame(1335994728, $reply->get('updated_at')->getTimestamp());
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $reply)
 {
     $this->assertSame('CaseMessageModel', $reply->getStructure()->getName());
     $this->assertSame('Please help', $reply->get('subject'));
     $this->assertSame('Help me with my issue!', $reply->get('body'));
     $this->assertSame('in', $reply->get('direction'));
     $this->assertSame('pending', $reply->get('status'));
     $this->assertSame('*****@*****.**', $reply->get('to'));
     $this->assertSame('*****@*****.**', $reply->get('from'));
     $this->assertInstanceOf('DateTime', $reply->get('created_at'));
     $this->assertSame(1335994728, $reply->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $reply->get('updated_at'));
     $this->assertSame(1335994728, $reply->get('updated_at')->getTimestamp());
 }
Esempio n. 22
0
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $topic)
 {
     $this->assertSame('TopicModel', $topic->getStructure()->getName());
     $this->assertSame('Customer Support', $topic->get('name'));
     $this->assertSame('This is key to going from good to great', $topic->get('description'));
     $this->assertSame(1, $topic->get('position'));
     $this->assertSame(true, $topic->get('allow_questions'));
     $this->assertSame(true, $topic->get('in_support_center'));
     $this->assertInstanceOf('DateTime', $topic->get('created_at'));
     $this->assertSame(1368550802, $topic->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $topic->get('updated_at'));
     $this->assertSame(1368982802, $topic->get('updated_at')->getTimestamp());
 }
 /**
  * {@inheritdoc}
  */
 public function assertSystem(Model $article)
 {
     $this->assertSame('ArticleModel', $article->getStructure()->getName());
     $this->assertSame('How to make your customers happy', $article->get('subject'));
     $this->assertSame('<strong>Use Desk.com</strong>', $article->get('body'));
     $this->assertSame('Custom email body for article', $article->get('body_email'));
     $this->assertSame(false, $article->get('body_email_auto'));
     $this->assertSame("Use Desk.com", $article->get('body_chat'));
     $this->assertSame(true, $article->get('body_chat_auto'));
     $this->assertSame("<strong>Use Desk.com</strong>", $article->get('body_web_callback'));
     $this->assertSame(true, $article->get('body_web_callback_auto'));
     $this->assertSame("Use Desk.com", $article->get('body_twitter'));
     $this->assertSame(true, $article->get('body_twitter_auto'));
     $this->assertSame("Use Desk.com", $article->get('body_qna'));
     $this->assertSame(true, $article->get('body_qna_auto'));
     $this->assertSame("Use Desk.com", $article->get('body_phone'));
     $this->assertSame(true, $article->get('body_phone_auto'));
     $this->assertSame("Use Desk.com", $article->get('body_facebook'));
     $this->assertSame(true, $article->get('body_facebook_auto'));
     $this->assertSame(null, $article->get('keywords'));
     $this->assertSame(1, $article->get('position'));
     $this->assertSame(null, $article->get('quickcode'));
     $this->assertSame(null, $article->get('in_support_center'));
     $this->assertSame(null, $article->get('internal_notes'));
     $this->assertSame(null, $article->get('publish_at'));
     $this->assertInstanceOf('DateTime', $article->get('created_at'));
     $this->assertSame(1372451977, $article->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $article->get('updated_at'));
     $this->assertSame(1372452277, $article->get('updated_at')->getTimestamp());
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $attachment)
 {
     $this->assertSame('CaseAttachmentModel', $attachment->getStructure()->getName());
     $this->assertSame('awesome_pic.png', $attachment->get('file_name'));
     $this->assertSame('image/png', $attachment->get('content_type'));
     $this->assertSame('500', $attachment->get('size'));
     $this->assertSame('http://example.com/short_lived_link_to_the_file_content', $attachment->get('url'));
     $this->assertInstanceOf('DateTime', $attachment->get('created_at'));
     $this->assertSame(1409340260, $attachment->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $attachment->get('updated_at'));
     $this->assertSame(1409340260, $attachment->get('updated_at')->getTimestamp());
     $this->assertNull($attachment->get('erased_at'));
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $articleTranslation)
 {
     $this->assertSame('ArticleTranslationModel', $articleTranslation->getStructure()->getName());
     $this->assertSame('Spanish Translation', $articleTranslation->get('subject'));
     $this->assertSame('es', $articleTranslation->get('locale'));
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $url)
 {
     $this->assertSame('IntegrationUrlModel', $url->getStructure()->getName());
     $this->assertSame('Sample URL', $url->get('name'));
     $this->assertSame('A sample Integration URL', $url->get('description'));
     $this->assertSame(true, $url->get('enabled'));
     $this->assertSame('http://www.example.com/name={{customer.name | url_encode}}', $url->get('markup'));
     $this->assertSame('http://www.example.com/name=Andrew', $url->get('rendered'));
     $this->assertInstanceOf('DateTime', $url->get('created_at'));
     $this->assertSame(1335994728, $url->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $url->get('updated_at'));
     $this->assertSame(1335994728, $url->get('updated_at')->getTimestamp());
 }
Esempio n. 27
0
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $case)
 {
     $this->assertSame('CaseModel', $case->getStructure()->getName());
     $this->assertSame('Welcome', $case->get('subject'));
     $this->assertSame(5, $case->get('priority'));
     $this->assertSame('new', $case->get('status'));
     $this->assertSame(array('Spam', 'Test'), $case->get('labels'));
     $this->assertInstanceOf('DateTime', $case->get('created_at'));
     $this->assertSame(1335994728, $case->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $case->get('updated_at'));
     $this->assertSame(1335994728, $case->get('updated_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $case->get('received_at'));
     $this->assertSame(1335994728, $case->get('received_at')->getTimestamp());
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $customer)
 {
     $this->assertSame('CustomerModel', $customer->getStructure()->getName());
     $this->assertSame(1, $customer->get('id'));
     $this->assertSame('John', $customer->get('first_name'));
     $this->assertSame('Doe', $customer->get('last_name'));
     $this->assertNull($customer->get('company'));
     $this->assertSame('', $customer->get('title'));
     $this->assertNull($customer->get('external_id'));
     $this->assertSame('', $customer->get('background'));
     $this->assertNull($customer->get('locked_until'));
     $this->assertInstanceOf('DateTime', $customer->get('created_at'));
     $this->assertSame(1354558438, $customer->get('created_at')->getTimestamp());
     $this->assertInstanceOf('DateTime', $customer->get('updated_at'));
     $this->assertSame(1412793206, $customer->get('updated_at')->getTimestamp());
     $this->assertSame(array('level' => 'vip'), $customer->get('custom_fields'));
     $emails = array(array('type' => 'work', 'value' => '*****@*****.**'), array('type' => 'home', 'value' => '*****@*****.**'));
     $this->assertSame($emails, $customer->get('emails'));
     $this->assertSame(array(), $customer->get('phone_numbers'));
     $this->assertSame(array(), $customer->get('addresses'));
     $this->assertNull($customer->get('locked_by'));
     $this->assertSame('http://www.gravatar.com/avatar/1', $customer->get('avatar'));
     $this->assertFalse($customer->get('access_company_cases'));
     $this->assertTrue($customer->get('access_private_portal'));
     $this->assertTrue($customer->get('access_private_portal'));
     $this->assertNull($customer->get('language'));
 }
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $topicTranslation)
 {
     $this->assertSame('TopicTranslationModel', $topicTranslation->getStructure()->getName());
     $this->assertSame('Japanese', $topicTranslation->get('name'));
     $this->assertSame('ja', $topicTranslation->get('locale'));
 }
Esempio n. 30
0
 /**
  * {@inheritdoc}
  */
 protected function assertSystem(Model $group)
 {
     $this->assertSame('GroupModel', $group->getStructure()->getName());
     $this->assertSame('Support Ninjas', $group->get('name'));
 }