You are here

public function CommentStatisticsUnitTest::fetchObjectCallback in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 114
Contains \Drupal\Tests\comment\Unit\CommentStatisticsUnitTest.

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';
      break;
    case 2:
      return 'something-else';
      break;
    default:
      return FALSE;
      break;
  }
}