<commit_before><?php

/**
 * This file is part of slick/http package
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Slick\Tests\Http;

use PHPUnit_Framework_TestCase as TestCase;
use Slick\Http\Client;
use Slick\Http\Request;
use Slick\Http\Response;

/**
 * HTTP Client test case
 *
 * @package Slick\Tests\Http
 */
class ClientTest extends TestCase
{

    /**
     * @var Client
     */
    protected $client;

    protected function setUp()
    {
        parent::setUp();
        $this->client = new Client(['base_uri' => 'https://api.github.com']);
    }

    public function testGetApiCall()
    {
        $request = new Request(Request::METHOD_GET, '/users/silvamfilipe/orgs');
        $response = $this->client->send($request);
        $this->assertInstanceOf(Response::class, $response);
        return $response;
    }

    /**
     * @param Response $response
     * @test
     * @depends testGetApiCall
     */
    public function validateBody(Response $response)
    {
        $data = $response->getBody()->getContents();
        $object = json_decode($data);
        $this->assertEquals('slickframework', $object[0]->login);
    }
}<commit_msg>Fixing failing test<commit_after><?php

/**
 * This file is part of slick/http package
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Slick\Tests\Http;

use PHPUnit_Framework_TestCase as TestCase;
use Slick\Http\Client;
use Slick\Http\Request;
use Slick\Http\Response;

/**
 * HTTP Client test case
 *
 * @package Slick\Tests\Http
 */
class ClientTest extends TestCase
{

    /**
     * @var Client
     */
    protected $client;

    protected function setUp()
    {
        parent::setUp();
        $this->client = new Client(['base_uri' => 'https://httpbin.org']);
    }

    public function testGetApiCall()
    {
        $request = new Request(Request::METHOD_GET, '/get');
        $response = $this->client->send($request);
        $this->assertInstanceOf(Response::class, $response);
        return $response;
    }

    /**
     * @param Response $response
     * @test
     * @depends testGetApiCall
     */
    public function validateBody(Response $response)
    {
        $data = $response->getBody()->getContents();
        $object = json_decode($data);
        $this->assertEquals('httpbin.org', $object->headers->Host);
    }
}
{'fraction_non_alphanumeric': 0.13547094188376754, 'fraction_numerical': 0.0004008016032064128, 'mean_word_length': 2.84, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3059134', 'n_tokens_mistral': 733, 'n_tokens_neox': 724, 'n_words': 182}