Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

handle missing processed key

  • Loading branch information...
commit bb8a43087466050b9e9fa8ff559db51f15a4864f 1 parent e264fc0
@iampersistent iampersistent authored
View
6 lib/ImmersiveLabs/Pricing/Entity/PricingSet.php
@@ -75,7 +75,11 @@ public function get($name)
throw new \Exception();
}
- return $this->processed[$name];
+ if (isset($this->processed[$name])) {
+ return $this->processed[$name];
+ }
+
+ return null;
}
public function set($name, $value)
View
10 tests/Entity/PricingSetTest.php
@@ -44,4 +44,14 @@ public function testProcess()
$this->assertEquals('9.99', $newSet->getNetValue(), 'the final value should be 9.99');
$this->assertEquals('9.99', $newSet->getTotalValue(), 'the final value should be 9.00');
}
+
+ public function testGet()
+ {
+ $pricingSet = new PricingSet();
+ $pricingSet->setProcessed(array('thisExists' => 10));
+ $pricingSet->setProcessingState(PricingSet::PROCESSING_FINISHED);
+ $this->assertNull($pricingSet->get('noWayInHellThisExists'));
+
+ $this->assertEquals(10, $pricingSet->get('thisExists'));
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.