/vendor/aura/uri/tests/Aura/Uri/CheckPublicSuffixTest.php |
@@ -0,0 +1,123 @@ |
<?php |
|
namespace Aura\Uri; |
|
/** |
* This test case is based on the test data linked at |
* http://publicsuffix.org/list/ and provided by Rob Strading of Comodo. |
* @link |
* http://mxr.mozilla.org/mozilla-central/source/netwerk/test/unit/data/test_psl.txt?raw=1 |
*/ |
class CheckPublicSuffixTest extends \PHPUnit_Framework_TestCase |
{ |
/** |
* @var \Aura\Uri\PublicSuffixList |
*/ |
protected $psl; |
|
protected function setUp() |
{ |
parent::setUp(); |
$file = dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR |
. 'data' . DIRECTORY_SEPARATOR |
. 'public-suffix-list.php'; |
$this->psl = new PublicSuffixList(require $file); |
} |
|
public function testPublicSuffixSpec() |
{ |
// Test data from Rob Stradling at Comodo |
// http://mxr.mozilla.org/mozilla-central/source/netwerk/test/unit/data/test_psl.txt?raw=1 |
|
// null input. |
$this->checkPublicSuffix(null, null); |
// Mixed case. |
$this->checkPublicSuffix('COM', null); |
$this->checkPublicSuffix('example.COM', 'example.com'); |
$this->checkPublicSuffix('WwW.example.COM', 'example.com'); |
// Leading dot. |
$this->checkPublicSuffix('.com', null); |
$this->checkPublicSuffix('.example', null); |
$this->checkPublicSuffix('.example.com', null); |
$this->checkPublicSuffix('.example.example', null); |
$this->checkPublicSuffix('localhost', null); |
// Unlisted TLD. |
// Addresses algorithm rule #2: If no rules match, the prevailing rule is "*". |
$this->checkPublicSuffix('example', null); |
$this->checkPublicSuffix('example.example', 'example.example'); |
$this->checkPublicSuffix('b.example.example', 'example.example'); |
$this->checkPublicSuffix('a.b.example.example', 'example.example'); |
// TLD with only 1 rule. |
$this->checkPublicSuffix('biz', null); |
$this->checkPublicSuffix('domain.biz', 'domain.biz'); |
$this->checkPublicSuffix('b.domain.biz', 'domain.biz'); |
$this->checkPublicSuffix('a.b.domain.biz', 'domain.biz'); |
// TLD with some 2-level rules. |
$this->checkPublicSuffix('com', null); |
$this->checkPublicSuffix('example.com', 'example.com'); |
$this->checkPublicSuffix('b.example.com', 'example.com'); |
$this->checkPublicSuffix('a.b.example.com', 'example.com'); |
$this->checkPublicSuffix('uk.com', null); |
$this->checkPublicSuffix('example.uk.com', 'example.uk.com'); |
$this->checkPublicSuffix('b.example.uk.com', 'example.uk.com'); |
$this->checkPublicSuffix('a.b.example.uk.com', 'example.uk.com'); |
$this->checkPublicSuffix('test.ac', 'test.ac'); |
// TLD with only 1 (wildcard) rule. |
$this->checkPublicSuffix('cy', null); |
$this->checkPublicSuffix('c.cy', null); |
$this->checkPublicSuffix('b.c.cy', 'b.c.cy'); |
$this->checkPublicSuffix('a.b.c.cy', 'b.c.cy'); |
// More complex TLD. |
$this->checkPublicSuffix('jp', null); |
$this->checkPublicSuffix('test.jp', 'test.jp'); |
$this->checkPublicSuffix('www.test.jp', 'test.jp'); |
$this->checkPublicSuffix('ac.jp', null); |
$this->checkPublicSuffix('test.ac.jp', 'test.ac.jp'); |
$this->checkPublicSuffix('www.test.ac.jp', 'test.ac.jp'); |
$this->checkPublicSuffix('kyoto.jp', null); |
$this->checkPublicSuffix('test.kyoto.jp', 'test.kyoto.jp'); |
$this->checkPublicSuffix('ide.kyoto.jp', null); |
$this->checkPublicSuffix('b.ide.kyoto.jp', 'b.ide.kyoto.jp'); |
$this->checkPublicSuffix('a.b.ide.kyoto.jp', 'b.ide.kyoto.jp'); |
$this->checkPublicSuffix('c.kobe.jp', null); |
$this->checkPublicSuffix('b.c.kobe.jp', 'b.c.kobe.jp'); |
$this->checkPublicSuffix('a.b.c.kobe.jp', 'b.c.kobe.jp'); |
$this->checkPublicSuffix('city.kobe.jp', 'city.kobe.jp'); |
$this->checkPublicSuffix('www.city.kobe.jp', 'city.kobe.jp'); |
// TLD with a wildcard rule and exceptions. |
$this->checkPublicSuffix('om', null); |
$this->checkPublicSuffix('test.ck', null); |
$this->checkPublicSuffix('b.test.ck', 'b.test.ck'); |
$this->checkPublicSuffix('a.b.test.ck', 'b.test.ck'); |
$this->checkPublicSuffix('www.ck', 'www.ck'); |
$this->checkPublicSuffix('www.www.ck', 'www.ck'); |
// US K12. |
$this->checkPublicSuffix('us', null); |
$this->checkPublicSuffix('test.us', 'test.us'); |
$this->checkPublicSuffix('www.test.us', 'test.us'); |
$this->checkPublicSuffix('ak.us', null); |
$this->checkPublicSuffix('test.ak.us', 'test.ak.us'); |
$this->checkPublicSuffix('www.test.ak.us', 'test.ak.us'); |
$this->checkPublicSuffix('k12.ak.us', null); |
$this->checkPublicSuffix('test.k12.ak.us', 'test.k12.ak.us'); |
$this->checkPublicSuffix('www.test.k12.ak.us', 'test.k12.ak.us'); |
} |
|
/** |
* This is my version of the checkPublicSuffix function referred to in the |
* test instructions at the Public Suffix List project. |
* |
* "You will need to define a checkPublicSuffix() function which takes as a |
* parameter a domain name and the public suffix, runs your implementation |
* on the domain name and checks the result is the public suffix expected." |
* |
* @link http://publicsuffix.org/list/ |
* |
* @param string $input Domain and public suffix |
* @param string $expected Expected result |
*/ |
public function checkPublicSuffix($input, $expected) |
{ |
$this->assertSame($expected, $this->psl->getRegisterableDomain($input)); |
} |
} |
/vendor/aura/uri/tests/Aura/Uri/HostTest.php |
@@ -0,0 +1,106 @@ |
<?php |
|
namespace Aura\Uri; |
|
class HostTest extends \PHPUnit_Framework_TestCase |
{ |
/** |
* @var \Aura\Uri\Host |
*/ |
protected $host; |
|
protected function setUp() |
{ |
parent::setUp(); |
|
$file = dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR |
. 'data' . DIRECTORY_SEPARATOR |
. 'public-suffix-list.php'; |
$psl = new PublicSuffixList(require $file); |
|
$this->host = new Host($psl); |
} |
|
protected function tearDown() |
{ |
$this->host = null; |
parent::tearDown(); |
} |
|
/** |
* @dataProvider hostDataProvider |
*/ |
public function test__toString($string) |
{ |
$this->host->setFromString($string); |
$this->assertEquals($string, $this->host->__toString()); |
} |
|
/** |
* @dataProvider hostDataProvider |
*/ |
public function testGet($string) |
{ |
$this->host->setFromString($string); |
$this->assertEquals($string, $this->host->get()); |
} |
|
/** |
* @dataProvider hostDataProvider |
*/ |
public function testSetFromString($string) |
{ |
$this->host->setFromString($string); |
$this->assertEquals($string, $this->host->__toString()); |
} |
|
public function hostDataProvider() |
{ |
return array( |
array('example.com'), |
array('purple.com'), |
array('localhost'), |
); |
} |
|
/** |
* @dataProvider parseDataProvider |
*/ |
public function testParse($url, $publicSuffix, $registerableDomain, $subdomain) |
{ |
$this->host->setFromString($url); |
$this->assertSame($subdomain, $this->host->getSubdomain()); |
$this->assertEquals($publicSuffix, $this->host->getPublicSuffix()); |
$this->assertEquals($registerableDomain, $this->host->getRegisterableDomain()); |
$this->assertEquals($url, $this->host->get()); |
} |
|
public function parseDataProvider() |
{ |
// $url, $publicSuffix, $registerableDomain, $subdomain |
return array( |
array('www.waxaudio.com.au', 'com.au', 'waxaudio.com.au', 'www'), |
array('example.com', 'com', 'example.com', null), |
array('us.example.com', 'com', 'example.com', 'us', 'us.example.com'), |
array('us.example.na', 'na', 'example.na', 'us', 'us.example.na'), |
array('www.example.us.na', 'us.na', 'example.us.na', 'www', 'www.example.us.na'), |
array('us.example.org', 'org', 'example.org', 'us', 'us.example.org'), |
array('webhop.broken.biz', 'biz', 'broken.biz', 'webhop', 'webhop.broken.biz'), |
array('www.broken.webhop.biz', 'webhop.biz', 'broken.webhop.biz', 'www', 'www.broken.webhop.biz'), |
array('cea-law.co.il', 'co.il', 'cea-law.co.il', null), |
array('edition.cnn.com', 'com', 'cnn.com', 'edition'), |
array('en.wikipedia.org', 'org', 'wikipedia.org', 'en'), |
array('a.b.c.cy', 'c.cy', 'b.c.cy', 'a'), |
array('test.k12.ak.us', 'k12.ak.us', 'test.k12.ak.us', null), |
array('www.scottwills.co.uk', 'co.uk', 'scottwills.co.uk', 'www'), |
array('b.ide.kyoto.jp', 'ide.kyoto.jp', 'b.ide.kyoto.jp', null), |
array('a.b.example.uk.com', 'uk.com', 'example.uk.com', 'a.b'), |
array('test.nic.ar', 'ar', 'nic.ar', 'test'), |
array('a.b.test.ck', 'test.ck', 'b.test.ck', 'a', null), |
array('baez.songfest.om', 'om', 'songfest.om', 'baez'), |
array('politics.news.omanpost.om', 'om', 'omanpost.om', 'politics.news'), |
array('localhost', null, null, null), |
); |
} |
|
} |
/vendor/aura/uri/tests/Aura/Uri/PathTest.php |
@@ -0,0 +1,72 @@ |
<?php |
namespace Aura\Uri; |
|
/** |
* Test class for Path. |
* Generated by PHPUnit on 2012-07-21 at 15:45:14. |
*/ |
class PathTest extends \PHPUnit_Framework_TestCase |
{ |
/** |
* @var Path |
*/ |
protected $path; |
|
/** |
* Sets up the fixture, for example, opens a network connection. |
* This method is called before a test is executed. |
*/ |
protected function setUp() |
{ |
parent::setUp(); |
$this->path = new Path; |
} |
|
/** |
* Tears down the fixture, for example, closes a network connection. |
* This method is called after a test is executed. |
*/ |
protected function tearDown() |
{ |
parent::tearDown(); |
} |
|
/** |
* @covers Aura\Uri\Path::__toString |
*/ |
public function test__toString() |
{ |
$path = '/foo/bar/baz/dib.gir'; |
$this->path->setFromString($path); |
$actual = $this->path->__toString(); |
$this->assertSame($path, $actual); |
} |
|
/** |
* @covers Aura\Uri\Path::setFromString |
*/ |
public function testSetFromString() |
{ |
$path = '/foo/bar/baz/dib.gir'; |
$this->path->setFromString($path); |
|
$expect = '.gir'; |
$actual = $this->path->getFormat(); |
$this->assertSame($expect, $actual); |
|
$actual = $this->path->__toString(); |
$this->assertSame($path, $actual); |
} |
|
/** |
* @covers Aura\Uri\Path::setFormat |
* @covers Aura\Uri\Path::getFormat |
*/ |
public function testSetAndGetFormat() |
{ |
$format = '.json'; |
$this->path->setFormat($format); |
$actual = $this->path->getFormat($format); |
$this->assertSame($format, $actual); |
} |
} |
/vendor/aura/uri/tests/Aura/Uri/PublicSuffixListTest.php |
@@ -0,0 +1,76 @@ |
<?php |
|
namespace Aura\Uri; |
|
class PublicSuffixListTest extends \PHPUnit_Framework_TestCase |
{ |
/** |
* @var \Aura\Uri\PublicSuffixList |
*/ |
protected $psl; |
|
protected function setUp() |
{ |
parent::setUp(); |
$file = dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR |
. 'data' . DIRECTORY_SEPARATOR |
. 'public-suffix-list.php'; |
$this->psl = new PublicSuffixList(require $file); |
} |
|
/** |
* @dataProvider parseDataProvider |
*/ |
public function testGetPublicSuffix($url, $publicSuffix, $registerableDomain, $subdomain, $hostPart) |
{ |
$this->assertSame($publicSuffix, $this->psl->getPublicSuffix($hostPart)); |
} |
|
/** |
* @dataProvider parseDataProvider |
*/ |
public function testGetRegisterableDomain($url, $publicSuffix, $registerableDomain, $subdomain, $hostPart) |
{ |
$this->assertSame($registerableDomain, $this->psl->getRegisterableDomain($hostPart)); |
} |
|
/** |
* @dataProvider parseDataProvider |
*/ |
public function testGetSubdomain($url, $publicSuffix, $registerableDomain, $subdomain, $hostPart) |
{ |
$this->assertSame($subdomain, $this->psl->getSubdomain($hostPart)); |
} |
|
/** |
* @dataProvider parseDataProvider |
*/ |
public function testPHPparse_urlCanReturnCorrectHost($url, $publicSuffix, $registerableDomain, $subdomain, $hostPart) |
{ |
$this->assertEquals($hostPart, parse_url('http://' . $hostPart, PHP_URL_HOST)); |
} |
|
public function parseDataProvider() |
{ |
// $url, $publicSuffix, $registerableDomain, $subdomain, $hostPart |
return array( |
array('http://www.waxaudio.com.au/audio/albums/the_mashening', 'com.au', 'waxaudio.com.au', 'www', 'www.waxaudio.com.au'), |
array('example.com', 'com', 'example.com', null, 'example.com'), |
array('giant.yyyy', 'yyyy', 'giant.yyyy', null, 'giant.yyyy'), |
array('cea-law.co.il', 'co.il', 'cea-law.co.il', null, 'cea-law.co.il'), |
array('http://edition.cnn.com/WORLD/', 'com', 'cnn.com', 'edition', 'edition.cnn.com'), |
array('http://en.wikipedia.org/', 'org', 'wikipedia.org', 'en', 'en.wikipedia.org'), |
array('a.b.c.cy', 'c.cy', 'b.c.cy', 'a', 'a.b.c.cy'), |
array('https://test.k12.ak.us', 'k12.ak.us', 'test.k12.ak.us', null, 'test.k12.ak.us'), |
array('www.scottwills.co.uk', 'co.uk', 'scottwills.co.uk', 'www', 'www.scottwills.co.uk'), |
array('b.ide.kyoto.jp', 'ide.kyoto.jp', 'b.ide.kyoto.jp', null, 'b.ide.kyoto.jp'), |
array('a.b.example.uk.com', 'uk.com', 'example.uk.com', 'a.b', 'a.b.example.uk.com'), |
array('test.nic.ar', 'ar', 'nic.ar', 'test', 'test.nic.ar'), |
array('a.b.test.ck', 'test.ck', 'b.test.ck', 'a', 'a.b.test.ck'), |
array('baez.songfest.om', 'om', 'songfest.om', 'baez', 'baez.songfest.om'), |
array('politics.news.omanpost.om', 'om', 'omanpost.om', 'politics.news', 'politics.news.omanpost.om'), |
array('http://localhost', null, null, null, 'localhost'), |
); |
} |
|
} |
/vendor/aura/uri/tests/Aura/Uri/QueryTest.php |
@@ -0,0 +1,68 @@ |
<?php |
namespace Aura\Uri; |
|
/** |
* Test class for Query. |
* Generated by PHPUnit on 2012-07-21 at 15:45:19. |
*/ |
class QueryTest extends \PHPUnit_Framework_TestCase |
{ |
/** |
* @var Query |
*/ |
protected $query; |
|
/** |
* Sets up the fixture, for example, opens a network connection. |
* This method is called before a test is executed. |
*/ |
protected function setUp() |
{ |
parent::setUp(); |
$this->query = new Query; |
} |
|
/** |
* Tears down the fixture, for example, closes a network connection. |
* This method is called after a test is executed. |
*/ |
protected function tearDown() |
{ |
parent::tearDown(); |
} |
|
/** |
* @covers Aura\Uri\Query::__toString |
*/ |
public function test__toString() |
{ |
$query_string = 'foo=bar&baz=dib'; |
$this->query->setFromString($query_string); |
$actual = $this->query->__toString(); |
$this->assertEquals($actual, $query_string); |
} |
|
/** |
* @covers Aura\Uri\Query::setFromString |
*/ |
public function testSetFromString() |
{ |
$query_string = 'foo=bar&baz=dib'; |
$this->query->setFromString($query_string); |
$actual = $this->query->getArrayCopy(); |
$expected = [ |
'foo' => 'bar', |
'baz' => 'dib', |
]; |
$this->assertEquals($actual, $expected); |
} |
|
public function test_deepArrays() |
{ |
$query_string = 'foo[bar]=baz&zim[gir]=dib'; |
$this->query->setFromString($query_string); |
$expect = 'foo%5Bbar%5D=baz&zim%5Bgir%5D=dib'; |
$actual = $this->query->__toString(); |
$this->assertEquals($expect, $actual); |
} |
} |
/vendor/aura/uri/tests/Aura/Uri/Url/FactoryTest.php |
@@ -0,0 +1,135 @@ |
<?php |
namespace Aura\Uri\Url; |
|
use Aura\Uri\PublicSuffixList; |
|
/** |
* Test class for Factory. |
* Generated by PHPUnit on 2012-07-21 at 17:13:55. |
*/ |
class FactoryTest extends \PHPUnit_Framework_TestCase |
{ |
protected function newFactory($server = []) |
{ |
$psl = new PublicSuffixList([]); |
return new Factory($server, $psl); |
} |
|
/** |
* @covers Aura\Uri\Url\Factory::newInstance |
*/ |
public function testNewInstance() |
{ |
$factory = $this->newFactory([]); |
$spec = 'http://anonymous:guest@example.com/path/to/index.php/foo/bar.xml?baz=dib#anchor'; |
$url = $factory->newInstance($spec); |
$this->assertTrue($url instanceof \Aura\Uri\Url); |
} |
|
/** |
* @covers Aura\Uri\Url\Factory::newCurrent |
*/ |
public function testNewCurrent() |
{ |
$factory = $this->newFactory([ |
'HTTP_HOST' => 'example.com', |
'REQUEST_URI' => '/path/to/index.php/foo/bar.xml?baz=dib', |
]); |
|
$url = $factory->newCurrent(); |
$actual = $url->__toString(); |
$expect = 'http://example.com/path/to/index.php/foo/bar.xml?baz=dib'; |
$this->assertSame($expect, $actual); |
} |
|
public function testNewCurrent_https() |
{ |
$factory = $this->newFactory([ |
'HTTPS' => 'on', |
'HTTP_HOST' => 'example.com', |
'REQUEST_URI' => '/path/to/index.php/foo/bar.xml?baz=dib', |
]); |
|
$url = $factory->newCurrent(); |
$actual = $url->__toString(); |
$expect = 'https://example.com/path/to/index.php/foo/bar.xml?baz=dib'; |
$this->assertSame($expect, $actual); |
} |
|
public function testNewCurrent_ssl() |
{ |
$factory = $this->newFactory([ |
'SERVER_PORT' => '443', |
'HTTP_HOST' => 'example.com', |
'REQUEST_URI' => '/path/to/index.php/foo/bar.xml?baz=dib', |
]); |
|
$url = $factory->newCurrent(); |
$actual = $url->__toString(); |
$expect = 'https://example.com/path/to/index.php/foo/bar.xml?baz=dib'; |
$this->assertSame($expect, $actual); |
} |
|
public function testNewCurrent_noHttpHost() |
{ |
$factory = $this->newFactory([ |
'REQUEST_URI' => '/path/to/index.php/foo/bar.xml?baz=dib', |
]); |
|
$url = $factory->newCurrent(); |
$actual = $url->__toString(); |
$expect = ''; |
$this->assertSame($expect, $actual); |
} |
|
public function testNewCurrent_noRequestUri() |
{ |
$factory = $this->newFactory([ |
'HTTP_HOST' => 'example.com', |
]); |
|
$url = $factory->newCurrent(); |
$actual = $url->__toString(); |
$expect = 'http://example.com'; |
$this->assertSame($expect, $actual); |
} |
|
public function testIssue9() |
{ |
$factory = $this->newFactory([ |
'HTTP_HOST' => 'example.com', |
]); |
$string = 'http://localhost:8000/site/foo/bar'; |
$url = $factory->newInstance($string); |
$this->assertSame(array('site', 'foo', 'bar'), $url->path->getArrayCopy()); |
} |
|
public function testNewInstance_noScheme() |
{ |
$factory = $this->newFactory([]); |
$string = 'example.com'; |
$url = $factory->newInstance($string); |
$actual = $url->__toString(); |
$expect = 'http://example.com'; |
$this->assertSame($expect, $actual); |
} |
|
public function testNewInstance_schemeless() |
{ |
$factory = $this->newFactory([]); |
$string = '//example.com'; |
$url = $factory->newInstance($string); |
$actual = $url->__toString(); |
$expect = 'http://example.com'; |
$this->assertSame($expect, $actual); |
} |
|
public function testNewInstance_ftpUrl() |
{ |
$factory = $this->newFactory([]); |
$string = 'ftp://ftp.example.com'; |
$url = $factory->newInstance($string); |
$actual = $url->__toString(); |
$this->assertSame($string, $actual); |
} |
} |
/vendor/aura/uri/tests/Aura/Uri/UrlTest.php |
@@ -0,0 +1,210 @@ |
<?php |
namespace Aura\Uri; |
|
use Aura\Uri\Url\Factory as UrlFactory; |
|
/** |
* Test class for Url. |
* Generated by PHPUnit on 2012-07-21 at 15:46:30. |
*/ |
class UrlTest extends \PHPUnit_Framework_TestCase |
{ |
/** |
* @var Url |
*/ |
protected $url; |
|
/** |
* @var string Url spec |
*/ |
protected $spec = 'http://anonymous:guest@example.com/path/to/index.php/foo/bar.xml?baz=dib#anchor'; |
|
/** |
* @var PublicSuffixList Public Suffix List |
*/ |
protected $psl; |
|
/** |
* Sets up the fixture, for example, opens a network connection. |
* This method is called before a test is executed. |
*/ |
protected function setUp() |
{ |
parent::setUp(); |
$file = dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR |
. 'data' . DIRECTORY_SEPARATOR |
. 'public-suffix-list.php'; |
$this->psl = new PublicSuffixList(require $file); |
$factory = new UrlFactory([], $this->psl); |
$this->url = $factory->newInstance($this->spec); |
} |
|
/** |
* Tears down the fixture, for example, closes a network connection. |
* This method is called after a test is executed. |
*/ |
protected function tearDown() |
{ |
parent::tearDown(); |
} |
|
public function test__construct() |
{ |
$url = new Url( |
'http', |
'username', |
'password', |
new Host( |
$this->psl, |
[ |
'subdomain' => null, |
'registerableDomain' => 'example.com', |
'publicSuffix' => 'com' |
] |
), |
'80', |
new Path(['foo', 'bar']), |
new Query(['baz' => 'dib', 'zim' => 'gir']), |
'fragment' |
); |
|
$this->assertInstanceOf('Aura\Uri\Url', $url); |
} |
|
/** |
* @covers Aura\Uri\Url::__toString |
*/ |
public function test__toString() |
{ |
$actual = $this->url->__toString(); |
$this->assertSame($this->spec, $actual); |
} |
|
/** |
* @covers Aura\Uri\Url::__get |
*/ |
public function test__get() |
{ |
$expected = [ |
'scheme' => 'http', |
'user' => 'anonymous', |
'pass' => 'guest', |
'host' => 'example.com', |
'fragment' => 'anchor' |
]; |
$this->assertEquals($expected['scheme'], $this->url->scheme); |
$this->assertEquals($expected['user'], $this->url->user); |
$this->assertEquals($expected['pass'], $this->url->pass); |
$this->assertEquals($expected['host'], $this->url->host); |
$this->assertEquals($expected['fragment'], $this->url->fragment); |
} |
|
/** |
* @covers Aura\Uri\Url::get |
*/ |
public function testGet() |
{ |
$actual = $this->url->get(); |
$expected = '/path/to/index.php/foo/bar.xml?baz=dib#anchor'; |
$this->assertSame($expected, $actual); |
} |
|
/** |
* @covers Aura\Uri\Url::getFull |
*/ |
public function testGetFull() |
{ |
$actual = $this->url->getFull(); |
$this->assertSame($this->spec, $actual); |
} |
|
/** |
* @covers Aura\Uri\Url::getSchemeless |
*/ |
public function testGetSchemeless() |
{ |
$schemeless = substr_replace($this->spec, '', 0, 5); |
$actual = $this->url->getSchemeless(); |
$this->assertSame($schemeless, $actual); |
} |
|
/** |
* @covers Aura\Uri\Url::setScheme |
*/ |
public function testSetScheme() |
{ |
$scheme = 'https'; |
$this->url->setScheme($scheme); |
$this->assertSame($scheme, $this->url->scheme); |
} |
|
/** |
* @covers Aura\Uri\Url::setUser |
*/ |
public function testSetUser() |
{ |
$guest = 'guest'; |
$this->url->setUser($guest); |
$this->assertSame($guest, $this->url->user); |
} |
|
/** |
* @covers Aura\Uri\Url::setPass |
*/ |
public function testSetPass() |
{ |
$password = 'password'; |
$this->url->setPass($password); |
$this->assertSame($password, $this->url->pass); |
} |
|
/** |
* @covers Aura\Uri\Url::setHost |
*/ |
public function testSetHost() |
{ |
$host = new Host($this->psl); |
$this->url->setHost($host); |
$this->assertSame($host, $this->url->host); |
} |
|
/** |
* @covers Aura\Uri\Url::setPort |
*/ |
public function testSetPort() |
{ |
$port = '8000'; |
$this->url->setPort($port); |
$this->assertSame($port, $this->url->port); |
} |
|
/** |
* @covers Aura\Uri\Url::setPath |
*/ |
public function testSetPath() |
{ |
$path = new Path(); |
$this->url->setPath($path); |
$this->assertSame($path, $this->url->path); |
} |
|
/** |
* @covers Aura\Uri\Url::setQuery |
*/ |
public function testSetQuery() |
{ |
$query = new Query(); |
$this->url->setQuery($query); |
$this->assertSame($query, $this->url->query); |
} |
|
/** |
* @covers Aura\Uri\Url::setFragment |
*/ |
public function testSetFragment() |
{ |
$fragment = '#hello'; |
$this->url->setFragment($fragment); |
$this->assertSame($fragment, $this->url->fragment); |
} |
} |