Changeset 8698
- Timestamp:
- 04/30/08 18:35:28 (1 year ago)
- Files:
-
- branches/1.1/lib/autoload/sfCoreAutoload.class.php (modified) (1 diff)
- branches/1.1/lib/event/sfEvent.class.php (modified) (2 diffs)
- branches/1.1/test/unit/event/sfEventTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/autoload/sfCoreAutoload.class.php
r8563 r8698 292 292 'sfDatabaseSessionStorage' => 'storage', 293 293 'sfMySQLSessionStorage' => 'storage', 294 'sfMySQLiSessionStorage' => 'storage', 294 295 'sfNoStorage' => 'storage', 295 296 'sfPDOSessionStorage' => 'storage', branches/1.1/lib/event/sfEvent.class.php
r8146 r8698 120 120 public function offsetExists($name) 121 121 { 122 return isset($this->parameters[$name]);122 return array_key_exists($name, $this->parameters); 123 123 } 124 124 … … 132 132 public function offsetGet($name) 133 133 { 134 return isset($this->parameters[$name]) ? $this->parameters[$name] : null; 134 if (!array_key_exists($name, $this->parameters)) 135 { 136 throw new InvalidArgumentException(sprintf('The event "%s" has no "%s" parameter.', $this->name, $name)); 137 } 138 139 return $this->parameters[$name]; 135 140 } 136 141 branches/1.1/test/unit/event/sfEventTest.php
r6503 r8698 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(1 0, new lime_output_color());13 $t = new lime_test(11, new lime_output_color()); 14 14 15 15 $subject = new stdClass(); … … 47 47 $t->is($event['foo'], 'foo', 'sfEvent implements the ArrayAccess interface'); 48 48 49 try 50 { 51 $event['foobar']; 52 $t->fail('::offsetGet() throws an InvalidArgumentException exception when the parameter does not exist'); 53 } 54 catch (InvalidArgumentException $e) 55 { 56 $t->pass('::offsetGet() throws an InvalidArgumentException exception when the parameter does not exist'); 57 } 58 49 59 $t->ok(isset($event['foo']), 'sfEvent implements the ArrayAccess interface'); 50 60 unset($event['foo']);

