示例#1
0
 public function testRecordEmailSent()
 {
     $profile = Profile::model()->findByAttributes(array('username' => 'testuser'));
     $case = 'Use case 1: plain email';
     $this->eml = new InlineEmail('custom');
     $this->eml->subject = 'test email subject';
     $this->eml->message = '<html><head></head><body><h1>testing 123</h1></body></html>';
     $this->eml->to = '"Testfirstname Testlastname" <*****@*****.**>';
     $this->eml->from = array('name' => 'Sales Rep', 'address' => '*****@*****.**');
     $this->eml->modelId = 12345;
     $this->eml->modelName = 'Contacts';
     $this->eml->userProfile = $profile;
     $this->eml->validate();
     $this->eml->insertTrackingImage();
     $this->eml->recordEmailSent();
     $this->assertModelUpdated('contacts', 'testAnyone', $case);
     $this->assertActionCreated('email', $case);
     $case = 'Use case 2: quote issued';
     $this->eml = new InlineEmail('custom');
     $this->eml->message = '<html><head></head><body><h1>testing 123</h1></body></html>';
     $this->eml->to = '"Testfirstname Testlastname" <*****@*****.**>';
     $this->eml->from = array('name' => 'Sales Rep', 'address' => '*****@*****.**');
     $quote = $this->quote('docsTest');
     $this->eml->modelId = $quote->id;
     $this->eml->modelName = 'Quote';
     $this->eml->userProfile = $profile;
     $this->eml->validate();
     $this->eml->insertTrackingImage();
     $this->eml->recordEmailSent();
     $this->assertModelUpdated('quote', 'docsTest', $case);
     $this->assertActionCreated('email_quote', $case);
 }