コード例 #1
0
 /** @test
  * @group */
 public function it_creates_interest_group_with_mailChimp()
 {
     $model = new SaveInterestModel();
     $interest = m::mock(Interest::class);
     $interest->shouldReceive('setAttribute')->with('interest_id', m::any());
     $ia = new InterestActions(new Client(), $interest);
     return $ia->add($model);
 }
コード例 #2
0
 /** @test
  * @group  */
 public function it_creates_interest_group()
 {
     $this->model = new SaveInterestModel();
     $response = m::mock(\Psr\Http\Message\ResponseInterface::class);
     $apiKey = getenv('MAILCHIMP_API');
     $this->guzzle->shouldReceive('request')->with('POST', $this->endpoint . "/3.0/lists/{$this->model->getInterestListId()}/interest-categories/{$this->model->getInterestCategoryId()}/interests", ['headers' => ['Authorization' => 'OAuth ' . $apiKey], 'json' => ['name' => $this->model->getInterestName(), 'display_order' => $this->model->getInterestDisplayOrder()]])->andReturn($response);
     $response->shouldReceive('getBody')->andReturn(json_encode(['id' => '1234']));
     $interest = m::mock(Interest::class);
     $interest->shouldReceive('setAttribute')->with('interest_id', 1234);
     $ia = new InterestActions($this->guzzle, $interest);
     $ia->add($this->model);
 }
コード例 #3
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(InterestActions $mailChimp)
 {
     $mailChimp->add($this->model);
 }