public function testWithPortRaisesExceptionForInvalidPorts($port) { $uri = new Uri('https://user:[email protected]:3001/foo?bar=baz#quz'); $this->setExpectedException('InvalidArgumentException', 'Invalid port'); $new = $uri->withPort($port); }