<commit_before><?php

use \Mockery as m;
use \Exception;
use \PHPUnit_Framework_Assert as PHPUnit;

/*
* 
*/
class CacheTest extends TestCase
{


    public function testSetCache() {
        $asset_info = $this->sampleLTBCoinAssetInfo();

        $cache = $this->app->make('Tokenly\CounterpartyAssetInfoCache\Cache');
        $cache->set('LTBCOIN', $asset_info);

        PHPUnit::assertEquals($asset_info, $cache->getFromCache('LTBCOIN'));
    }

    public function testIsDivisible() {
        $cache = $this->app->make('Tokenly\CounterpartyAssetInfoCache\Cache');

        $cache->set('LTBCOIN', $this->sampleLTBCoinAssetInfo());
        PHPUnit::assertTrue($cache->isDivisible('LTBCOIN'));

        $cache->set('EARLY', $this->sampleEtherAssetInfo());
        PHPUnit::assertFalse($cache->isDivisible('EARLY'));
    }

    public function testXCPDClient() {
        $asset_info = $this->sampleLTBCoinAssetInfo();
        $cache = $this->app->make('Tokenly\CounterpartyAssetInfoCache\Cache');
        PHPUnit::assertEquals($asset_info, $cache->get('LTBCOIN'));
        PHPUnit::assertEquals($asset_info, $cache->getFromCache('LTBCOIN'));
    }


    /**
     * Define environment setup.
     *
     * @param  \Illuminate\Foundation\Application  $app
     * @return void
     */
    protected function getEnvironmentSetUp($app)
    {
        $app->bind('Tokenly\XCPDClient\Client', function() {
            $client = m::mock('Tokenly\XCPDClient\Client');
            $client->shouldReceive('get_asset_info')->with(['assets' => ['LTBCOIN']])->andReturn([$this->sampleLTBCoinAssetInfo()]);
            return $client;
        });
    }



    protected function sampleLTBCoinAssetInfo() {
        return json_decode($_j=<<<EOT
    {
        "asset": "LTBCOIN",
        "callable": false,
        "call_date": 0,
        "description": "Crypto-Rewards Program http://ltbcoin.com",
        "owner": "<KEY>",
        "call_price": 0,
        "divisible": true,
        "supply": 17731189327990000,
        "locked": false,
        "issuer": "<KEY>"
    }
EOT
, true);
    }

    protected function sampleEtherAssetInfo() {
        return json_decode($_j=<<<EOT
    {
        "asset": "EARLY",
        "callable": false,
        "call_date": 0,
        "description": "http://letstalkbitcoin.com/blog/post/tcv",
        "owner": "<KEY>",
        "call_price": 0,
        "divisible": false,
        "supply": 2401,
        "locked": true,
        "issuer": "<KEY>"
    }
EOT
, true);
    }

}<commit_msg>changed sample function name to Early<commit_after><?php

use \Mockery as m;
use \Exception;
use \PHPUnit_Framework_Assert as PHPUnit;

/*
* 
*/
class CacheTest extends TestCase
{


    public function testSetCache() {
        $asset_info = $this->sampleLTBCoinAssetInfo();

        $cache = $this->app->make('Tokenly\CounterpartyAssetInfoCache\Cache');
        $cache->set('LTBCOIN', $asset_info);

        PHPUnit::assertEquals($asset_info, $cache->getFromCache('LTBCOIN'));
    }

    public function testIsDivisible() {
        $cache = $this->app->make('Tokenly\CounterpartyAssetInfoCache\Cache');

        $cache->set('LTBCOIN', $this->sampleLTBCoinAssetInfo());
        PHPUnit::assertTrue($cache->isDivisible('LTBCOIN'));

        $cache->set('EARLY', $this->sampleEarlyAssetInfo());
        PHPUnit::assertFalse($cache->isDivisible('EARLY'));
    }

    public function testXCPDClient() {
        $asset_info = $this->sampleLTBCoinAssetInfo();
        $cache = $this->app->make('Tokenly\CounterpartyAssetInfoCache\Cache');
        PHPUnit::assertEquals($asset_info, $cache->get('LTBCOIN'));
        PHPUnit::assertEquals($asset_info, $cache->getFromCache('LTBCOIN'));
    }


    /**
     * Define environment setup.
     *
     * @param  \Illuminate\Foundation\Application  $app
     * @return void
     */
    protected function getEnvironmentSetUp($app)
    {
        $app->bind('Tokenly\XCPDClient\Client', function() {
            $client = m::mock('Tokenly\XCPDClient\Client');
            $client->shouldReceive('get_asset_info')->with(['assets' => ['LTBCOIN']])->andReturn([$this->sampleLTBCoinAssetInfo()]);
            return $client;
        });
    }



    protected function sampleLTBCoinAssetInfo() {
        return json_decode($_j=<<<EOT
    {
        "asset": "LTBCOIN",
        "callable": false,
        "call_date": 0,
        "description": "Crypto-Rewards Program http://ltbcoin.com",
        "owner": "1Hso4cqKAyx9bsan8b5nbPqMTNNce8ZDto",
        "call_price": 0,
        "divisible": true,
        "supply": 17731189327990000,
        "locked": false,
        "issuer": "1Hso4cqKAyx9bsan8b5nbPqMTNNce8ZDto"
    }
EOT
, true);
    }

    protected function sampleEarlyAssetInfo() {
        return json_decode($_j=<<<EOT
    {
        "asset": "EARLY",
        "callable": false,
        "call_date": 0,
        "description": "http://letstalkbitcoin.com/blog/post/tcv",
        "owner": "1MCEtBB5X4ercRsvq2GmgysZ9ZDsqj8Xh7",
        "call_price": 0,
        "divisible": false,
        "supply": 2401,
        "locked": true,
        "issuer": "<KEY>"
    }
EOT
, true);
    }

}
{'fraction_non_alphanumeric': 0.16239483467031893, 'fraction_numerical': 0.01350029348464097, 'mean_word_length': 2.8378378378378377, 'pattern_counts': {'":': 40, '<': 22, '<?xml version=': 0, '>': 56, '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': '6478435', 'n_tokens_mistral': 1713, 'n_tokens_neox': 1653, 'n_words': 251}