<commit_before><?php

/*
 * This file is part of the Ivory Http Adapter package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please read the LICENSE
 * file that was distributed with this source code.
 */

namespace Ivory\Tests\HttpAdapter;

use Buzz\Browser;
use Buzz\Client\Curl;
use Buzz\Client\MultiCurl;
use Ivory\HttpAdapter\BuzzHttpAdapter;
use Ivory\HttpAdapter\CurlHttpAdapter;
use Ivory\HttpAdapter\Guzzle3HttpAdapter;
use Ivory\HttpAdapter\Guzzle4HttpAdapter;
use Ivory\HttpAdapter\HttpfulHttpAdapter;

/**
 * Disabled http adapter test.
 *
 * @author GeLo <<EMAIL>>
 */
class DisabledHttpAdapterTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @expectedException \Ivory\HttpAdapter\HttpAdapterException
     */
    public function testBuzzHttpAdapterWithMultiCurl()
    {
        new BuzzHttpAdapter(new Browser(new MultiCurl()));
    }

    public function testBuzzCurlHttpAdapterWithoutCurl()
    {
        if (function_exists('curl_init')) {
            $this->markTestSkipped();
        }

        $this->setExpectedException('\Ivory\HttpAdapter\HttpAdapterException');
        new BuzzHttpAdapter(new Browser(new Curl()));
    }

    public function testCurlHttpAdapterWithoutCurl()
    {
        if (function_exists('curl_init')) {
            $this->markTestSkipped();
        }

        $this->setExpectedException('\Ivory\HttpAdapter\HttpAdapterException');
        new CurlHttpAdapter();
    }

    public function testGuzzle3HttpAdapterWithoutCurl()
    {
        if (function_exists('curl_init')) {
            $this->markTestSkipped();
        }

        $this->setExpectedException('\Ivory\HttpAdapter\HttpAdapterException');
        new Guzzle3HttpAdapter();
    }

    public function testGuzzle4HttpAdapterWithoutCurl()
    {
        if (function_exists('curl_init')) {
            $this->markTestSkipped();
        }

        $this->setExpectedException('\Ivory\HttpAdapter\HttpAdapterException');
        new Guzzle4HttpAdapter();
    }

    public function testHttpfulHttpAdapterWithoutCurl()
    {
        if (function_exists('curl_init')) {
            $this->markTestSkipped();
        }

        $this->setExpectedException('\Ivory\HttpAdapter\HttpAdapterException');
        new HttpfulHttpAdapter();
    }
}<commit_msg>Fix tests when guzzle 4 is not installed<commit_after><?php

/*
 * This file is part of the Ivory Http Adapter package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please read the LICENSE
 * file that was distributed with this source code.
 */

namespace Ivory\Tests\HttpAdapter;

use Buzz\Browser;
use Buzz\Client\Curl;
use Buzz\Client\MultiCurl;
use Ivory\HttpAdapter\BuzzHttpAdapter;
use Ivory\HttpAdapter\CurlHttpAdapter;
use Ivory\HttpAdapter\Guzzle3HttpAdapter;
use Ivory\HttpAdapter\Guzzle4HttpAdapter;
use Ivory\HttpAdapter\HttpfulHttpAdapter;

/**
 * Disabled http adapter test.
 *
 * @author GeLo <<EMAIL>>
 */
class DisabledHttpAdapterTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @expectedException \Ivory\HttpAdapter\HttpAdapterException
     */
    public function testBuzzHttpAdapterWithMultiCurl()
    {
        new BuzzHttpAdapter(new Browser(new MultiCurl()));
    }

    public function testBuzzCurlHttpAdapterWithoutCurl()
    {
        if (function_exists('curl_init')) {
            $this->markTestSkipped();
        }

        $this->setExpectedException('\Ivory\HttpAdapter\HttpAdapterException');
        new BuzzHttpAdapter(new Browser(new Curl()));
    }

    public function testCurlHttpAdapterWithoutCurl()
    {
        if (function_exists('curl_init')) {
            $this->markTestSkipped();
        }

        $this->setExpectedException('\Ivory\HttpAdapter\HttpAdapterException');
        new CurlHttpAdapter();
    }

    public function testGuzzle3HttpAdapterWithoutCurl()
    {
        if (function_exists('curl_init')) {
            $this->markTestSkipped();
        }

        $this->setExpectedException('\Ivory\HttpAdapter\HttpAdapterException');
        new Guzzle3HttpAdapter();
    }

    public function testGuzzle4HttpAdapterWithoutCurl()
    {
        if (function_exists('curl_init') || !class_exists('GuzzleHttp/Client')) {
            $this->markTestSkipped();
        }

        $this->setExpectedException('\Ivory\HttpAdapter\HttpAdapterException');
        new Guzzle4HttpAdapter();
    }

    public function testHttpfulHttpAdapterWithoutCurl()
    {
        if (function_exists('curl_init')) {
            $this->markTestSkipped();
        }

        $this->setExpectedException('\Ivory\HttpAdapter\HttpAdapterException');
        new HttpfulHttpAdapter();
    }
}
{'fraction_non_alphanumeric': 0.11046885035324341, 'fraction_numerical': 0.0027831299507600086, 'mean_word_length': 3.197663971248877, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 33, 'https://': 0, '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': '6984650', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1347, 'n_words': 244}