Initial commit IQParts\Content
This commit is contained in:
51
test/Unit/CacheControlTest.php
Normal file
51
test/Unit/CacheControlTest.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace IQParts\ContentTest\Unit;
|
||||
|
||||
use IQParts\Content\Object\CacheControl;
|
||||
use IQParts\ContentTest\AbstractTestCase;
|
||||
|
||||
/**
|
||||
* Class CacheControlTest
|
||||
* @package IQParts\ContentTest\Unit
|
||||
*/
|
||||
final class CacheControlTest extends AbstractTestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function testCacheControlWithSeconds()
|
||||
{
|
||||
$cacheControl = new CacheControl(CacheControl::MAX_AGE, 10);
|
||||
|
||||
$this->assertEquals('max-age=10', (string)$cacheControl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function testCacheControlWithoutSeconds()
|
||||
{
|
||||
$cacheControl = new CacheControl(CacheControl::PRIVATE);
|
||||
|
||||
$this->assertEquals('private', (string)$cacheControl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function testCacheControlWithInvalidSeconds()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new CacheControl(CacheControl::MAX_AGE, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function testCacheControlWithInvalidMode()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new CacheControl(-1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user