public function testCountByType() { $this->profile->add(Profile\Interaction::publish(new Location('foo'), new Request('foo', '0')))->add(Profile\Interaction::call(new Location('foo'), new Request('foo', '0')))->add(Profile\Interaction::broadcast(new Request('foo', '0')))->add(Profile\Interaction::publish(new Location('foo'), new Request('foo', '0')))->add(Profile\Interaction::call(new Location('foo'), new Request('foo', '0')))->add(Profile\Interaction::publish(new Location('foo'), new Request('foo', '0'))); $this->assertCount(6, $this->profile->all()); $this->assertEquals(3, $this->profile->countPublish()); $this->assertEquals(2, $this->profile->countCall()); $this->assertEquals(1, $this->profile->countBroadcast()); }
public function testCallException() { $this->innerDriver->expects($this->once())->method('call')->willThrowException(new \RuntimeException()); try { $this->driver->call(new Location('foo'), new Request('foo', '0')); } catch (\RuntimeException $e) { } $interactions = $this->profile->all(); $broadcast = reset($interactions); $this->assertEquals(Profile\Interaction::TYPE_CALL, $broadcast->getType()); $this->assertNotNull($broadcast->getLocation()); $this->assertTrue($broadcast->isFailure()); $this->assertNotNull($broadcast->getStartedAt()); $this->assertNotNull($broadcast->getFinishedAt()); $this->assertNotNull($broadcast->getRequest()); $this->assertNotNull($broadcast->getException()); }