Skip to content

Commit

Permalink
break it
Browse files Browse the repository at this point in the history
  • Loading branch information
butonic committed Apr 25, 2018
1 parent 224f968 commit 499704b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/lib/Files/Cache/CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,29 +293,35 @@ function testSearch() {
$file1 = 'folder';
$file2 = 'folder/foobar';
$file3 = 'folder/foo';
$file4 = 'folder/f[o.o%ba-r';
$data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder'];
$fileData = [];
$fileData['foobar'] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'];
$fileData['foo'] = ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file'];
$fileData['f[o.o%ba-r'] = ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file'];

$this->cache->put($file1, $data1);
$this->cache->put($file2, $fileData['foobar']);
$this->cache->put($file3, $fileData['foo']);
$this->cache->put($file4, $fileData['f[o.o%ba-r']);

$this->assertCount(2, $this->cache->search('%foo%'));
$this->assertCount(1, $this->cache->search('foo'));
$this->assertCount(1, $this->cache->search('%folder%'));
$this->assertCount(1, $this->cache->search('folder%'));
$this->assertCount(3, $this->cache->search('%'));
$this->assertCount(4, $this->cache->search('%'));

// case insensitive search should match the same files
$this->assertCount(2, $this->cache->search('%Foo%'));
$this->assertCount(1, $this->cache->search('Foo'));
$this->assertCount(1, $this->cache->search('%Folder%'));
$this->assertCount(1, $this->cache->search('Folder%'));

$this->assertCount(3, $this->cache->searchByMime('foo'));
$this->assertCount(2, $this->cache->searchByMime('foo/file'));
$this->assertCount(4, $this->cache->searchByMime('foo'));
$this->assertCount(3, $this->cache->searchByMime('foo/file'));

// oracle uses regexp,
$this->assertCount(1, $this->cache->search('f[o.o%ba-r'));
}

function testSearchByTag() {
Expand Down

0 comments on commit 499704b

Please sign in to comment.