| 1 | <?php |
||
| 17 | class CacheKeyProviderTest extends \PHPUnit_Framework_TestCase { |
||
| 18 | |||
| 19 | use PHPUnitCompat; |
||
| 20 | |||
| 21 | public function testCanConstruct() { |
||
| 22 | |||
| 23 | $this->assertInstanceOf( |
||
| 24 | '\SCI\CacheKeyProvider', |
||
| 25 | new CacheKeyProvider() |
||
| 26 | ); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function testGetKey() { |
||
| 30 | |||
| 31 | $instance = new CacheKeyProvider(); |
||
| 32 | $instance->setCachePrefix( 'foo' ); |
||
| 33 | |||
| 34 | $this->assertContains( |
||
| 35 | 'foo', |
||
| 36 | $instance->getCacheKeyForCitationReference( 'abc' ) |
||
| 37 | ); |
||
| 38 | |||
| 39 | $this->assertContains( |
||
| 40 | ':ref:', |
||
| 41 | $instance->getCacheKeyForCitationReference( 123 ) |
||
| 42 | ); |
||
| 43 | |||
| 44 | $this->assertContains( |
||
| 45 | 'foo', |
||
| 46 | $instance->getCacheKeyForReferenceList( 'def' ) |
||
| 47 | ); |
||
| 48 | |||
| 49 | $this->assertContains( |
||
| 50 | ':reflist:', |
||
| 51 | $instance->getCacheKeyForReferenceList( 456 ) |
||
| 52 | ); |
||
| 53 | } |
||
| 54 | |||
| 55 | } |
||
| 56 |