asAn('admin'); $this->setStatusTestingApp(true); } /** @AfterScenario */ public function tearDownScenario() { $this->asAn('admin'); $this->setStatusTestingApp(false); } protected function resetAppConfigs() { } /** * @When /^user "([^"]*)" converts file "([^"]*)" to "([^"]*)"$/ */ public function userConvertsTheSavedFileId(string $user, string $path, string $mime) { $this->userConvertsTheSavedFileIdTo($user, $path, $mime, null); } /** * @When /^user "([^"]*)" converts file "([^"]*)" to "([^"]*)" and saves it to "([^"]*)"$/ */ public function userConvertsTheSavedFileIdTo(string $user, string $path, string $mime, ?string $destination) { try { $fileId = $this->getFileIdForPath($user, $path); } catch (Exception $e) { // return a fake value to keep going and be able to test the error $fileId = 0; } $data = [['fileId', $fileId], ['targetMimeType', $mime]]; if ($destination !== null) { $data[] = ['destination', $destination]; } $this->asAn($user); $this->sendingToWith('post', '/apps/files/api/v1/convert', new TableNode($data)); } }