setRequestMethod('GET'); $this->setRequestUri('/v3/example.com/events'); $this->setHttpResponse(new Response(200, ['Content-Type'=>'application/json'], <<", "subject": "Hello" }, "attachments": [], "recipients": [ "foo@example.com", "baz@example.com", "bar@example.com" ], "size": 69 }, "recipient": "baz@example.com", "method": "http" } ], "paging": { "next": "https://api.mailgun.net/v3/samples.mailgun.org/events/W3siY...", "previous": "https://api.mailgun.net/v3/samples.mailgun.org/events/Lkawm..." } } JSON )); $api = $this->getApiMock(); $event = $api->get('example.com'); $this->assertInstanceOf(EventResponse::class, $event); $this->assertCount(1, $event->getItems()); $this->assertEquals('accepted', $event->getItems()[0]->getEvent()); } public function testGetWithEmptyDomain() { $api = $this->getApiMock(); $this->expectException(InvalidArgumentException::class); $api->get(''); } }