public function SubscriptionControllerTest::testReceiveFeedFailed in Feeds 8.3
@covers ::receive
File
- tests/
src/ Unit/ Controller/ SubscriptionControllerTest.php, line 260
Class
- SubscriptionControllerTest
- @coversDefaultClass \Drupal\feeds\Controller\SubscriptionController @group feeds
Namespace
Drupal\Tests\feeds\Unit\ControllerCode
public function testReceiveFeedFailed() {
$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);
$this->feed
->pushImport($payload)
->willThrow(new \Exception());
$response = $this->controller
->receive($this->subscription
->reveal(), 'valid_token', $request);
$this
->assertSame(500, $response
->getStatusCode());
}