AjaxBasePageNegotiator example

protected $requestStack;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->tokenGenerator = $this->prophesize(CsrfTokenGenerator::class);
    $config_factory = $this->getConfigFactoryStub(['system.theme' => ['default' => 'stark']]);
    $this->requestStack = new RequestStack();
    $this->negotiator = new AjaxBasePageNegotiator($this->tokenGenerator->reveal()$config_factory$this->requestStack);
  }

  /** * @covers ::applies * @dataProvider providerTestApplies */
  public function testApplies($request_data$expected) {
    $request = new Request();
    foreach ($request_data as $key => $data) {
      $request->query->set($key$data);
    }
    
Home | Imprint | This part of the site doesn't use cookies.