public function SubscriptionControllerTest::testReceive in Feeds 8.3
@covers ::receive
File
- tests/
src/ Unit/ Controller/ SubscriptionControllerTest.php, line 210
Class
- SubscriptionControllerTest
- @coversDefaultClass \Drupal\feeds\Controller\SubscriptionController @group feeds
Namespace
Drupal\Tests\feeds\Unit\ControllerCode
public function testReceive() {
$payload = 'abcdefg';
$sig = hash_hmac('sha1', $payload, 'secret');
$request = new Request([], [], [], [], [], [], $payload);
$request->headers
->set('X-Hub-Signature', 'sha1=' . $sig);
$this->subscription
->checkSignature($sig, $payload)
->willReturn(TRUE);
$response = $this->controller
->receive($this->subscription
->reveal(), 'valid_token', $request);
$this
->assertSame(200, $response
->getStatusCode());
}