This commit is contained in:
Xes
2025-08-14 22:41:49 +02:00
parent 2de81ccc46
commit 8ce45119b6
39774 changed files with 4309466 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace spec\Gaufrette\Util;
use PhpSpec\ObjectBehavior;
class ChecksumSpec extends ObjectBehavior
{
function let()
{
file_put_contents($this->getTestFilePath(), 'some other content');
}
function letGo()
{
@unlink($this->getTestFilePath());
}
function it_calculates_checksum_from_content()
{
$this->fromContent('some content')
->shouldReturn(md5('some content'))
;
}
function it_calculates_checksum_from_filepath()
{
$this->fromFile($this->getTestFilePath())
->shouldReturn(md5('some other content'))
;
}
private function getTestFilePath(): string
{
return __DIR__ . DIRECTORY_SEPARATOR . 'testFile';
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace spec\Gaufrette\Util;
use PhpSpec\ObjectBehavior;
class PathSpec extends ObjectBehavior
{
function it_checks_if_path_is_absolute()
{
$this->isAbsolute('/home/path')->shouldBe(true);
$this->isAbsolute('home/path')->shouldBe(false);
$this->isAbsolute('../home/path')->shouldBe(false);
$this->isAbsolute('protocol://home/path')->shouldBe(true);
}
function it_normalizes_file_path()
{
$this->normalize('C:\\some\other.txt')->shouldReturn('c:/some/other.txt');
$this->normalize('..\other.txt')->shouldReturn('../other.txt');
$this->normalize('..\other.txt')->shouldReturn('../other.txt');
$this->normalize('/home/other/../new')->shouldReturn('/home/new');
$this->normalize('/home/other/./new')->shouldReturn('/home/other/new');
$this->normalize('protocol://home/other.txt')->shouldReturn('protocol://home/other.txt');
}
function it_returns_unix_style_dirname()
{
$this->dirname('a/test/path')->shouldReturn('a/test');
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace spec\Gaufrette\Util;
use PhpSpec\ObjectBehavior;
class SizeSpec extends ObjectBehavior
{
function it_calculates_size_of_content()
{
$this->fromContent('some content')->shouldReturn(12);
$this->fromContent('some other content')->shouldReturn(18);
$this->fromContent('some')->shouldReturn(4);
}
}