You are here

public function RenderStackTest::test_basicRecursion in Render cache 7.2

Basic tests for recursive functions.

@covers ::increaseRecursion() @covers ::decreaseRecursion() @covers ::getRecursionLevel() @covers ::isRecursive()

File

tests/src/Cache/RenderStackTest.php, line 75
Contains \Drupal\render_cache\Tests\Cache\RenderStackTest

Class

RenderStackTest
@coversDefaultClass \Drupal\render_cache\Cache\RenderStack @group cache

Namespace

Drupal\render_cache\Tests\Cache

Code

public function test_basicRecursion() {
  $this
    ->assertFalse($this->renderStack
    ->isRecursive(), 'isRecursive() is FALSE at the beginning.');
  $this->renderStack
    ->increaseRecursion();
  $this
    ->assertTrue($this->renderStack
    ->isRecursive(), 'isRecursive() is TRUE after increase.');
  $this
    ->assertEquals(1, $this->renderStack
    ->getRecursionLevel(), 'Recursion Level is 1 after increase.');
  $this->renderStack
    ->decreaseRecursion();
  $this
    ->assertFalse($this->renderStack
    ->isRecursive(), 'isRecursive() is FALSE at the end.');
  $this
    ->assertEquals(0, $this->renderStack
    ->getRecursionLevel(), 'Recursion Level is 0 after increase and decrease.');
}