![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/inventory.corals.io/vendor/league/glide/tests/Urls/ |
<?php namespace League\Glide\Urls; use League\Glide\Signatures\Signature; use PHPUnit\Framework\TestCase; class UrlBuilderTest extends TestCase { public function testCreateInstance() { $this->assertInstanceOf('League\Glide\Urls\UrlBuilder', new UrlBuilder()); } public function testGetUrl() { $urlBuilder = new UrlBuilder('http://example.com'); $this->assertEquals( 'http://example.com/image.jpg?w=100', $urlBuilder->getUrl('image.jpg', ['w' => '100']) ); } public function testGetUrlWithNoDomain() { $urlBuilder = new UrlBuilder(); $this->assertEquals( '/image.jpg?w=100', $urlBuilder->getUrl('image.jpg', ['w' => '100']) ); } public function testGetUrlWithDomainAndPort() { $urlBuilder = new UrlBuilder('http://localhost:8000'); $this->assertEquals( 'http://localhost:8000/image.jpg?w=100', $urlBuilder->getUrl('image.jpg', ['w' => '100']) ); } public function testGetUrlWithProtocolRelativeDomain() { $urlBuilder = new UrlBuilder('//localhost:8000'); $this->assertEquals( '//localhost:8000/image.jpg?w=100', $urlBuilder->getUrl('image.jpg', ['w' => '100']) ); } public function testGetUrlWithToken() { $urlBuilder = new UrlBuilder('http://example.com', new Signature('example-sign-key')); $this->assertEquals( 'http://example.com/image.jpg?w=100&s=e1b69d4b79ecf33283128819fd008906', $urlBuilder->getUrl('image.jpg', ['w' => '100']) ); } public function testGetInvalidUrl() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Not a valid path.'); $urlBuilder = new UrlBuilder(':80'); $urlBuilder->getUrl('image.jpg'); } }