function testGetCategoryName()
 {
     $category_name = "music";
     $new_category = new Category($category_name);
     $result = $new_category->getCategoryName();
     $this->assertEquals("music", $result);
 }
Example #2
0
function encoder_redirect_success(Category $new_category)
{
    $new_category_name = $new_category->getCategoryName();
    $dir = "VIEW/html/Encoder/Add_Category/Add_Category.php?success=1&Category_Name={$new_category_name}";
    $url = BASE_URL . $dir;
    header("Location:{$url}");
    //redirect the encoder to the regions add place
    exit;
}
 function testUpdate()
 {
     //Arrange
     $category_name = "Work stuff";
     $id = 1;
     $test_category = new Category($category_name, $id);
     $test_category->save();
     $new_category_name = "Home stuff";
     //Act
     $test_category->update($new_category_name);
     //Assert
     $this->assertEquals("Home stuff", $test_category->getCategoryName());
 }
Example #4
0
$priceArray = null;
if (isset($_GET['price']) && $_GET['price'] != '') {
    $priceArray = explode(',', $_GET['price']);
    $price = $_GET['price'];
}
?>
<div class="toltip" style="visibility:hidden;position:absolute;cursor:pointer;left:100px;top:50px;border:solid1px#eee;background-color:#ffffdd;padding:10px;z-index:1000;">Le produit a bien été <br> ajouté au panier</div>


  <section  id="columns" class="container_9 clearfix col2-right">
  <div class="breadcrumb"> 
	<a title="return to Home" href="home.php">Acceuil</a> 
	<span class="navigation-pipe">/</span> 
	<span class="navigation_page"><?php 
$category = new Category($db, $_GET['idCategory']);
echo utf8_encode($category->getCategoryName());
?>
</span> 
  </div>
  <div class="category-image"><img src="media/banner1.jpg" width="1170" height="111">
    <div class="page-title "> <?php 
echo utf8_encode($category->getCategoryName());
?>
 </div>
  </div>
  
  <!-- Center -->
  <article id="center_column" class=" grid_5">
    <div class="toolbar">
      <div class="sort-select">
        <label>TRIER PAR</label>
 /**
  * @param Category $category
  * @return bool
  * this function will add a category to the database
  * it takes q category object
  */
 function Add_Category(Category $category)
 {
     $category_name = $category->getCategoryName();
     $category_name_amharic = $category->getCategoryNameAmharic();
     $General_Category = $category->getGeneralCategory();
     $query = "INSERT INTO category (Name,Name_Amharic,General_Category) VALUES ('{$category_name}','{$category_name_amharic}','{$General_Category}')";
     $result = mysqli_query($this->getDbc(), $query);
     if ($result) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
 function Edit_Category(Category $Category, $Category_ID)
 {
     $Name = $Category->getCategoryName();
     $Name_Amharic = $Category->getCategoryNameAmharic();
     $General_Category = $Category->getGeneralCategory();
     $query = "UPDATE Category set Name='{$Name}',Name_Amharic='{$Name_Amharic}',General_Category='{$General_Category}' where ID='{$Category_ID}'";
     $result = mysqli_query($this->getDbc(), $query);
     //if the company is deleted return true
     if ($result) {
         return TRUE;
     } else {
         return FALSE;
     }
 }