Files
content/test/Unit/CacheControlTest.php

51 lines
1.1 KiB
PHP

<?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);
}
}