本文整理汇总了PHP中Brand::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Brand::getAll方法的具体用法?PHP Brand::getAll怎么用?PHP Brand::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Brand
的用法示例。
在下文中一共展示了Brand::getAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find
static function find($searchId)
{
$brands_returned = Brand::getAll();
foreach ($brands_returned as $brand) {
if ($searchId == $brand->getId()) {
return $brand;
}
}
}
示例2: find
static function find($id)
{
$db_brands = Brand::getAll();
foreach ($db_brands as $brand) {
if ($id == $brand->getId()) {
return $brand;
}
}
return null;
}
示例3: testGetAll
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);
}
示例4: find
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;
}
示例5: testGetAll
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);
}
示例6: test_delete
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());
}
示例7: Brand
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);
}
示例8: find
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;
}
示例9: findByName
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;
}
示例10: test_delete
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);
}
示例11: find
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;
}
示例12: download
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);
}
示例13: testDeleteAll
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);
}
示例14: test_delete
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);
}
示例15: testDeleteBrand
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);
}