Gaufrette/core — pull request #34 by PedroTroller (2014-09-26 14:19:14+00:00)
Title: New FS PoC

```php
function let(FileFactory $factory, Adapter $adapter, File $file)
{
$this->beConstructedWith($adapter, $factory);

$factory->createFile('key')->willReturn($file);

$file->getName()->willReturn('key');
$file->setContent(Argument::any())->willReturn($file);
$file->getContent()->willReturn('file-content');

$adapter->read('key')->willReturn('adapter-content');
$adapter->exists('key')->willReturn(true);
}

function it_is_initializable()
{
$this->shouldHaveType('Gaufrette\Core\Filesystem');
}

function it_return_a_file_by_key(File $file)
{
$this->get('key')->shouldReturn($file);
}

function it_return_file_itself(File $file)
{
$this->get($file)->shouldReturn($file);
}

function it_set_content_of_the_file_from_adapter(Adapter $adapter, File $file)
{
$adapter->read('key')->shouldBeCalled();
$file->setContent('adapter-content')->shouldBeCalled();

$this->get($file);
}

function it_save_file_content_from_file(Adapter $adapter, File $file)
{
$adapter->write('key', 'file-content')->shouldBeCalled();
$file->getContent()->shouldBeCalled();

$this->save($file);
}

function it_test_file_exists(Adapter $adapter, File $file)
{
$adapter->exists('key')->shouldbeCalled();

$this->exists($file)->shouldReturn(true);
}

function it_test_file_doent_exists(Adapter $adapter, File $other)
{
$other->getName()->willReturn('other');
$adapter->exists('other')->willReturn(false)->shouldbeCalled();

$this->exists($other)->shouldReturn(false);
}

function it_test_key_exists(Adapter $adapter)
{
$adapter->exists('key')->shouldbeCalled();

$this->exists('key')->shouldReturn(true);
}

function it_test_key_doent_exists(Adapter $adapter, File $other, FileFactory $factory)
{
$other->getName()->willReturn('other');
$factory->createFile('other')->willReturn($other);
$adapter->exists('other')->willReturn(false)->shouldbeCalled();

$this->exists('other')->shouldReturn(false);
}
```