static function find($searchId) { $brands_returned = Brand::getAll(); foreach ($brands_returned as $brand) { if ($searchId == $brand->getId()) { return $brand; } } }
static function find($id) { $db_brands = Brand::getAll(); foreach ($db_brands as $brand) { if ($id == $brand->getId()) { return $brand; } } return null; }
function testGetAll() { $name = "LuLus"; $test_brand = new Brand($name); $test_brand->save(); $name2 = "Barts"; $test_brand2 = new Brand($name); $test_brand2->save(); $result = Brand::getAll(); $this->assertEquals([$test_brand, $test_brand2], $result); }
static function find($search_id) { $found_brand = null; $all_brands = Brand::getAll(); foreach ($all_brands as $brand) { if ($brand->getId() == $search_id) { $found_brand = $brand; } } return $found_brand; }
function testGetAll() { $brand_name = "Air Jordan"; $test_brand = new Brand($brand_name); $test_brand->save(); $brand_name2 = "Nike"; $test_brand2 = new Brand($brand_name2); $test_brand2->save(); $result = Brand::getAll(); $this->assertEquals([$test_brand, $test_brand2], $result); }
function test_delete() { $name = "Nike"; $test_brand = new Brand($name, $id); $test_brand->save(); $name2 = "Adidas"; $test_brand2 = new Brand($name2, $id); $test_brand2->save(); $test_brand->delete(); $this->assertEquals([$test_brand2], Brand::getAll()); }
function test_deleteAll() { //Arrange $brand_name = "Nike"; $test_brand = new Brand($brand_name); $test_brand->save(); //Act Brand::deleteAll(); $result = $test_brand->getAll(); //Assert $this->assertEquals([], $result); }
static function find($search_id) { $found_store = null; $brands = Brand::getAll(); foreach ($brands as $store) { $store_id = $store->getId(); if ($store_id == $search_id) { $found_store = $store; } } return $found_store; }
static function findByName($search_name) { $found_brand = null; $brands = Brand::getAll(); foreach ($brands as $brand) { $brand_name = $brand->getName(); if ($brand_name == $search_name) { $found_brand = $brand; } } return $found_brand; }
function test_delete() { $test_name = "Helmut Lang"; $test_id = 1; $test_brand = new Brand($test_name, $test_id); $test_brand->save(); $test_name2 = "Y-3"; $test_id2 = 2; $test_brand2 = new Brand($test_name2, $test_id2); $test_brand2->save(); $test_brand->delete(); $result = Brand::getAll(); $this->assertEquals([$test_brand2], $result); }
static function find($search_id) { $found = null; $brands = Brand::getAll(); foreach ($brands as $brand) { $brand_id = $brand->getId(); if ($brand_id == $search_id) { $found = $brand; } //end of if } //end foreach return $found; }
public function download() { header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Content-type: application/json'); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=findguidelines.json'); header('Content-Transfer-Encoding: binary'); header('Connection: Keep-Alive'); header('Pragma: public'); $brands = Brand::getAll(); echo json_encode($brands); }
function testDeleteAll() { //Arrange $brand_name = "Super Kicks"; $test_brand = new Brand($brand_name); $test_brand->save(); $brand_name2 = "Cool Shoes"; $test_brand2 = new Brand($brand_name2); $test_brand->save(); //Act Brand::deleteAll(); $result = Brand::getAll(); //Assert $this->assertEquals([], $result); }
function test_delete() { //Arrange $name = "Nike"; $test_brand = new Brand($name); $test_brand->save(); $name2 = "Adidas"; $test_brand2 = new Brand($name2); $test_brand2->save(); //Act $test_brand->delete(); $result = Brand::getAll(); //Assert $this->assertEquals([$test_brand2], $result); }
function testDeleteBrand() { //Arrange $brand_name = "Sketchers"; $test_brand = new Brand($brand_name); $test_brand->save(); $another_brand = "Doc Martin"; $test_brand2 = new Brand($another_brand); $test_brand2->save(); //Act $test_brand->delete(); $result = Brand::getAll(); //Assert $this->assertEquals([$test_brand2], $result); }
function testDeleteAll() { //Arrange $name = "Brand 1"; $test_brand = new Brand($name); $test_brand->save(); $name2 = "Brand 2"; $test_brand2 = new Brand($name2); $test_brand2->save(); //Act Brand::deleteAll(); $result = Brand::getAll(); //Assert $this->assertEquals([], $result); }
function test_deleteAll() { //Arrange $name = "Crocs"; $test_brand = new Brand($name); $test_brand->save(); $name2 = "Doc Martins"; $test_brand2 = new Brand($name); $test_brand2->save(); //Act Brand::deleteAll(); //Assert $result = Brand::getAll(); $this->assertEquals([], $result); }
function testDeleteAll() { //Arrange $id = null; $brand_name = "Nike"; $test_brand = new Brand($id, $brand_name); $test_brand->save(); $brand_name2 = "Salamon"; $test_brand2 = new Brand($id, $brand_name); $test_brand2->save(); //Act Brand::deleteAll(); //Assert $result = Brand::getAll(); $this->assertEquals([], $result); }
function testDeleteAll() { //Arrange $name = "Nike"; $id = 1; $test_brand = new Brand($name, $id); $test_brand->save(); $name2 = "Adidas"; $id2 = 1; $test_brand2 = new Brand($name2, $id2); $test_brand2->save(); //Act Brand::deleteAll(); $result = Brand::getAll(); //Assert $this->assertEquals([], $result); }
function test_brand_deleteAll() { //Arrange $brand_name = "Nike"; $id1 = 1; $test_brand = new Brand($brand_name, $id1); $test_brand->save(); $brand_name2 = "Converse"; $id2 = 2; $test_brand2 = new Brand($brand_name2, $id2); $test_brand2->save(); //Act Brand::deleteAll(); //Assert $result = Brand::getAll(); $this->assertEquals([], $result); }
return $app['twig']->render('brand_edit.html.twig', array('brand' => $brand)); }); $app->patch("/store/{id}", function ($id) use($app) { $store = Store::find($id); $store->update($_POST['name']); return $app['twig']->render('store.html.twig', array('store' => $store, 'brands' => $store->getBrands(), 'all_brands' => Brand::getAll())); }); $app->patch("/brand/{id}", function ($id) use($app) { $brand = Brand::find($id); $brand->update($_POST['name']); return $app['twig']->render('brand.html.twig', array('brand' => $brand, 'stores' => $brand->getStores(), 'all_stores' => Store::getAll())); }); $app->delete("/store/{id}", function ($id) use($app) { $store = Store::find($id); $store->delete(); return $app['twig']->render('stores.html.twig', array('stores' => Store::getAll())); }); $app->delete("/brand/{id}", function ($id) use($app) { $brand = Brand::find($id); $brand->delete(); return $app['twig']->render('brands.html.twig', array('brands' => Brand::getAll())); }); $app->post("/delete_brands", function () use($app) { Brand::deleteAll(); return $app['twig']->render('index.html.twig'); }); $app->post("/delete_stores", function () use($app) { Store::deleteAll(); return $app['twig']->render('index.html.twig'); }); return $app;
function testDeleteAll() { // Arrange $name = "Babbling Brooks"; $test_Brand = new Brand($name); $test_Brand->save(); $name2 = "Old Balance"; $test_Brand2 = new Brand($name2); $test_Brand2->save(); // Act Brand::deleteAll(); $result = Brand::getAll(); // Assert $this->assertEquals([], $result); }
function testDeleteAll() { //Arrange $brand_name = "Feiyue"; $test_brand = new Brand($brand_name, $id = null); $test_brand->save(); $brand_name2 = "Kailai"; $test_brand2 = new Brand($brand_name2, $id = null); $test_brand2->save(); //Act Brand::deleteAll(); //Assert $result = Brand::getAll(); $this->assertEquals([], $result); }
function testgetAll() { //Arrange $name = "rebook"; $id = 1; $test_brand = new Brand($name, $id); $test_brand->save(); $name2 = "assidas"; $id2 = 2; $test_brand2 = new Brand($name2, $id2); $test_brand2->save(); //Act $result = Brand::getAll(); //Assert $this->assertEquals([$test_brand, $test_brand2], $result); }
function test_deleteAll() { $brand_name = "La Sportiva"; $test_brand = new Brand($brand_name); $test_brand->save(); $brand_name2 = "Evolv"; $test_brand2 = new Brand($brand_name2); $test_brand2->save(); //Act Brand::deleteAll(); $result = Brand::getAll(); //Assert $this->assertEquals([], $result); }
}); $app->get('/store/{id}', function ($id) use($app) { $store = Store::find($id); return $app['twig']->render('store_edit.html.twig', array('store' => $store)); }); $app->patch('/stores/{id}', function ($id) use($app) { $store = Store::find($id); $store->update($_POST['name']); $brands = $store->getBrands(); $all_brands = Brand::getAll(); return $app['twig']->render('stores.html.twig', array('store' => $store, 'brands' => $brands, 'all_brands' => $all_brands)); }); $app->delete('/stores/{id}', function ($id) use($app) { $store = Store::find($id); $store->delete(); return $app['twig']->render('index.html.twig', array('stores' => Store::getAll(), 'brands' => Brand::getAll())); }); $app->get('/brands/{id}', function ($id) use($app) { $brand = Brand::find($id); $stores = $brand->getStores(); $all_stores = Store::getAll(); return $app['twig']->render('brands.html.twig', array('brand' => $brand, 'stores' => $stores, 'all_stores' => $all_stores)); }); $app->post('/add_stores', function () use($app) { $brand = Brand::find($_POST['brand_id']); $store = Store::find($_POST['store_id']); $brand->addStore($store); $stores = $brand->getStores(); $all_stores = Store::getAll(); return $app['twig']->render('brands.html.twig', array('brand' => $brand, 'stores' => $stores, 'all_stores' => $all_stores)); });
public function brands() { if (!empty($_GET['s'])) { switch ($_GET['s']) { case 'submission': $this->set('brands', Brand::getBrandByStatus(Brand::STATUS_SUBMITTED)); break; case 'published': $this->set('brands', Brand::getBrandByStatus(Brand::STATUS_PUBLISHED)); break; case 'rejected': $this->set('brands', Brand::getBrandByStatus(Brand::STATUS_REJECTED)); break; default: break; } } else { $this->set('brands', Brand::getAll()); } $this->render('administration/brands'); }
function testDelete() { //Arrange $brand_name = "Nike"; $id = 1; $test_brand = new Brand($brand_name, $id); $test_brand->save(); $brand_name2 = "Reebok"; $id2 = 2; $test_brand2 = new Brand($brand_name2, $id2); $test_brand2->save(); //Act $test_brand->delete(); //Assert $this->assertEquals([$test_brand2], Brand::getAll()); }
$app->post("/delete_brands", function () use($app) { Brand::deleteAll(); return $app['twig']->render('brands.html.twig', array('brands' => Brand::getAll())); }); //POSTS (ADDS) $app->post("/add_stores", function () use($app) { $store = Store::find($_POST['store_id']); $brand = Brand::find($_POST['brand_id']); $brand->addStore($store); return $app['twig']->render('brand.html.twig', array('brand' => $brand, 'brands' => Brand::getAll(), 'stores' => $brand->getStores(), 'all_stores' => Store::getAll())); }); $app->post("/add_brands", function () use($app) { $store = Store::find($_POST['store_id']); $brand = Brand::find($_POST['brand_id']); $store->addBrand($brand); return $app['twig']->render('store.html.twig', array('store' => $store, 'stores' => Store::getAll(), 'brands' => $store->getBrands(), 'all_brands' => Brand::getAll())); }); //GET AND EDIT AND DELETE STORE ROUTE $app->get("/stores/{id}/edit", function ($id) use($app) { $store = Store::find($id); return $app['twig']->render('store-edit.html.twig', array('store' => $store, 'brands' => $store->getBrands())); }); $app->patch("/stores/{id}", function ($id) use($app) { $store = Store::find($id); $new_name = $_POST['new_name']; $store->update($new_name); return $app['twig']->render('stores.html.twig', array('store' => $store, 'stores' => Store::getAll(), 'brands' => $store->getBrands())); }); $app->delete("/stores/{id}", function ($id) use($app) { $store = Store::find($id); $store->delete();
function test_delete() { //Arrange $name = "Nike"; $website = "http://www.nike.com"; $test_brand = new Brand($name, $website); $test_brand->save(); $name2 = "Adidas"; $website2 = "http://www.adidas.com"; $test_brand2 = new Brand($name2, $website2); $test_brand2->save(); //Act $test_brand->delete(); //Assert $result = Brand::getAll(); $this->assertEquals([$test_brand2], $result); }