Requirements:
- File's extension is accepted
- File can be matched to filesystem
- File is not currently on the stack
public isStackable ( Bolt\Filesystem\Handler\FileInterface | string $filename ) : boolean | ||
$filename | Bolt\Filesystem\Handler\FileInterface | string | |
return | boolean |
public function testSetup() { $app = $this->getApp(); $users = $this->getMock('Bolt\\Users', array('getCurrentUser', 'saveUser'), array($app)); $app['users'] = $users; $stack = new Stack($app); $stack->add('mytestfile'); $this->assertTrue($stack->isOnStack('mytestfile')); $stack->delete('mytestfile'); $this->assertFalse($stack->isOnStack('mytestfile')); $this->assertFalse($stack->isStackable('mytestfile')); $this->assertTrue($stack->isStackable('mytestfile.png')); }
public function testIsStackable() { $this->assertFalse($this->stack->isStackable('files://a.jpg'), 'Files on stack should not be stackable'); $this->assertFalse($this->stack->isStackable('files://non_existent_file.txt'), 'Non existent files should not be stackable'); $this->assertFalse($this->stack->isStackable('files://evil.exe'), 'Unaccepted file extensions should not be stackable'); }