protected function tearDown() { Bar::deleteAll(); Token::deleteAll(); Item::deleteAll(); Patron::deleteAll(); }
public function testShouldDeleteAllCorrectly() { $this->Item->deleteAll(['Item.id' => [1, 3]]); $this->assertEmpty($this->Item->find('all')); $this->Item->includeDeletedRecords(); $item = $this->Item->read(null, 1); $this->assertEqual($item['Item']['description'], ItemFixture::DESCR_DELETED); }
function test_deleteAll() { $name = "Gold Liberty Dollar"; $name2 = "Bronze My Little Pony: Applejack"; $test_Item = new Item(null, $name); $test_Item->save(); $test_Item2 = new Item(null, $name2); $test_Item2->save(); Item::deleteAll(); $result = Item::getAll(); $this->assertEquals([], $result); }
function test_deleteAll() { //Arrange $name = "Hello Kitty"; $name2 = "Pokemon"; $test_Item = new Item($name); $test_Item->save(); $test_Item2 = new Item($name2); $test_Item2->save(); //Act Item::deleteAll(); $result = Item::getAll(); //Assert $this->assertEquals([], $result); }
function testDeleteAll() { //Arrange $collection_name = "Cool stuff"; $test_collection = new Collection($collection_name); $test_collection->save(); $test_collection_id = $test_collection->getId(); $name = "Hello Kitty"; $name2 = "Pokemon"; $test_item = new Item($name, $test_collection_id); $test_item->save(); $test_item2 = new Item($name2, $test_collection_id); $test_item2->save(); //Act Item::deleteAll(); $result = Item::getAll(); //Assert $this->assertEquals([], $result); }
Debug::enable(); $app = new Silex\Application(); // Set Silex debug mode in $app object $app['debug'] = true; $server = 'mysql:host=localhost;dbname=inventory'; $username = '******'; $password = '******'; $DB = new PDO($server, $username, $password); $app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views')); $app->get('/', function () use($app) { return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll())); }); $app->post('/collection', function () use($app) { $collection = new Collection($_POST['name']); $collection->save(); return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll())); }); $app->post('/delete_collections', function () use($app) { Collection::deleteAll(); return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll())); }); $app->post('/item', function () use($app) { $item = new Item($_POST['name']); $item->save(); return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll())); }); $app->post('/delete_items', function () use($app) { Item::deleteAll(); return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll())); }); return $app;
protected function tearDown() { Item::deleteAll(); }
protected function tearDown() { Collection::deleteAll(); Item::deleteAll(); }