function testGetPath() { $pg = new REU_Ecosystems_PathGenerator($this->datastore); $f = new PSU_Model_FormFile(); $f->filemanager(); $m = new PSU_Model(); $this->assertEquals('pretty.jpg', $this->get_filename($this->field)); }
function testNoFilename() { $pathgenerator = $this->getMock('PSU_Model_FormFile_PathGenerator'); $pathgenerator->expects($this->any())->method('get_path')->will($this->returnValue(null)); $manager = new PSU_Model_FormFile_FileManager($pathgenerator); $manager->base_url = 'http://example.com/downloads'; $manager->upload_dir = '/path/to/uploads'; $field = new PSU_Model_FormFile(); $field->filemanager($manager); $this->assertEquals(null, $field->filename(), 'full path'); $this->assertEquals(null, $field->filename(PSU_Model_FormFile_FileManager::PATH_PARTIAL), 'partial path'); $this->assertEquals(null, $field->filename(PSU_Model_FormFile_FileManager::PATH_FILENAME), 'filename'); $this->assertEquals(null, $field->url()); }