/** * @expectedException \RoyalMailPriceCalculator\Exceptions\UnknownPackageTypeException */ public function testUnknownPackageTypeException() { $service = new FirstClassService(); $package = new Package(); $package->setDimensions(100, 100, 100); $package->setWeight(20000); $service->getPackageType($package); }
public function testSettersAndGetters() { $package = new Package(); $package->setDimensions(5, 10, 15); $this->assertEquals(5, $package->getLength()); $this->assertEquals(10, $package->getWidth()); $this->assertEquals(15, $package->getDepth()); $package->setWeight(150); $this->assertEquals(150, $package->getWeight()); }
public function testCalculatePriceWithUnknownPackageType() { $calculator = new Calculator(); $usePriceOn = new \DateTime('2015-03-01'); $package = new Package(); $package->setDimensions(15, 15, 0.4); $package->setWeight(30000); $expected = array(array('service' => new FirstClassService($usePriceOn), 'prices' => array()), array('service' => new SecondClassService($usePriceOn), 'prices' => array())); $calculator->setServices(array(new FirstClassService($usePriceOn), new SecondClassService($usePriceOn))); $this->assertEquals($expected, $calculator->calculatePrice($package)); }