Changeset 200
- Timestamp:
- 02/02/07 16:08:36 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/xml/xsl/stubXSLProcessor.php
r199 r200 161 161 162 162 unset($this->parameters[$nameSpace][$paramName]); 163 if (count($this->parameters[$nameSpace]) == 0) { 164 unset($this->parameters[$nameSpace]); 165 } 163 166 return true; 164 167 } … … 205 208 * @return array 206 209 */ 207 public function getParameterName Spaces()210 public function getParameterNamespaces() 208 211 { 209 212 return array_keys($this->parameters); trunk/src/test/php/net/stubbles/xml/xsl/stubXSLProcessorTestCase.php
r180 r200 64 64 TeststubXSLProcessor::$mockXSLTProcessor = $this->mockXSLTProcessor; 65 65 $this->xslProcessor = new TeststubXSLProcessor(); 66 $this->document = new DOMDocument();66 $this->document = new DOMDocument(); 67 67 $this->xslProcessor->setXMLDocument($this->document); 68 } 69 70 /** 71 * test importing a stylesheet 72 */ 73 public function testImportXSLStylesheet() 74 { 75 $stylesheet = new DOMDocument(); 76 $this->xslProcessor->importXSLStylesheet($stylesheet); 77 $this->assertEqual($this->xslProcessor->getStylesheets(), array($stylesheet)); 68 78 } 69 79 … … 86 96 $this->assertTrue($this->xslProcessor->hasParameter('foo', 'bar')); 87 97 $this->assertTrue($this->xslProcessor->hasParameter('foo', 'foo')); 98 $this->assertEqual($this->xslProcessor->getParameters('foo'), array('bar' => 'baz', 'foo' => 'bar')); 99 $this->assertEqual($this->xslProcessor->getParameters('bar'), array()); 100 $this->assertEqual($this->xslProcessor->getParameterNamespaces(), array('foo')); 88 101 89 $this->mockXSLTProcessor->expect('removeParameter', array('foo', 'bar')); 102 $this->mockXSLTProcessor->expectAt(0, 'removeParameter', array('foo', 'bar')); 103 $this->mockXSLTProcessor->expectAt(1, 'removeParameter', array('foo', 'bar')); 104 $this->mockXSLTProcessor->expectAt(2, 'removeParameter', array('foo', 'foo')); 90 105 $this->mockXSLTProcessor->setReturnValueAt(0, 'removeParameter', false); 91 106 $this->mockXSLTProcessor->setReturnValueAt(1, 'removeParameter', true); 107 $this->mockXSLTProcessor->setReturnValueAt(2, 'removeParameter', true); 92 108 $this->assertFalse($this->xslProcessor->removeParameter('foo', 'bar')); 93 109 $this->assertTrue($this->xslProcessor->hasParameter('foo', 'bar')); … … 95 111 $this->assertFalse($this->xslProcessor->hasParameter('foo', 'bar')); 96 112 $this->assertTrue($this->xslProcessor->removeParameter('foo', 'baz')); 113 $this->assertTrue($this->xslProcessor->removeParameter('foo', 'foo')); 114 $this->assertEqual($this->xslProcessor->getParameters('foo'), array()); 115 $this->assertEqual($this->xslProcessor->getParameterNamespaces(), array()); 97 116 } 98 117 … … 114 133 $this->assertTrue($this->xslProcessor->hasParameter('baz', 'foo')); 115 134 $this->assertFalse($this->xslProcessor->hasParameter('baz', 'bar')); 135 $this->assertEqual($this->xslProcessor->getParameters('baz'), array('baz' => 'baz', 'foo' => 'bar')); 136 $this->assertEqual($this->xslProcessor->getParameters('bar'), array()); 137 $this->assertEqual($this->xslProcessor->getParameterNamespaces(), array('baz')); 116 138 117 $this->mockXSLTProcessor->expect('removeParameter', array('baz', 'foo'));118 139 $this->mockXSLTProcessor->setReturnValueAt(0, 'removeParameter', false); 119 140 $this->mockXSLTProcessor->setReturnValueAt(1, 'removeParameter', true); 141 $this->mockXSLTProcessor->setReturnValueAt(2, 'removeParameter', true); 120 142 $this->assertEqual($this->xslProcessor->removeParameters('baz', array('foo')), array('foo' => false)); 121 143 $this->assertTrue($this->xslProcessor->hasParameter('baz', 'foo')); … … 123 145 $this->assertFalse($this->xslProcessor->hasParameter('baz', 'bar')); 124 146 $this->assertEqual($this->xslProcessor->removeParameters('baz', array('bar')), array('bar' => true)); 147 $this->xslProcessor->removeParameter('baz', 'foo'); 148 $this->xslProcessor->removeParameter('baz', 'baz'); 149 $this->assertEqual($this->xslProcessor->getParameters('baz'), array()); 150 $this->assertEqual($this->xslProcessor->getParameterNamespaces(), array()); 125 151 } 126 152
