/** * Sets the AJAX parameter from the current request. * * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event * The response event, which contains the current request. */ public function onRequest(GetResponseEvent $event) { // Pass to the Html class that the current request is an Ajax request. if ($event->getRequest()->request->get(static::AJAX_REQUEST_PARAMETER)) { Html::setIsAjax(TRUE); } }
/** * Tests the Html::getUniqueId() method. * * @param string $expected * The expected result. * @param string $source * The string being transformed to an ID. * * @dataProvider providerTestHtmlGetId * * @covers ::getId */ public function testHtmlGetId($expected, $source) { Html::setIsAjax(FALSE); $this->assertSame($expected, Html::getId($source)); }