public function offsetSet($index, $newval) { if (!$this->allowed($index)) { throw new PolicyBagException("Input contains restricted item '{$index}'"); } parent::offsetSet($index, $newval); }
/** * @covers \JetBag\Bag::__get * * @dataProvider providerMagicGetNotFound * * @expectedException \JetBag\Exceptions\BagException * @expectedExceptionMessageFormat Key '%s' not found */ public function testMagicGetNotFound($key, $property) { $bag = Bag::make(array($key => "key '{$key}'")); $bag->{$property}; }