Changeset 1494
- Timestamp:
- 04/04/08 17:36:32 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/peer/stubHeaderList.php
r1486 r1494 177 177 * returns value of header with given key 178 178 * 179 * @param string $key name of header 179 * @param string $key name of header 180 * @param mixed $default optional value to return if given header not set 180 181 * @return string 181 182 */ 182 public function get($key )183 public function get($key, $default = null) 183 184 { 184 185 if ($this->containsKey($key) == true) { … … 186 187 } 187 188 188 return null;189 return $default; 189 190 } 190 191 trunk/src/test/php/net/stubbles/peer/stubHeaderListTestCase.php
r1486 r1494 131 131 132 132 /** 133 * assert default values are returned if no header with given name is set 134 * 135 * @test 136 */ 137 public function get() 138 { 139 $this->assertNull($this->headerList->get('foo')); 140 $this->assertEquals('bar', $this->headerList->get('foo', 'bar')); 141 $this->headerList->put('foo', 'bar'); 142 $this->assertEquals('bar', $this->headerList->get('foo')); 143 $this->assertEquals('bar', $this->headerList->get('foo', 'bar')); 144 } 145 146 /** 133 147 * assure that the headerlist clears correctly 134 148 *
