/** * @test * @depends URI\ParseTest::Advanced_Parsing */ public function Invalid_Section_Errors() { $uri1 = new \uri('https://*****:*****@example.com:777/path/to/script.php?query=str#fragment'); // Invalid section to modify $this->assertEquals(FALSE, $uri1->append('invalid', '')); $this->assertEquals(FALSE, $uri1->prepend('invalid', '')); $this->assertEquals(FALSE, $uri1->replace('invalid', '')); }
/** * @test * @depends URI\GenerateTest::Reset */ public function Modify_Fragment() { // 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); // Check Replace $this->assertEquals('example.com#top', $uri1->replace('FRAGMENT', '#top')); $this->assertEquals('example.com#header', $uri1->replace('FRAGMENT', 'header')); $this->assertEquals('https://*****:*****@example.com:777/path/to/script.php?query=str#footer', $uri2->replace('FRAGMENT', 'footer')); // Check Prepend $this->assertEquals('example.com#custom-header', $uri1->prepend('FRAGMENT', 'custom-')); // Check Append $this->assertEquals('https://*****:*****@example.com:777/path/to/script.php?query=str#footer-end', $uri2->append('FRAGMENT', '-end')); }