/** * @test * @depends URI\GenerateTest::Reset */ public function Query_Add() { // 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'); // Check For Errors $this->assertEmpty($uri1->error); $this->assertEmpty($uri2->error); $this->assertTrue($uri1->query_add('a', 'b')); $this->assertEquals('example.com?a=b', $uri1->str()); $this->assertTrue($uri1->query_add('1', '2')); $this->assertEquals('example.com?a=b&1=2', $uri1->str()); $this->assertTrue($uri1->query_add('empty', '')); $this->assertEquals('example.com?a=b&1=2&empty=', $uri1->str()); $this->assertFalse($uri2->query_add('query', 'something else')); $this->assertEquals($uri2->input, $uri2->str()); }