本文整理汇总了PHP中Brand::getStores方法的典型用法代码示例。如果您正苦于以下问题:PHP Brand::getStores方法的具体用法?PHP Brand::getStores怎么用?PHP Brand::getStores使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Brand
的用法示例。
在下文中一共展示了Brand::getStores方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Brand
function test_removeStores()
{
//Arrange
//Make two test Brands
$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();
//Make two test Stores
$name = "Burchs";
$location = "Oakway Center";
$phone = "5415131122";
$test_store = new Store($name, $location, $phone);
$test_store->save();
$name2 = "Payless ShoeSource";
$location2 = "Valley River Center";
$phone2 = "5415130809";
$test_store2 = new Store($name2, $location2, $phone2);
$test_store2->save();
// Add both stores to second Brand
$test_brand2->addStore($test_store);
$test_brand2->addStore($test_store2);
//Act
$test_brand2->removeStores();
//Assert
$result = $test_brand2->getStores();
$this->assertEquals([], $result);
}
示例2: function
$app->get("/brand_store", function () use($app) {
return $app['twig']->render('brand_store.html.twig', array('brands' => Brand::getAll(), 'display_form' => false));
});
$app->post("/brand/{id}", function ($id) use($app) {
$brand = Brand::find($id);
$store = Store::find($_POST['store_id']);
$brand->addStore($store);
return $app['twig']->render('brand.html.twig', array('brands' => Brand::getAll(), 'brand_stores' => $brand->getStores(), 'display_form' => false, 'all_stores' => Store::getAll()));
});
$app->get("/brand_store_add_form", function () use($app) {
return $app['twig']->render('brand_store.html.twig', array('brands' => Brand::getAll(), 'display_form' => true));
});
$app->post("/add_brand", function () use($app) {
$brand = new Brand($_POST['brand_name']);
$brand->save();
return $app['twig']->render('brand.html.twig', array('brands' => Brand::getAll(), 'brand_stores' => $brand->getStores(), 'display_form' => false, 'all_stores' => Store::getAll()));
});
$app->get("/brand/{id}", function ($id) use($app) {
$brand = Brand::find($id);
return $app['twig']->render('brand.html.twig', array('brands' => Brand::getAll(), 'brand_stores' => $brand->getStores(), 'display_form' => false, 'all_stores' => Store::getAll()));
});
$app->post("/brands/{id}", function ($id) use($app) {
$brand = Brand::find($id);
$store = Store::find($_POST['store_id']);
$brand->addStore($store);
return $app['twig']->render('brand.html.twig', array('brand' => $brand, 'brand_stores' => $brand->getStores(), 'all_stores' => Store::getAll()));
});
$app->get("/store_brand", function () use($app) {
return $app['twig']->render('store_brand.html.twig', array('stores' => Store::getAll(), 'display_form' => false));
});
$app->get("/stores_add_form", function () use($app) {
示例3: Brand
function test_getCourses()
{
//Arrange
$brand_name = "Nike";
$id = null;
$test_brand = new Brand($brand_name, $id);
$test_brand->save();
$store_name = "Nordstrom";
$test_store = new Store($store_name, $id);
$test_store->save();
$store_name2 = "Footlocker";
$test_store2 = new Store($store_name2, $id);
$test_store2->save();
//Act
$test_brand->addStore($test_store->getId());
$test_brand->addStore($test_store2->getId());
//Assert
$this->assertEquals($test_brand->getStores(), [$test_store, $test_store2]);
}
示例4: Store
function test_getStores()
{
//Arrange
$store_name = "Shoe World";
$test_store = new Store($store_name);
$test_store->save();
$brand_name = "La Sportiva";
$test_brand = new Brand($brand_name);
$test_brand->save();
//Act
$test_brand->addStore($test_store);
$result = $test_brand->getStores();
//Assert
$this->assertEquals([$test_store], $result);
}
示例5: Brand
function test_addStore()
{
//Arrange
$brand_name = "Nike";
$test_brand = new Brand($brand_name);
$test_brand->save();
$store_name = "Flying Shoes";
$test_store = new Store($store_name);
$test_store->save();
//Act
$test_brand->addStore($test_store);
//Assert
$this->assertEquals($test_brand->getStores(), [$test_store]);
}
示例6: testGetStores
function testGetStores()
{
// Arrange
$brand_name = "Babbling Brooks";
$test_Brand = new Brand($brand_name);
$test_Brand->save();
$store_name = "Get Your Kicks Co.";
$test_Store = new Store($store_name);
$test_Store->save();
$store_name2 = "I Wanna Run Fast Co.";
$test_Store2 = new Store($store_name2);
$test_Store2->save();
// Act
$test_Brand->addStore($test_Store);
$test_Brand->addStore($test_Store2);
$result = $test_Brand->getStores();
// Assert
$this->assertEquals([$test_Store, $test_Store2], $result);
}
示例7: Brand
function test_getStores()
{
//Arrange
$name = "Crocs";
$test_brand = new Brand($name);
$test_brand->save();
$name = "The Shoe Store";
$location = "432 SW Tootsies Ave";
$phone = "503-555-5555";
$test_store = new Store($name, $location, $phone);
$test_store->save();
$name2 = "Boots n Stuff";
$location2 = "900 WalkAlot Blvd.";
$phone2 = "971-202-0292";
$test_store2 = new Store($name, $location, $phone);
$test_store2->save();
//Act
$test_brand->addStore($test_store);
$test_brand->addStore($test_store2);
//Assert
$result = $test_brand->getStores();
$this->assertEquals([$test_store, $test_store2], $result);
}
示例8: Store
function test_getStores()
{
//Arrange
$id = null;
$store_name = "Fred Meyers";
$test_store = new Store($id, $store_name);
$test_store->save();
$id2 = null;
$store_name2 = "Safeway";
$test_store2 = new Store($id2, $store_name2);
$test_store2->save();
$id3 = null;
$brand_name = "Nike";
$test_brand = new Brand($id3, $brand_name);
$test_brand->save();
$id4 = null;
$brand_name2 = "Vans";
$test_brand2 = new Brand($id4, $brand_name2);
$test_brand2->save();
//Act
$test_brand->addStore($test_store);
$test_brand->addStore($test_store2);
$test_brand2->addStore($test_store2);
//Assert
$this->assertEquals($test_brand->getStores(), [$test_store, $test_store2]);
}
示例9: Brand
function test_getStores()
{
//Arrange
$name = "Nike";
$id = null;
$test_brand = new Brand($name, $id);
$test_brand->save();
$retailer = "Nordstrom";
$address = "1234 SW Main Street";
$phone = "123-456-7890";
$test_store = new Store($retailer, $address, $phone, $id);
$test_store->save();
$retailer2 = "Macys";
$address2 = "400 SW 6th Avenue";
$phone2 = "888-888-8888";
$test_store2 = new Store($retailer2, $address2, $phone2, $id);
$test_store2->save();
//Act
$test_brand->addStore($test_store);
$test_brand->addStore($test_store2);
$result = $test_brand->getStores();
//Assert
$this->assertEquals([$test_store, $test_store2], $result);
}
示例10: testGetStores
function testGetStores()
{
//Arrange
$name = "Shoe Store 1";
$test_store = new Store($name);
$test_store->save();
$name2 = "Shoe Store 2";
$test_store2 = new Store($name2);
$test_store2->save();
$brand_name = "Brand 1";
$test_brand = new Brand($brand_name);
$test_brand->save();
//Act
$test_brand->addStore($test_store);
$test_brand->addStore($test_store2);
$result = $test_brand->getStores();
//Assert
$this->assertEquals([$test_store, $test_store2], $result);
}
示例11: testGetStores
function testGetStores()
{
$name = "ShoeStore";
$id = 1;
$test_store = new Store($name, $id);
$test_store->save();
$name2 = "BlueShoe";
$id3 = 3;
$test_store2 = new Store($name2, $id3);
$test_store2->save();
$name = "Asics";
$id2 = 2;
$test_brand = new Brand($name, $id2);
$test_brand->save();
//Act
$test_brand->addStore($test_store);
$test_brand->addStore($test_store2);
//Assert
$this->assertEquals($test_brand->getStores(), [$test_store, $test_store2]);
}
示例12: testGetStores
function testGetStores()
{
//Arrange
$name = "Clogs-N-More";
$id = 1;
$test_store = new Store($name, $id);
$test_store->save();
$name2 = "Shoe Depot";
$id2 = 1;
$test_store2 = new Store($name2, $id2);
$test_store2->save();
$name = "Nike";
$id = 1;
$test_brand = new Brand($name, $id);
$test_brand->save();
//Act
$test_brand->addStore($test_store);
$test_brand->addStore($test_store2);
$result = $test_brand->getStores();
//Assert
$this->assertEquals([$test_store, $test_store2], $result);
}
示例13: Brand
function test_getStores()
{
//Arrange
$brand_name = "BRAH-DIDAS";
$id = 1;
$test_brand = new Brand($brand_name, $id);
$test_brand->save();
$store_name = "LOTSA SHOES HERE";
$id2 = 2;
$test_store = new Store($store_name, $id2);
$test_store->save();
$store_name2 = "PLZ BUY SHOES HERE";
$id3 = 3;
$test_store2 = new Store($store_name2, $id3);
$test_store2->save();
//Act
$test_brand->addStore($test_store);
$test_brand->addStore($test_store2);
//Assert
$this->assertEquals($test_brand->getStores(), [$test_store, $test_store2]);
}
示例14: Brand
function test_brand_getStore()
{
//Arrange
$brand_name = "Nike";
$id1 = 1;
$test_brand = new Brand($brand_name, $id1);
$test_brand->save();
$store_name2 = "Goody New Shoes";
$test_store2 = new Store($store_name2);
$test_store2->save();
$test_brand->addStore($test_store2);
$store_name = "Groos Shoes";
$test_store = new Store($store_name);
$test_store->save();
$test_brand->addStore($test_store);
//Act
$result = $test_brand->getStores();
//Assert
$this->assertEquals([$test_store2, $test_store], $result);
}
示例15: testGetStores
function testGetStores()
{
$brand_name = "Air Jordan";
$test_brand = new Brand($brand_name);
$test_brand->save();
$name = "Foot Locker";
$phone_number = "555-555-5555";
$address = "123 ABC Street";
$test_store = new Store($name, $phone_number, $address);
$test_store->save();
$name2 = "Nike Outlet";
$phone_number2 = "444-444-4444";
$address2 = "456 CBA Ave.";
$test_store2 = new Store($name2, $phone_number2, $address2);
$test_store2->save();
$test_brand->addStore($test_store);
$test_brand->addStore($test_store2);
$result = $test_brand->getStores();
$this->assertEquals([$test_store, $test_store2], $result);
}