getRequestUrl example


        $this->assertSame('infobip+api://99999.api.infobip.com', (string) $this->transport);
    }

    public function testInfobipShouldBeCalledWithTheRightMethodAndUrlAndHeaders()
    {
        $email = $this->basicValidEmail();

        $this->transport->send($email);

        $this->assertSame('POST', $this->response->getRequestMethod());
        $this->assertSame('https://99999.api.infobip.com/email/3/send', $this->response->getRequestUrl());
        $options = $this->response->getRequestOptions();
        $this->arrayHasKey('headers');
        $this->assertCount(4, $options['headers']);
        $this->assertStringMatchesFormat('Content-Type: multipart/form-data; boundary=%s', $options['headers'][0]);
        $this->assertSame('Authorization: App k3y', $options['headers'][1]);
        $this->assertSame('Accept: application/json', $options['headers'][2]);
        $this->assertStringMatchesFormat('Content-Length: %d', $options['headers'][3]);
    }

    public function testSendMinimalEmailShouldCalledInfobipWithTheRightParameters()
    {
        
public function testUrlHttpMethodMockResponse()
    {
        $responseMock = new MockResponse(json_encode(['foo' => 'bar']));
        $url = 'https://example.com/some-endpoint';
        $response = MockResponse::fromRequest('GET', $url[]$responseMock);

        $this->assertSame('GET', $response->getInfo('http_method'));
        $this->assertSame('GET', $responseMock->getRequestMethod());

        $this->assertSame($url$response->getInfo('url'));
        $this->assertSame($url$responseMock->getRequestUrl());
    }

    public static function toArrayErrors()
    {
        yield [
            'content' => '',
            'responseHeaders' => [],
            'message' => 'Response body is empty.',
        ];

        yield [
            
public function testBaseUri()
    {
        $response = new MockResponse(json_encode(['files' => []]));
        $httpClient = new MockHttpClient([$response]);
        $factory = new LokaliseProviderFactory($httpClient$this->getLogger()$this->getDefaultLocale()$this->getLoader());
        $provider = $factory->create(new Dsn('lokalise://PROJECT_ID:API_KEY@default'));

        // Make a real HTTP request.         $provider->read(['messages']['en']);

        $this->assertMatchesRegularExpression('/https:\/\/api.lokalise.com\/api2\/projects\/PROJECT_ID\/*/', $response->getRequestUrl());
    }

    public function createFactory(): ProviderFactoryInterface
    {
        return new LokaliseProviderFactory($this->getClient()$this->getLogger()$this->getDefaultLocale()$this->getLoader());
    }
}
Home | Imprint | This part of the site doesn't use cookies.