Exemplo n.º 1
0
 function testUpdate()
 {
     $brand_name = "dr.martens";
     $new_brand = new Brand($brand_name);
     $new_brand->save();
     $new_brand->setBrandName("doc martens");
     $new_brand->update();
     $result = Brand::getAll();
     $this->assertEquals($new_brand, $result[0]);
 }
Exemplo n.º 2
0
 function test_update()
 {
     $test_name = "Helmut Lang";
     $test_id = 1;
     $test_brand = new Brand($test_name, $test_id);
     $test_brand->save();
     $new_name = "Y-3";
     $test_brand->update($new_name);
     $result = Brand::getAll();
     $this->assertEquals($new_name, $result[0]->getName());
 }
 function testUpdate()
 {
     // Arrange
     $brand_name = "Babbling Brooks";
     $test_Brand = new Brand($brand_name);
     $test_Brand->save();
     $new_name = "Gibberish Producing Brooks";
     // Act
     $test_Brand->update($new_name);
     $result = $test_Brand->getName();
     // Assert
     $this->assertEquals($new_name, $result);
 }
Exemplo n.º 4
0
 function test_update()
 {
     //Arrange
     $name = "Nike";
     $id = null;
     $test_brand = new Brand($name, $id);
     $test_brand->save();
     $new_name = "Adidas";
     //Act
     $test_brand->update($new_name);
     //Assert
     $this->assertEquals($new_name, $test_brand->getName());
 }
Exemplo n.º 5
0
 function testUpdate()
 {
     //Arrange
     $brand_name = "Sketchers";
     $test_brand = new Brand($brand_name);
     $test_brand->save();
     $new_name = "Vans";
     //Act
     $test_brand->update($new_name);
     //Assert
     $this->assertEquals($new_name, $test_brand->getBrandName());
 }
Exemplo n.º 6
0
 function testUpdate()
 {
     //Arrange
     $brand_name = "Nike";
     $id = 1;
     $test_brand = new Brand($brand_name, $id);
     $test_brand->save();
     $new_brand_name = "Fila";
     //Act
     $test_brand->update($new_brand_name);
     //Assert
     $this->assertEquals('Fila', $test_brand->getBrandName());
 }
Exemplo n.º 7
0
        echo "<script>window.location='../../'</script>";
    }
});
// $app->post('/brands', function() use($brand, $app) {
//   $request = $app->request();
//   $body = $request->getBody();
//   $data = json_decode($body);
//   $brand->insert($data);
// });
$app->put('/brands/:id', function ($id) use($brand, $app) {
    if (isset($_SESSION['app']) && isset($_COOKIE['app'])) {
        $request = $app->request();
        $body = $request->getBody();
        $data = json_decode($body);
        $data->id = $id;
        $brand->update($data);
    } else {
        echo "<script>window.location='../../'</script>";
    }
});
$app->get('/users/:id', function ($id) use($user) {
    if (isset($_SESSION['app']) && isset($_COOKIE['app'])) {
        $user->getUser($id);
    } else {
        echo "<script>window.location='../../'</script>";
    }
});
$app->put('/users/:id', function ($id) use($user, $app) {
    if (isset($_SESSION['app']) && isset($_COOKIE['app'])) {
        $request = $app->request();
        $body = $request->getBody();