<?php
namespace spec\Typesaucer\Cachebuster;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
class CachebusterSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType('Typesaucer\Cachebuster\Cachebuster');
}
function it_returns_itself_when_in_a_local_environment_with_css()
{
return $this->fire('css/style.css', 'local')->shouldReturn('css/style.css');
}
function it_returns_a_random_string_of_eight_characters()
{
return $this->randomString()->shouldMatch('/^[\w\d]{8}$/');
}
function it_returns_the_current_build_name_if_it_exists()
{
$arrayOfMockedFilenames = ['.','..','.DS_store','style.dshfshcd.css'];
return $this->getBuildFilename($arrayOfMockedFilenames)->shouldMatch('/^style\.[\w\d]{8}\.css$/');
}
function it_returns_false_if_no_build_name_exists()
{
$arrayOfMockedFilenames = ['.','..','.DS_store'];
return $this->getBuildFilename($arrayOfMockedFilenames)->shouldBe(false);
}
}