123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace Gaufrette\Functional\Adapter;
- class DoctrineDbalTest extends FunctionalTestCase
- {
- /**
- * @test
- */
- public function shouldListKeys()
- {
- $this->filesystem->write('foo/foobar/bar.txt', 'data');
- $this->filesystem->write('foo/bar/buzz.txt', 'data');
- $this->filesystem->write('foobarbuz.txt', 'data');
- $this->filesystem->write('foo', 'data');
- $allKeys = $this->filesystem->listKeys(' ');
- //empty pattern results in ->keys call
- $this->assertEquals(
- $this->filesystem->keys(),
- $allKeys['keys']
- );
- //these values are canonicalized to avoid wrong order or keys issue
- $keys = $this->filesystem->listKeys('foo');
- $this->assertEquals(
- $this->filesystem->keys(),
- $keys['keys'],
- '', 0, 10, true);
- $keys = $this->filesystem->listKeys('foo/foob');
- $this->assertEquals(
- array('foo/foobar/bar.txt'),
- $keys['keys'],
- '', 0, 10, true);
- $keys = $this->filesystem->listKeys('foo/');
- $this->assertEquals(
- array('foo/foobar/bar.txt', 'foo/bar/buzz.txt'),
- $keys['keys'],
- '', 0, 10, true);
- $keys = $this->filesystem->listKeys('foo');
- $this->assertEquals(
- array('foo/foobar/bar.txt', 'foo/bar/buzz.txt', 'foobarbuz.txt', 'foo'),
- $keys['keys'],
- '', 0, 10, true);
- $keys = $this->filesystem->listKeys('fooz');
- $this->assertEquals(
- array(),
- $keys['keys'],
- '', 0, 10, true);
- }
- }
|