コード例 #1
0
 /**
  * @test
  * @dataProvider items
  */
 public function loading_whole_fixtures_from_cached_copy()
 {
     $this->givenSqliteDatabaseWasConnected();
     $this->loadWholeFixturesFromCachedCopy();
     ApplyDiscountUseCase::create($this->getEntityManager())->apply(0.5);
     $this->assertEquals(50, $this->findItemByName('teapot_1')->price());
     $this->assertEquals(200, $this->findItemByName('phone_1')->price());
 }
コード例 #2
0
 /**
  * @test
  * @dataProvider items
  */
 public function purge_database_with_cached_purge_query()
 {
     $this->executedCachedQueryToPurgeDatabase();
     $this->add(new Teapot('brand-new-teapot', 100.0));
     $this->add(new Phone('amazing-phone', 400.0));
     ApplyDiscountUseCase::create($this->getEntityManager())->apply(0.5);
     $this->assertEquals(50, $this->findItemByName('brand-new-teapot')->price());
     $this->assertEquals(200, $this->findItemByName('amazing-phone')->price());
 }
 /** @test */
 public function it_applies_discount_on_items()
 {
     $this->givenDatabaseIsClear();
     $this->add(new Teapot('new-teapot', 100));
     $this->add(new Beer('tasty-beer', 50));
     $this->add(new Juice('orange', 30));
     ApplyDiscountUseCase::create($this->getEntityManager())->apply(0.5);
     $this->assertEquals(50, $this->findItemByName('new-teapot')->price());
     $this->assertEquals(25, $this->findItemByName('tasty-beer')->price());
     $this->assertEquals(15, $this->findItemByName('orange')->price());
 }