public function delete($name) { $config = (require ROOT . '/config/main.php'); $gallery = new Gallery(); $gallery->fromJson(ROOT . $config['images']['json']); $gallery->deleteByName($name); F3::reroute('list'); }
public function testDeleteFromFile() { $list = new Gallery(); $list->fromJson(self::$outputDir . self::$jsonName); $item = new GalleryItem("desc", "year", "pathToFull", "pathToThumb"); $this->assertTrue($list->exists($item->getName())); $this->assertTrue($list->deleteByName($item->getName())); $this->assertFalse($list->exists($item->getName())); $list = new Gallery(); $list->fromJson(self::$outputDir . self::$jsonName); $this->assertFalse($list->exists($item->getName())); }