Initial commit IQParts\Content

This commit is contained in:
2018-03-01 18:41:55 +01:00
commit 349fa9c003
23 changed files with 1535 additions and 0 deletions

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