public function __construct($path = '', $defaults = array(), $rules = array()) { $this->path = '/' . trim(Net_URL2::removeDotSegments($path), '/'); $this->setDefaults($defaults); $this->setRules($rules); try { $this->parsePath(); } catch (Exception $e) { // The path could not be parsed correctly, treat it as fixed $this->fixed = true; $part = self::createPart(Net_URL_Mapper_Part::FIXED, $this->path, $this->path); $this->parts = array($part); } $this->getRequired(); }
/** * This is a regression test that removeDotSegments('0') is * working as it was reported as not-working in Bug #19315 * on 2012-03-04 04:18 UTC. * * @return void */ public function test19315() { $actual = Net_URL2::removeDotSegments('0'); $this->assertSame('0', $actual); $nonStringObject = (object) array(); try { Net_URL2::removeDotSegments($nonStringObject); } catch (PHPUnit_Framework_Error $error) { $this->addToAssertionCount(1); } if (!isset($error)) { $this->fail('Failed to verify that error was given.'); } unset($error); }
/** * @dataProvider pathProvider */ public function testRemoveDotSegments($path, $assertion) { $this->assertEquals($assertion, Net_URL2::removeDotSegments($path)); }