/** * @test */ public function removeProtocol() { //non http $this->assertEquals('www.exemplo.com.br', Str::removeProtocol('//www.exemplo.com.br')); $this->assertEquals('www.exemplo.com.br', Str::removeProtocol('//www.exemplo.com.br/')); $this->assertEquals('www.exemplo.com.br/teste', Str::removeProtocol('//www.exemplo.com.br/teste')); $this->assertEquals('exemplo.com.br', Str::removeProtocol('//exemplo.com.br')); $this->assertEquals('exemplo.com.br', Str::removeProtocol('//exemplo.com.br/')); $this->assertEquals('exemplo.com.br/teste', Str::removeProtocol('//exemplo.com.br/teste')); //http $this->assertEquals('www.exemplo.com.br', Str::removeProtocol('http://www.exemplo.com.br')); $this->assertEquals('www.exemplo.com.br', Str::removeProtocol('http://www.exemplo.com.br/')); $this->assertEquals('www.exemplo.com.br/teste', Str::removeProtocol('http://www.exemplo.com.br/teste')); $this->assertEquals('exemplo.com.br', Str::removeProtocol('http://exemplo.com.br')); $this->assertEquals('exemplo.com.br', Str::removeProtocol('http://exemplo.com.br/')); $this->assertEquals('exemplo.com.br/teste', Str::removeProtocol('http://exemplo.com.br/teste')); //https $this->assertEquals('www.exemplo.com.br', Str::removeProtocol('https://www.exemplo.com.br')); $this->assertEquals('www.exemplo.com.br', Str::removeProtocol('https://www.exemplo.com.br/')); $this->assertEquals('www.exemplo.com.br/teste', Str::removeProtocol('https://www.exemplo.com.br/teste')); $this->assertEquals('exemplo.com.br', Str::removeProtocol('https://exemplo.com.br')); $this->assertEquals('exemplo.com.br', Str::removeProtocol('https://exemplo.com.br/')); $this->assertEquals('exemplo.com.br/testes', Str::removeProtocol('https://exemplo.com.br/testes')); }
/** * Remove protocol of URL. * * @param string $url * * @return string */ function str_remove_protocol($url) { return Str::removeProtocol($url); }