Example #1
0
 function testGetStores()
 {
     //Arrange
     $beer_name = "Your mom";
     $style = "IPA";
     $abv = 4;
     $ibu = 6;
     $container = "bottle";
     $brewery = "daddy";
     $id = 1;
     $image = "../img/test.jpg";
     $test_beer = new Beer($beer_name, $style, $abv, $ibu, $container, $brewery, $image, $id);
     $test_beer->save();
     $store_name = "M&M";
     $category = "Black Market";
     $region = "unknown";
     $address = "SW";
     $id2 = 2;
     $test_store = new Store($store_name, $category, $region, $address);
     $test_store->save();
     $store_name2 = "M&M2";
     $category2 = "Black Market2";
     $region2 = "unknown2";
     $address2 = "SW2";
     $id3 = 3;
     $test_store2 = new Store($store_name2, $category2, $region2, $address2);
     $test_store2->save();
     //Act
     $test_beer->addStore($test_store->getId());
     $test_beer->addStore($test_store2->getId());
     $result = $test_beer->getStores();
     //Assert
     $this->assertEquals([$test_store, $test_store2], $result);
 }
Example #2
0
 function testDelete()
 {
     //Arrange
     $store_name = "Chill N Fill";
     $id = 1;
     $category = "bar";
     $region = "North Portland";
     $address = "5215 N Lombard Portland, OR 97203";
     $test_store = new Store($store_name, $category, $region, $address);
     $test_store->save();
     $beer_name = "Bike Beer";
     $style = "Kolsch";
     $abv = 5.6;
     $ibu = 50;
     $container = "Growler";
     $brewery = "Hopworks";
     $id = 1;
     $image = "../img/test.jpg";
     $test_beer = new Beer($beer_name, $style, $abv, $ibu, $container, $brewery, $image, $id);
     $test_beer->save();
     //Act
     $test_store->addBeer($test_beer->getId());
     $test_store->delete();
     //Assert
     $this->assertEquals([], $test_beer->getStores());
 }