You are here

public function SubscriptionControllerTest::testReceiveBadSig in Feeds 8.3

@covers ::receive

File

tests/src/Unit/Controller/SubscriptionControllerTest.php, line 235

Class

SubscriptionControllerTest
@coversDefaultClass \Drupal\feeds\Controller\SubscriptionController @group feeds

Namespace

Drupal\Tests\feeds\Unit\Controller

Code

public function testReceiveBadSig() {
  $payload = 'abcdefg';
  $sig = 'oops';
  $request = new Request([], [], [], [], [], [], $payload);
  $request->headers
    ->set('X-Hub-Signature', 'sha1=' . $sig);
  $this->subscription
    ->checkSignature($sig, $payload)
    ->willReturn(FALSE);
  $this
    ->expectException(NotFoundHttpException::class);
  $this->controller
    ->receive($this->subscription
    ->reveal(), 'valid_token', $request);
}