public function test_upload_timeout() { $type_remote = new \phpbb\files\types\remote($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); $upload->set_allowed_extensions(array('png')); $type_remote->set_upload($upload); $upload->upload_timeout = -5; $file = $type_remote->upload('http://google.com/.png'); $this->assertSame(array('REMOTE_UPLOAD_TIMEOUT'), $file->error); }
/** * @dataProvider data_get_max_file_size */ public function test_get_max_file_size($max_file_size, $link, $expected = array('URL_NOT_FOUND')) { $php_ini = $this->getMock('\\bantu\\IniGetWrapper\\IniGetWrapper', array('getString')); $php_ini->expects($this->any())->method('getString')->willReturn($max_file_size); $type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $this->language, $php_ini, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); $upload->set_allowed_extensions(array('png')); $type_remote->set_upload($upload); $file = $type_remote->upload($link); $this->assertSame($expected, $file->error); }