Elgg\EntityIconServiceTest::setUp PHP Method

setUp() public method

public setUp ( )
    public function setUp()
    {
        _elgg_filestore_init();
        // we will need simpletype hook to work
        $this->hooks = new \Elgg\PluginHooksService();
        $path_key = \Elgg\Application::GET_PATH_KEY;
        $this->request = \Elgg\Http\Request::create("?{$path_key}=action/upload");
        $this->logger = new \Elgg\Logger($this->hooks, $this->config(), new \Elgg\Context());
        $this->setupMockServices(false);
        $this->entities = _elgg_services()->entityTable;
        $this->user = $this->mocks()->getUser();
        $this->entity = $this->mocks()->getObject(['owner_guid' => $this->user->guid, 'subtype' => 'foo']);
        $dir = (new \Elgg\EntityDirLocator($this->entity->guid))->getPath();
        $this->entity_dir_path = $this->config()->get('dataroot') . $dir;
        if (is_dir($this->entity_dir_path)) {
            _elgg_rmdir($this->entity_dir_path);
        }
        $dir = (new \Elgg\EntityDirLocator($this->entity->owner_guid))->getPath();
        $this->owner_dir_path = $this->config()->get('dataroot') . $dir;
        if (is_dir($this->owner_dir_path)) {
            _elgg_rmdir($this->owner_dir_path);
        }
        // Needed to test elgg_get_inline_url()
        $session = \ElggSession::getMock();
        _elgg_services()->setValue('session', $session);
        _elgg_services()->session->start();
    }