Changeset 1378
- Timestamp:
- 02/26/08 17:37:39 (6 months ago)
- Files:
-
- trunk/src/main/php/net/stubbles/ipo/request/broker/annotations/stubAbstractFilterAnnotation.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/ipo/request/stubRequestValueErrorFactoryMappingDecorator.php (deleted)
- trunk/src/test/php/net/stubbles/ipo/IPOTestSuite.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/ipo/request/broker/annotations/stubAbstractFilterAnnotationTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/ipo/request/stubRequestValueErrorFactoryMappingDecoratorTestCase.php (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/ipo/request/broker/annotations/stubAbstractFilterAnnotation.php
r1323 r1378 51 51 */ 52 52 protected $defaultValue = null; 53 /**54 * list of error mappings55 *56 * @var array<array<string,string>>57 */58 protected $mappings = array();59 53 60 54 /** … … 106 100 { 107 101 $this->defaultValue = $defaultValue; 108 }109 110 /**111 * sets the error mapping112 *113 * @param string $errorMapping114 */115 public function setErrorMapping($errorMapping)116 {117 $mappings = explode(':', $errorMapping);118 foreach ($mappings as $mapping) {119 $errorIds = explode('=>', $mapping);120 $this->mappings[trim($errorIds[0])] = trim($errorIds[1]);121 }122 102 } 123 103 … … 174 154 } 175 155 176 if (count($this->mappings) === 0) {177 return $this->rveFactory;178 }179 180 stubClassLoader::load('net::stubbles::ipo::request::stubRequestValueErrorFactoryMappingDecorator');181 $this->rveFactory = new stubRequestValueErrorFactoryMappingDecorator($this->rveFactory);182 foreach ($this->mappings as $oldErrorId => $newErrorId) {183 $this->rveFactory->addMapping($oldErrorId, $newErrorId);184 }185 186 156 return $this->rveFactory; 187 157 } trunk/src/test/php/net/stubbles/ipo/IPOTestSuite.php
r1365 r1378 29 29 $suite->addTestFile($dir . '/request/stubAbstractRequestTestCase.php'); 30 30 $suite->addTestFile($dir . '/request/stubRequestPrefixDecoratorTestCase.php'); 31 $suite->addTestFile($dir . '/request/stubRequestValueErrorFactoryMappingDecoratorTestCase.php');32 31 $suite->addTestFile($dir . '/request/stubRequestValueErrorTestCase.php'); 33 32 $suite->addTestFile($dir . '/request/stubWebRequestTestCase.php'); trunk/src/test/php/net/stubbles/ipo/request/broker/annotations/stubAbstractFilterAnnotationTestCase.php
r1323 r1378 161 161 162 162 /** 163 * test that mapping is added correct164 *165 * @test166 */167 public function mappedRequestErrorValueFactory()168 {169 $abstractFilterAnnotation = new TeststubAbstractFilterAnnotation();170 $abstractFilterAnnotation->setErrorMapping('FIELD_EMPTY=>FOO_EMPTY:TOO_SMALL=>TOO_GREAT');171 $rveFactory = $abstractFilterAnnotation->getRVEFactory();172 $this->assertType('stubRequestValueErrorFactoryMappingDecorator', $rveFactory);173 $this->assertEquals(array('FIELD_EMPTY' => 'FOO_EMPTY',174 'TOO_SMALL' => 'TOO_GREAT'175 ),176 $rveFactory->getMappings()177 );178 $this->assertSame($rveFactory, $abstractFilterAnnotation->getRVEFactory());179 }180 181 /**182 163 * test that the correct RequestErrorValueFactory is created 183 164 *
