/**
  * @test
  * @depends URI\GenerateTest::Reset
  */
 public function Chain_Errors()
 {
     $uri1 = new \uri('example.com');
     // Check For Errors
     $this->assertEmpty($uri1->error);
     // none of these do anything, but they should all still return the chain class
     @$uri1->chain()->str()->to_string()->arr()->to_array()->path_info()->query_array()->query_exists()->query_get();
     $this->assertSame(8, $uri1->chain()->error_count);
     // invalid inputs (no notices)
     $uri1->chain()->replace('SCHEME', '/invalid/')->prepend('SCHEME', '/invalid/')->append('SCHEME', '/invalid/')->query_rename('does_not_exist', 'nothing');
     $this->assertSame(12, $uri1->chain()->error_count);
     $this->assertEquals($uri1->input, $uri1->str());
 }
 /**
  * @test
  * @depends Reset
  */
 public function Sudo_Magic_Constants()
 {
     // Test both when there is and isn't pre-existing data
     $uri1 = new \uri('https://*****:*****@example.com:777/path/to/script.php?query=str#fragment');
     $uri2 = new \uri('google.com');
     // Check For Errors
     $this->assertEmpty($uri1->error);
     $this->assertEmpty($uri2->error);
     // __get() (parser checks normal __get())
     $this->assertSame(NULL, @$uri1->does_not_exist);
     // __set()
     $uri2->scheme_name = 'http';
     $this->assertEquals('http://google.com', $uri2->str());
     $uri2->scheme_symbols = ':';
     $this->assertEquals('http:google.com', $uri2->str());
     $uri2->scheme = 'https://';
     $this->assertEquals('https://google.com', $uri2->str());
     $uri2->user = '******';
     $this->assertEquals('https://username@google.com', $uri2->str());
     $uri2->pass = '******';
     $this->assertEquals('https://*****:*****@google.com', $uri2->str());
     $uri2->host = 'facebook.com';
     $this->assertEquals('https://*****:*****@facebook.com', $uri2->str());
     $uri2->port = '8181';
     $this->assertEquals('https://*****:*****@facebook.com:8181', $uri2->str());
     $uri2->path = '/index.php';
     $this->assertEquals('https://*****:*****@facebook.com:8181/index.php', $uri2->str());
     $uri2->query = 'q=1';
     $this->assertEquals('https://*****:*****@facebook.com:8181/index.php?q=1', $uri2->str());
     $uri2->fragment = 'frag';
     $this->assertEquals('https://*****:*****@facebook.com:8181/index.php?q=1#frag', $uri2->str());
     $uri2->reset();
     @($uri1->does_not_exist = 'nothing');
     $this->assertSame(NULL, @$uri1->does_not_exist);
     // __isset()
     $this->assertTrue(isset($uri1->scheme_name));
     $this->assertFalse(isset($uri2->scheme_name));
     $this->assertTrue(isset($uri1->scheme_symbols));
     $this->assertFalse(isset($uri2->scheme_symbols));
     $this->assertTrue(isset($uri1->scheme));
     $this->assertFalse(isset($uri2->scheme));
     $this->assertTrue(isset($uri1->user));
     $this->assertFalse(isset($uri2->user));
     $this->assertTrue(isset($uri1->pass));
     $this->assertFalse(isset($uri2->pass));
     $this->assertTrue(isset($uri1->host));
     $this->assertTrue(isset($uri2->host));
     $this->assertTrue(isset($uri1->port));
     $this->assertFalse(isset($uri2->port));
     $this->assertTrue(isset($uri1->path));
     $this->assertFalse(isset($uri2->path));
     $this->assertTrue(isset($uri1->query));
     $this->assertFalse(isset($uri2->query));
     $this->assertTrue(isset($uri1->fragment));
     $this->assertFalse(isset($uri2->fragment));
     $this->assertFalse(isset($uri1->does_not_exist));
     // __unset()
     unset($uri1->scheme_name);
     $this->assertSame('', $uri1->scheme_name);
     $uri1->reset();
     unset($uri1->scheme_symbols);
     $this->assertSame('', $uri1->scheme_symbols);
     $uri1->reset();
     unset($uri1->scheme);
     $this->assertSame('', $uri1->scheme);
     $uri1->reset();
     unset($uri1->user);
     $this->assertSame('', $uri1->user);
     $uri1->reset();
     unset($uri1->pass);
     $this->assertSame('', $uri1->pass);
     $uri1->reset();
     error_reporting(0);
     unset($uri1->host);
     // Language Construct
     error_reporting(-1);
     $this->assertEquals('example.com', $uri1->host);
     unset($uri1->port);
     $this->assertSame('', $uri1->port);
     $uri1->reset();
     unset($uri1->path);
     $this->assertSame('', $uri1->path);
     $uri1->reset();
     unset($uri1->query);
     $this->assertSame('', $uri1->query);
     $uri1->reset();
     unset($uri1->fragment);
     $this->assertSame('', $uri1->fragment);
     $uri1->reset();
     error_reporting(0);
     unset($uri1->does_not_exist);
     // Language Construct
     error_reporting(-1);
     $this->assertSame(NULL, @$uri1->does_not_exist);
 }
 /**
  * @test
  * @depends URI\GenerateTest::Reset
  */
 public function Query_Rename()
 {
     // Test both when there is and isn't pre-existing data
     $uri1 = new \uri('example.com');
     $uri2 = new \uri('https://*****:*****@example.com:777/path/to/script.php?query=str#fragment');
     $uri3 = new \uri('google.com?empty');
     // Check For Errors
     $this->assertEmpty($uri1->error);
     $this->assertEmpty($uri2->error);
     $this->assertFalse($uri1->query_rename('a', 'b'));
     $this->assertEquals($uri1->input, $uri1->str());
     $this->assertTrue($uri2->query_rename('query', 'test'));
     $this->assertEquals('https://*****:*****@example.com:777/path/to/script.php?test=str#fragment', $uri2->str());
     $this->assertTrue($uri3->query_rename('empty', 'none'));
     $this->assertEquals('google.com?none=', $uri3->str());
 }
 /**
  * @test
  * @depends URI\GenerateTest::Reset
  */
 public function Modify_User()
 {
     // Test both when there is and isn't pre-existing data
     $uri1 = new \uri('example.com');
     $uri2 = new \uri('https://*****:*****@example.com:777/path/to/script.php?query=str#fragment');
     $uri3 = new \uri('*****@*****.**');
     // user w/out pass
     // Check For Errors
     $this->assertEmpty($uri1->error);
     $this->assertEmpty($uri2->error);
     // Check Replace
     $this->assertEquals('*****@*****.**', $uri1->replace('USER', 'doe'));
     $this->assertEquals('https://*****:*****@example.com:777/path/to/script.php?query=str#fragment', $uri2->replace('USER', 'john'));
     $uri3->user = '******';
     $this->assertEquals('*****@*****.**', $uri3->str());
     // Check Prepend
     $this->assertEquals('*****@*****.**', $uri1->prepend('USER', 'j'));
     // Check Append
     $this->assertEquals('https://*****:*****@example.com:777/path/to/script.php?query=str#fragment', $uri2->append('USER', 'd'));
     // Check Alias
     $this->assertEquals('*****@*****.**', $uri1->replace('USERNAME', 'dude'));
 }