<commit_before><?php

namespace AlphaVantageTest\Api;

use AlphaVantage\Api\AbstractApi;
use AlphaVantage\Exception\RuntimeException;

class AbstractApiTest extends TestCase
{
    /** @var  \PHPUnit_Framework_MockObject_MockObject */
    protected $class;

    protected function setUp()
    {
        parent::setUp();
        $this->class = $this->getMockForAbstractClass(
            AbstractApi::class, [],
            '',
            false,
            true,
            true,
            null
        );
    }

    public function testConstructor()
    {
        $this->class->__construct($this->option);
        $this->addToAssertionCount(1);
    }

    public function testGetApiUrl()
    {
        $this->class->__construct($this->option);
        $result = $this->getMethod('getApiUri', $this->class)
            ->invokeArgs($this->class, []);

        $this->assertInternalType('string', $result);
        $this->assertSame('https://www.alphavantage.co/query?', $result);
    }

    public function testGetException()
    {
        $this->class->__construct($this->option);
        $this->expectException(RuntimeException::class);
        $this->expectExceptionMessage(
            'The **demo** API key is for demo purposes only. Please claim your free API key at (https://www.alphavantage.co/support/#api-key) so that you could issue any API call as you wish! It takes fewer than 20 seconds, and we are committed to making it free forever.'
        );

        $this->getMethod('get', $this->class)
            ->invokeArgs(
                $this->class,
                [
                    '',<commit_msg>update exception message<commit_after><?php

namespace AlphaVantageTest\Api;

use AlphaVantage\Api\AbstractApi;
use AlphaVantage\Exception\RuntimeException;

class AbstractApiTest extends TestCase
{
    /** @var  \PHPUnit_Framework_MockObject_MockObject */
    protected $class;

    protected function setUp()
    {
        parent::setUp();
        $this->class = $this->getMockForAbstractClass(
            AbstractApi::class, [],
            '',
            false,
            true,
            true,
            null
        );
    }

    public function testConstructor()
    {
        $this->class->__construct($this->option);
        $this->addToAssertionCount(1);
    }

    public function testGetApiUrl()
    {
        $this->class->__construct($this->option);
        $result = $this->getMethod('getApiUri', $this->class)
            ->invokeArgs($this->class, []);

        $this->assertInternalType('string', $result);
        $this->assertSame('https://www.alphavantage.co/query?', $result);
    }

    public function testGetException()
    {
        $this->class->__construct($this->option);
        $this->expectException(RuntimeException::class);
        $this->expectExceptionMessage(
            'The **demo** API key is for demo purposes only. Please claim your free API key at (https://www.alphavantage.co/support/#api-key) to explore our full API offerings. It takes fewer than 20 seconds, and we are committed to making it free forever.'
        );

        $this->getMethod('get', $this->class)
            ->invokeArgs(
                $this->class,
                [
                    '',
{'fraction_non_alphanumeric': 0.13094502779493514, 'fraction_numerical': 0.0018529956763434219, 'mean_word_length': 2.281661600810537, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 51, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, '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': '6249214', 'n_tokens_mistral': 887, 'n_tokens_neox': 869, 'n_words': 189}