/** * Make the "from cms" folder use the saved folder * * @param int $parentID */ public function updateAttachParentID(&$parentID) { // If given assume that a folder has been posted if ($parentID) { FolderDropdownField::set_last_folder($parentID); } else { $parentID = FolderDropdownField::get_last_folder(); } }
/** * Tests that files that do exist correctly return true */ public function testFilesDoExist() { $this->loginWithPermission('ADMIN'); $folder1 = $this->objFromFixture('Folder', 'folder1'); $folder2 = $this->objFromFixture('Folder', 'folder2'); // Check that sub-folder non-file isn't found $responseRoot = $this->mockFileExists('FirstFile', 'file1.txt', $folder1->ID); $responseRootData = json_decode($responseRoot->getBody()); $this->assertFalse($responseRoot->isError()); $this->assertTrue($responseRootData->exists); $this->assertEquals(FolderDropdownField::get_last_folder(), $folder1->ID); // Check that second level sub-folder non-file isn't found $responseRoot = $this->mockFileExists('FirstFile', 'file2.txt', $folder2->ID); $responseRootData = json_decode($responseRoot->getBody()); $this->assertFalse($responseRoot->isError()); $this->assertTrue($responseRootData->exists); $this->assertEquals(FolderDropdownField::get_last_folder(), $folder2->ID); }