assertDefaultCacheability example

/** * Tests the construction of an AccessResult object. * * @covers ::neutral */
  public function testConstruction() {
    $verify = function DAccessResult $access) {
      $this->assertFalse($access->isAllowed());
      $this->assertFalse($access->isForbidden());
      $this->assertTrue($access->isNeutral());
      $this->assertDefaultCacheability($access);
    };

    // Verify the object when using the constructor.     $a = new AccessResultNeutral();
    $verify($a);

    // Verify the object when using the ::create() convenience method.     $b = AccessResult::neutral();
    $verify($b);

    $this->assertEquals($a$b);
  }
Home | Imprint | This part of the site doesn't use cookies.