getMockBuilder(RequestSenderInterface::class) ->onlyMethods(['send', 'route', 'host']) ->getMock(); $mock->method('send') ->with(RequestMethod::GET, $baseUrl . '/method') ->willReturn([$baseUrl]); $mock->method('route') ->withAnyParameters() ->willReturn($baseUrl . '/method'); static::assertEquals([$baseUrl], (new CustomApiMethod(RequestMethod::GET, 'method'))($mock)); } public function testRawRoute(): void { $baseUrl = 'https://test.simla.io/api/v5'; $mock = $this->getMockBuilder(RequestSenderInterface::class) ->onlyMethods(['send', 'route', 'host']) ->getMock(); $mock->method('send') ->with(RequestMethod::GET, 'method') ->willReturn([$baseUrl]); $mock->method('route') ->withAnyParameters() ->willReturn(''); static::assertEquals( [$baseUrl], (new CustomApiMethod(RequestMethod::GET, 'method'))->useRouteAsUri()($mock) ); } }