public function testBasicSetPath() { $value = uniqid('test:'); $url = new Url(); $url->setPath($value); $this->assertEquals($value, $url->getPath()); }
public function testBasicSetScheme() { $value = 'https'; $url = new Url(); $url->setScheme($value); $this->assertEquals($value, $url->getScheme()); }
public function testGetQuery() { $value = ['ana' => 'mere']; $oUrl = new Url(); $oUrl->setQuery($value); $this->assertEquals($value, $oUrl->getQuery()); }
public function testGetQueryString() { $value = ['ana' => 'mere', 'test' => 123]; $oUrl = new Url(); $oUrl->setQuery($value); $this->assertEquals('ana=mere&test=123', $oUrl->getRawQueryString()); }
public function testBasicSetQuery() { $value = ['ana' => 'mere', 'test' => 123]; $url = new Url(); $url->setQuery($value); $this->assertEquals($value, $url->getQuery()); }
public function testBasicValidSchemes() { $mirror = new \ReflectionClass(Url::class); $validSchemes = $mirror->getStaticProperties()['validSchemes']; foreach ($validSchemes as $scheme) { $this->assertTrue(Url::isValidScheme($scheme)); } }
public function testInstantiationIsNull() { $url = new Url(); $this->assertNull($url->getHost()); }
public function testFalseAtInstantiation() { $url = new Url(); $this->assertFalse($url->hasHost()); }
public function changeSubdomain($sNewSubdomain) { $this->oUrl->setHost(str_ireplace($this->getSubdomain(), $sNewSubdomain, $this->oUrl->getHost())); return $this->oUrl->getHost(); }
/** * @test */ public function parse_urlIPWithoutProtocol() { $aUrlComponents = array('scheme' => 'http', 'host' => '127.0.0.1', 'user' => '', 'pass' => '', 'path' => '/', 'query' => [], 'fragment' => ''); $oUrl = new Url(); $oUrl->setScheme($aUrlComponents['scheme']); $oUrl->setHost($aUrlComponents['host']); $oUrl->setPath($aUrlComponents['path']); $oUrl->setQuery($aUrlComponents['query']); $oUrl->setFragment($aUrlComponents['fragment']); $this->assertEquals($oUrl, UrlParserA_underTest::parse_url('//127.0.0.1/')); }
/** * @returns Url */ public function getUrl() { $sRegex = '#(' . str_replace('#', '\\#', $this->getRegex()) . ')#iUu'; $bHaveMatch = preg_match($sRegex, $this->sMatchingUrl, $aMatches); if ($bHaveMatch) { $url = new Url(); $url->setPath($aMatches[0]); return $url; } else { return new Base(); } }
/** * @return Url */ public function getUriObject() { if (!Url::isValid($this->oUri)) { $this->oUri = UrlParserA::url($this->getUri()); } return $this->oUri; }
public function getUrl() { return parent::getUrl(); }
public function testIsRemoteIP() { $oUrl = new Url(); $oUrl->setHost('8.8.8.8'); $this->assertFalse($oUrl->isLocal()); }
public function testInstantiationIsNull() { $url = new Url(); $this->assertEquals('', $url->getPath()); }