function ResponseTest::testGetResponseWithoutResponse in Payment 8.2
@covers ::getResponse
File
- tests/
src/ Unit/ Response/ ResponseTest.php, line 81
Class
- ResponseTest
- @coversDefaultClass \Drupal\payment\Response\Response
Namespace
Drupal\Tests\payment\Unit\ResponseCode
function testGetResponseWithoutResponse() {
$generated_url = new GeneratedUrl();
$generated_url
->setGeneratedUrl($this
->randomMachineName());
$generated_url
->addCacheTags([
'node:1',
]);
$url_generator = $this
->createMock(UrlGeneratorInterface::class);
$url_generator
->expects($this
->atLeastOnce())
->method('generateFromRoute')
->with($this->routeName)
->willReturn($generated_url);
$container = new ContainerBuilder();
$container
->set('url_generator', $url_generator);
\Drupal::setContainer($container);
$this->sut = new Response($this->redirectUrl);
$response = $this->sut
->getResponse();
$this
->assertInstanceOf(TrustedRedirectResponse::class, $response);
$this
->assertEquals([
'node:1',
], $response
->getCacheableMetadata()
->getCacheTags());
}