protected function doDelete($itemId, $hash, $type) { $item = $this->uploadDao->getItemTreeBounds($itemId, $this->uploadtree_tablename); $cpTable = $this->getTableName($type); $this->copyrightDao->updateTable($item, $hash, '', Auth::getUserId(), $cpTable); return new Response('Successfully deleted', Response::HTTP_OK, array('Content-type' => 'text/plain')); }
public function testDeleteCopyright() { $this->setUpClearingTables(); $uploadDao = M::mock('Fossology\\Lib\\Dao\\UploadDao'); $copyrightDao = new CopyrightDao($this->dbManager, $uploadDao); $initialEntries = $copyrightDao->getAllEntries("copyright", 1, "uploadtree_a"); $initialCount = count($initialEntries); $item = new ItemTreeBounds(6, 'uploadtree_a', 1, 17, 18); $hash2 = '0x3a910990f114f12f'; $copyrightDao->updateTable($item, $hash2, $content = '', 55); $remainingEntries = $copyrightDao->getAllEntries("copyright", 1, "uploadtree_a"); $remainingCount = count($remainingEntries); assertThat($remainingCount, is(equalTo($initialCount - 1))); }