public function testFileSystemRead() { $config = array('default' => array('adapter' => 'File', 'filters' => array(), 'path' => $this->tmpPath)); FileSystem::config($config); $result = FileSystem::config(); $this->assertEqual($config, $result); $filename = 'test_file'; $data = 'Some Test content'; $result = FileSystem::write('default', $filename, $data); $this->assertTrue($result); $result = FileSystem::read('default', $filename); $this->assertEqual($data, $result); }
public function testFileSystemRead() { $config = array('default' => array('adapter' => '\\li3_filesystem\\tests\\mocks\\adapter\\storage\\filesystem\\Mock', 'filters' => array(), 'path' => '/whatever/we/need')); FileSystem::config($config); $result = FileSystem::config(); $this->assertEqual($config, $result); $filename = 'test_file'; $data = 'Some Test content'; $result = FileSystem::write('default', $filename, $data); $this->assertTrue($result); $result = FileSystem::read('default', $filename); $this->assertEqual($data, $result); }
<?php /** * Lithium Filesystem: managing file uploads the easy way * * @copyright Copyright 2012, Little Boy Genius (http://www.littleboygenius.org) * @license http://opensource.org/licenses/bsd-license.php The BSD License */ use li3_filesystem\extensions\storage\FileSystem; use lithium\core\Libraries; FileSystem::config(array('default' => array('adapter' => 'File', 'strategies' => array('FileUpload' => array('allowed' => array('png', 'jpg'))), 'path' => Libraries::get(true, 'path') . '/webroot/img')));