Author: as
Date: Fri Aug 3 13:38:46 2007
New Revision: 5813
Log:
- Fixed an error in the documentation.
- Added another test case.
Modified:
trunk/Url/src/url_configuration.php
trunk/Url/tests/url_test.php
Modified: trunk/Url/src/url_configuration.php
==============================================================================
--- trunk/Url/src/url_configuration.php [iso-8859-1] (original)
+++ trunk/Url/src/url_configuration.php [iso-8859-1] Fri Aug 3 13:38:46 2007
@@ -103,8 +103,10 @@
* Flag for specifying aggregation for unordered parameter values if the
* parameter name appears more than once in the URL.
*
- * For example, if the URL is
'http://www.example.com/(param1)/x/(param2)/y',
- * then both values will be considered for the parameter param1.
+ * For example, if the URL is
'http://www.example.com/(param1)/x/(param1)/y/z',
+ * then all values will be considered for the parameter param1. So
+ * $url->getParam( 'param1' ) will return array( "x", "y", "z" ), if $url
is
+ * an ezcUrl object created from the above URL.
*/
const AGGREGATE_ARGUMENTS = 4;
Modified: trunk/Url/tests/url_test.php
==============================================================================
--- trunk/Url/tests/url_test.php [iso-8859-1] (original)
+++ trunk/Url/tests/url_test.php [iso-8859-1] Fri Aug 3 13:38:46 2007
@@ -654,7 +654,7 @@
$this->assertEquals( array( 'y' ), $url->getParam( 'param2' ) );
}
- public function testGetUnorderedParametersMultipleValuesTypeAggregate()
+ public function
testGetUnorderedParametersMultipleValuesTypeAggregateSingleMultiple()
{
$urlCfg = new ezcUrlConfiguration();
$urlCfg->addOrderedParameter( 'section' );
@@ -676,7 +676,7 @@
$this->assertEquals( array( 'x', 'y', 'z' ), $url->getParam( 'param2'
) );
}
- public function
testGetUnorderedParametersMultipleValuesTypeAggregateSingle()
+ public function
testGetUnorderedParametersMultipleValuesTypeAggregateSingleSingle()
{
$urlCfg = new ezcUrlConfiguration();
$urlCfg->addOrderedParameter( 'section' );
@@ -696,6 +696,28 @@
$this->assertEquals( 'trunk', $url->getParam( 'content' ) );
$this->assertEquals( 'a', $url->getParam( 'param1' ) );
$this->assertEquals( array( 'x', 'y' ), $url->getParam( 'param2' ) );
+ }
+
+ public function
testGetUnorderedParametersMultipleValuesTypeAggregateMultipleSingle()
+ {
+ $urlCfg = new ezcUrlConfiguration();
+ $urlCfg->addOrderedParameter( 'section' );
+ $urlCfg->addOrderedParameter( 'module' );
+ $urlCfg->addOrderedParameter( 'view' );
+ $urlCfg->addOrderedParameter( 'content' );
+ $urlCfg->addUnorderedParameter( 'param1' );
+ $urlCfg->addUnorderedParameter( 'param2',
ezcUrlConfiguration::AGGREGATE_ARGUMENTS );
+
+ $url = new ezcUrl(
"http://www.example.com/doc/components/view/trunk/(param1)/a/(param2)/x/y/(param2)/z",
$urlCfg );
+ $expected =
'http://www.example.com/doc/components/view/trunk/(param1)/a/(param2)/x/y/(param2)/z';
+ $this->assertEquals( $expected, $url->buildUrl() );
+
+ $this->assertEquals( 'doc', $url->getParam( 'section' ) );
+ $this->assertEquals( 'components', $url->getParam( 'module' ) );
+ $this->assertEquals( 'view', $url->getParam( 'view' ) );
+ $this->assertEquals( 'trunk', $url->getParam( 'content' ) );
+ $this->assertEquals( 'a', $url->getParam( 'param1' ) );
+ $this->assertEquals( array( 'x', 'y', 'z' ), $url->getParam( 'param2'
) );
}
public function testIsSet()
--
svn-components mailing list
[EMAIL PROTECTED]
http://lists.ez.no/mailman/listinfo/svn-components