Navigation Menu

Skip to content

Commit

Permalink
Add some basic integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Jenkins committed Mar 8, 2016
1 parent b432a6e commit 4620f98
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -5,7 +5,7 @@
"require": {
"php": ">=5.4.0",
"league/flysystem": "^1.0",
"knplabs/gaufrette": "^0.2.1"
"knplabs/gaufrette": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
Expand Down
5 changes: 5 additions & 0 deletions phpunit.xml
Expand Up @@ -13,6 +13,11 @@
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>integration</group>
</exclude>
</groups>
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
Expand Down
63 changes: 63 additions & 0 deletions tests/integration/GaufretteLocalAdapterTest.php
@@ -0,0 +1,63 @@
<?php

/**
* @group integration
*/
class GaufretteLocalAdapterTest extends PHPUnit_Framework_TestCase
{
private $local;

protected function setUp()
{
$this->local = new \Jenko\Flysystem\GaufretteAdapter(
new \Gaufrette\Adapter\Local(__DIR__ . '/resources')
);
}

protected function tearDown()
{
array_map('unlink', glob(__DIR__ . '/resources/*'));
}

public function testLocalAdapter()
{
$filesystem = new \League\Flysystem\Filesystem($this->local);

$written = $filesystem->write('test.txt', 'foo');
$this->assertTrue($written);

$data = $filesystem->read('test.txt');

$this->assertEquals('foo', $data);
}

public function testHadouken()
{
$local = new \Jenko\Flysystem\GaufretteAdapter(
new \Gaufrette\Adapter\Flysystem(
new \Jenko\Flysystem\GaufretteAdapter(
new \Gaufrette\Adapter\Flysystem(
new \Jenko\Flysystem\GaufretteAdapter(
new \Gaufrette\Adapter\Flysystem(
new \Jenko\Flysystem\GaufretteAdapter(
new \Gaufrette\Adapter\Local(
__DIR__ . '/resources'
)
)
)
)
)
)
)
);

$filesystem = new \League\Flysystem\Filesystem($local);

$written = $filesystem->write('test.txt', 'foo');
$this->assertTrue($written);

$data = $filesystem->read('test.txt');

$this->assertEquals('foo', $data);
}
}

0 comments on commit 4620f98

Please sign in to comment.