<commit_before><?php

namespace BlockCypher\Test\Functional\Api;

use BlockCypher\Api\Address;
use BlockCypher\Test\Functional\Setup;

/**
 * Class AddressFunctionalTest
 *
 * @package BlockCypher\Test\Api
 */
class AddressFunctionalTest extends \PHPUnit_Framework_TestCase
{

    public $operation;

    public $response;

    public $mockBlockCypherRestCall;

    public $apiContext;

    public function setUp()
    {
        $className = $this->getClassName();
        $testName = $this->getName();
        $operationString = file_get_contents(__DIR__ . "/../resources/$className/$testName.json");
        $this->operation = json_decode($operationString, true);
        $this->response = true;
        if (array_key_exists('body', $this->operation['response'])) {
            $this->response = json_encode($this->operation['response']['body']);
        }
        Setup::SetUpForFunctionalTests($this);
    }

    /**
     * Returns just the classname of the test you are executing. It removes the namespaces.
     * @return string
     */
    public function getClassName()
    {
        return join('', array_slice(explode('\\', get_class($this)), -1));
    }

    /**
     * @return Address
     */
    public function testGet()
    {
        $request = $this->operation['response']['body'];
        $address = new Address($request);

        $result = Address::get($address->getAddress(), array(), $this->apiContext, $this->mockBlockCypherRestCall);
        $this->assertNotNull($result);
        $this->assertEquals($address->getAddress(), $result->getAddress());
        // TODO: all fields should be equal except some values as confirmations
        // Assert only immutable values.
        //$this->assertEquals($address, $result, "", 0, 10, true);
        return $result;
    }
}<commit_msg>Added assert to functional test<commit_after><?php

namespace BlockCypher\Test\Functional\Api;

use BlockCypher\Api\Address;
use BlockCypher\Test\Functional\Setup;

/**
 * Class AddressFunctionalTest
 *
 * @package BlockCypher\Test\Api
 */
class AddressFunctionalTest extends \PHPUnit_Framework_TestCase
{

    public $operation;

    public $response;

    public $mockBlockCypherRestCall;

    public $apiContext;

    public function setUp()
    {
        $className = $this->getClassName();
        $testName = $this->getName();
        $operationString = file_get_contents(__DIR__ . "/../resources/$className/$testName.json");
        $this->operation = json_decode($operationString, true);
        $this->response = true;
        if (array_key_exists('body', $this->operation['response'])) {
            $this->response = json_encode($this->operation['response']['body']);
        }
        Setup::SetUpForFunctionalTests($this);
    }

    /**
     * Returns just the classname of the test you are executing. It removes the namespaces.
     * @return string
     */
    public function getClassName()
    {
        return join('', array_slice(explode('\\', get_class($this)), -1));
    }

    /**
     * @return Address
     */
    public function testGet()
    {
        $request = $this->operation['response']['body'];
        $address = new Address($request);

        $result = Address::get($address->getAddress(), array(), $this->apiContext, $this->mockBlockCypherRestCall);
        $this->assertNotNull($result);
        // Assert only immutable values.
        $this->assertEquals($address->getAddress(), $result->getAddress());
        $this->assertEquals($address->getTxUrl(), $result->getTxUrl());
        $this->assertEquals($address->getTxrefs()[0]->getTxHash(), $result->getTxrefs()[0]->getTxHash());
        return $result;
    }
}
{'fraction_non_alphanumeric': 0.15266757865937072, 'fraction_numerical': 0.0019151846785225718, 'mean_word_length': 3.080357142857143, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 42, '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': '5935554', 'n_tokens_mistral': 1040, 'n_tokens_neox': 1013, 'n_words': 208}