Пример #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]);
 }
Пример #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);
 }
Пример #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());
 }
Пример #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());
 }
Пример #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());
 }
Пример #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();