/** * @covers ::event */ public function testEvent() { $client = new Client('aaaaa', 'bbbbb'); $event = $client->event('foo'); $this->assertInstanceOf('MaartenStaa\\GameAnalytics\\Message', $event); $this->assertSame($client, $event->getClient()); $this->assertStringEndsWith('aaaaa/events', $event->getEndpoint()); $this->assertEquals(['category' => 'foo'], $event->getPayload()); }
/** * Get the contents of the Authorization header based on the given request * body. Returns the base-64 encoded HMAC SHA-256 digest. * * @return string */ protected function getAuthorization($body) { return base64_encode(hash_hmac('sha256', $body, $this->client->getSecret(), true)); }