Skip to content
Snippets Groups Projects
Commit 94875105 authored by Grzegorz Rola's avatar Grzegorz Rola
Browse files

First tests

parent 2f081692
No related branches found
No related tags found
1 merge request!1Feature/first release
Pipeline #4761 passed with stages
in 2 minutes and 10 seconds
<?php
class TestCurlClient extends \PHPUnit\Framework\TestCase
{
/**
* Test get method.
*/
public function testGet()
{
$client = new \WPDesk\HttpClient\Curl\CurlClient();
$response = $client->get('https://www.google.com', '', array(), 15);
$this->assertInstanceOf(\WPDesk\HttpClient\HttpClientResponse::class, $response);
$this->assertEquals(200, $response->getResponseCode());
}
/**
* Test post method.
*/
public function testPost()
{
$client = new \WPDesk\HttpClient\Curl\CurlClient();
$response = $client->post('https://www.google.com', '', array(), 15);
$this->assertInstanceOf(\WPDesk\HttpClient\HttpClientResponse::class, $response);
$this->assertEquals(405, $response->getResponseCode());
}
/**
* Test put method.
*/
public function testPut()
{
$client = new \WPDesk\HttpClient\Curl\CurlClient();
$response = $client->put('https://www.google.com', '', array(), 15);
$this->assertInstanceOf(\WPDesk\HttpClient\HttpClientResponse::class, $response);
$this->assertEquals(405, $response->getResponseCode());
}
/**
* Test delete method.
*/
public function testDelete()
{
$client = new \WPDesk\HttpClient\Curl\CurlClient();
$response = $client->put('https://www.google.com', '', array(), 15);
$this->assertInstanceOf(\WPDesk\HttpClient\HttpClientResponse::class, $response);
$this->assertEquals(405, $response->getResponseCode());
}
}
\ No newline at end of file
......@@ -3,4 +3,19 @@
class TestHttpClientFactory extends \PHPUnit\Framework\TestCase
{
/**
* Test createClient method.
*/
public function testCreateClient()
{
$options = Mockery::mock(\WPDesk\HttpClient\HttpClientOptions::class);
$options->shouldReceive('getHttpClientClass')
->withAnyArgs()
->andReturn(\WPDesk\HttpClient\Curl\CurlClient::class);
$factory = new \WPDesk\HttpClient\HttpClientFactory();
$client = $factory->createClient($options);
$this->assertInstanceOf(\WPDesk\HttpClient\Curl\CurlClient::class, $client);
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment