From 4620f98b10b25a2bc3ab51f367a7a26073beb3db Mon Sep 17 00:00:00 2001 From: Ian Jenkins Date: Tue, 8 Mar 2016 09:59:49 +0000 Subject: [PATCH] Add some basic integration tests --- composer.json | 2 +- phpunit.xml | 5 ++ .../integration/GaufretteLocalAdapterTest.php | 63 +++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 tests/integration/GaufretteLocalAdapterTest.php diff --git a/composer.json b/composer.json index d4ff71d..1f5110c 100644 --- a/composer.json +++ b/composer.json @@ -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" diff --git a/phpunit.xml b/phpunit.xml index dd756b6..b72ea71 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -13,6 +13,11 @@ ./tests/ + + + integration + + ./src/ diff --git a/tests/integration/GaufretteLocalAdapterTest.php b/tests/integration/GaufretteLocalAdapterTest.php new file mode 100644 index 0000000..a03979e --- /dev/null +++ b/tests/integration/GaufretteLocalAdapterTest.php @@ -0,0 +1,63 @@ +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); + } +}