public function testGetToolAll() { list($register, $configs, $container, $storage, $medias, $tags) = $this->getMocks(); $instance = new EditorHandler($register, $configs, $container, $storage, $medias, $tags); $register->shouldReceive('get')->once()->with('editortool')->andReturn(['editortool/foo@bar' => 'class1', 'editortool/baz@qux' => 'class2']); $all = $instance->getToolAll(); $this->assertEquals(['editortool/foo@bar' => 'class1', 'editortool/baz@qux' => 'class2'], $all); }
/** * Get activated tools for the editor * * @return AbstractTool[] */ public function getTools() { if ($this->tools === null) { $this->tools = []; foreach ($this->getActivateToolIds() as $toolId) { if ($tool = $this->editors->getTool($toolId, $this->instanceId)) { $this->tools[] = $tool; } } } return $this->tools; }
/** * file download * * @param EditorHandler $handler editor handler * @param Storage $storage storage * @param string $instanceId instance id * @param string $id * @return void */ public function fileDownload(EditorHandler $handler, Storage $storage, $instanceId, $id) { if (empty($id) || !($file = File::find($id))) { throw new InvalidArgumentException(); } if (Gate::denies('download', new Instance($handler->getPermKey($instanceId)))) { throw new AccessDeniedHttpException(); } $storage->download($file); }