You are here

class CacheTest in Render cache 7.2

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

Hierarchy

  • class \Drupal\render_cache\Tests\Cache\CacheTest extends \Drupal\render_cache\Tests\Cache\PHPUnit_Framework_TestCase

Expanded class hierarchy of CacheTest

File

tests/src/Cache/CacheTest.php, line 18
Contains \Drupal\render_cache\Tests\Cache\CacheTest

Namespace

Drupal\render_cache\Tests\Cache
View source
class CacheTest extends \PHPUnit_Framework_TestCase {

  /**
   * Tests ::keyFromQuery() method.
   * @covers ::keyFromQuery()
   */
  public function test_keyFromQuery() {
    $query = Mockery::mock('\\SelectQueryInterface');
    $query
      ->shouldReceive('preExecute')
      ->once();
    $query
      ->shouldReceive('getArguments')
      ->once()
      ->andReturn(array(
      ':foo' => 'bar',
    ));
    $query
      ->shouldReceive('__toString')
      ->once()
      ->andReturn('SELECT * from {node} WHERE nid = :foo');
    $this
      ->assertEquals('46387e3c7711dfd22bf707bcd79fe77bd652741b9b53a7adeb9be32fa3e010bb', Cache::keyFromQuery($query), 'Key from query returns the right hash.');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheTest::test_keyFromQuery public function Tests ::keyFromQuery() method. @covers ::keyFromQuery()