public function TransactionNameEnhancerTest::testEnhance in New Relic 8
Same name and namespace in other branches
- 2.x tests/src/Unit/RouteEnhancer/TransactionNameEnhancerTest.php \Drupal\Tests\new_relic_rpm\Unit\RouteEnhancer\TransactionNameEnhancerTest::testEnhance()
- 2.0.x tests/src/Unit/RouteEnhancer/TransactionNameEnhancerTest.php \Drupal\Tests\new_relic_rpm\Unit\RouteEnhancer\TransactionNameEnhancerTest::testEnhance()
@covers ::enhance
File
- tests/
src/ Unit/ RouteEnhancer/ TransactionNameEnhancerTest.php, line 33
Class
- TransactionNameEnhancerTest
- @coversDefaultClass \Drupal\new_relic_rpm\RouteEnhancer\TransactionNameEnhancer @group new_relic_rpm
Namespace
Drupal\Tests\new_relic_rpm\Unit\RouteEnhancerCode
public function testEnhance() {
$request = new Request();
$callback = [
self::class,
'transactionNameCallback',
];
$controller_resolver = $this
->prophesize(ControllerResolverInterface::class);
$controller_resolver
->getControllerFromDefinition($callback)
->willReturn($callback);
$argument_resolver = $this
->prophesize(ArgumentResolverInterface::class);
$argument_resolver
->getArguments(Argument::type(Request::class), $callback)
->willReturn([]);
$enhancer = new TransactionNameEnhancer($controller_resolver
->reveal(), $argument_resolver
->reveal());
$defaults = [
RouteObjectInterface::ROUTE_OBJECT => new Route('/foo', [
'_transaction_name_callback' => $callback,
]),
];
$defaults = $enhancer
->enhance($defaults, $request);
$this
->assertEquals('foo_resolved', $defaults['_transaction_name']);
}