You are here

public function CommentStatisticsUnitTest::fetchObjectCallback in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/comment/tests/src/Unit/CommentStatisticsUnitTest.php \Drupal\Tests\comment\Unit\CommentStatisticsUnitTest::fetchObjectCallback()

Return value callback for fetchObject() function on mocked object.

Return value

bool|string 'Something' on first, 'something-else' on second and FALSE for the other calls to function.

File

core/modules/comment/tests/src/Unit/CommentStatisticsUnitTest.php, line 110

Class

CommentStatisticsUnitTest
@coversDefaultClass \Drupal\comment\CommentStatistics @group comment

Namespace

Drupal\Tests\comment\Unit

Code

public function fetchObjectCallback() {
  $this->calls_to_fetch++;
  switch ($this->calls_to_fetch) {
    case 1:
      return 'something';
    case 2:
      return 'something-else';
    default:
      return FALSE;
  }
}