<commit_before><?php
/**
 * This test class provides basic error checking for the InlineDefine object.
 */

require 'InlineDefine.php';

class InlineDefineTest extends PHPUnit_Framework_TestCase
{
    /**
     * Confirm the constructor returns an object.
     *
     * @return object Returns nothing.
     */
    public function testEmptyConstructor()
    {
        $inline_text = new InlineDefine();
        $this->assertNotEmpty($inline_text);
    }

    /**
     * Confirm the getDecoratedText method with a simple test.
     * This should later be replaced with a large textfile and more dynamic
     * set of term => definition pairs, including words within another term's
     * decorated text.
     *
     * @return bool True is test passes.
     */
    public function testGetDecoratedTextSimpleText()
    {
        $test_text = "An apple a day beats two pear.";
        $test_terms = array(
          'apple' =>
                '<a href="http://apple.com" title="fiber-tastic fruit">apple</a>',
          'pear' => '<a href="http://pear.com" title="juicy fruit">pear</a>',
        );

        $inline_text = new InlineDefine();
        $result_text = $inline_text->getDecoratedText($test_text, $test_terms);

        $this->assertEquals(
            $result_text,
            'An <a href="http://apple.com" title="fiber-tastic fruit">apple</a> ' .
            'a day beats two <a href="http://pear.com" title="juicy fruit">pear</a>.'
        );
    }

    /**
    * Try the getDecoratedText method as a static object method.
    *
    * @return bool true if result matches expected.
    */
    public function testGetDecoratedTextAsStaticMethod()
    {
        $test_text = "An apple a day beats two pear.";
        $test_terms = array(
          'apple' =>
              '<a href="http://apple.com" title="fiber-tastic fruit">apple</a>',
          'pear' => '<a href="http://pear.com" title="juicy fruit">pear</a>',
        );

        $result_text = InlineDefine::getDecoratedText($test_text, $test_terms);

        $this->assertEquals(
            $result_text,
            'An <a href="http://apple.com" title="fiber-tastic fruit">apple</a> a' .
            ' day beats two <a href="http://pear.com" title="juicy fruit">pear</a>.'
        );
    }

}
<commit_msg>Committing updated test showing error.<commit_after><?php
/**
 * This test class provides basic error checking for the InlineDefine object.
 */

require 'InlineDefine.php';

class InlineDefineTest extends PHPUnit_Framework_TestCase
{

    private $_simple_terms
        = array(
            'apple' =>
                '<a href="http://apple.com" title="fiber-tastic fruit">apple</a>',
            'pear' => '<a href="http://pear.com" title="juicy fruit">pear</a>',
          );

    /**
     * Initialize consts to be used across tests.
     *
     * @return Returns nothing.
     */
    public static function setUpBeforeClass()
    {
        define(
            'SIMPLE_SENTENCE',
            'An apple a day beats two pear, just ask the guy with the spears'
        );
        define(
            'EXPECTED_RESULT',
            'An <a href="http://apple.com" title="fiber-tastic fruit">apple</a> ' .
            'a day beats two <a href="http://pear.com" title="juicy fruit">pear</a>,' .
            'just ask the guy with the spears'
        );
    }

    /**
     * Confirm the constructor returns an object.
     *
     * @return Returns nothing.
     */
    public function testEmptyConstructor()
    {
        $inline_text = new InlineDefine();
        $this->assertNotEmpty($inline_text);
    }

    /**
     * Confirm the getDecoratedText method with a simple test.
     * This should later be replaced with a large textfile and more dynamic
     * set of term => definition pairs, including words within another term's
     * decorated text.
     *
     * @return bool True is test passes.
     */
    public function testGetDecoratedTextSimpleText()
    {
        $inline_text = new InlineDefine();
        $result_text = $inline_text->getDecoratedText(
            SIMPLE_SENTENCE,
            $this->_simple_terms
        );

        $this->assertEquals(
            $result_text,
            EXPECTED_RESULT
        );
    }

    /**
    * Try the getDecoratedText method as a static object method.
    *
    * @return bool true if result matches expected.
    */
    public function testGetDecoratedTextAsStaticMethod()
    {
        $test_text = "An apple a day beats two pear.";
        $test_terms = array(
          'apple' =>
              '<a href="http://apple.com" title="fiber-tastic fruit">apple</a>',
          'pear' => '<a href="http://pear.com" title="juicy fruit">pear</a>',
        );

        $result_text = InlineDefine::getDecoratedText($test_text, $test_terms);

        $this->assertEquals(
            $result_text,
            'An <a href="http://apple.com" title="fiber-tastic fruit">apple</a> a' .
            ' day beats two <a href="http://pear.com" title="juicy fruit">pear</a>.'
        );
    }

}

{'fraction_non_alphanumeric': 0.12855450236966826, 'fraction_numerical': 0.0, 'mean_word_length': 2.128474366893144, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 54, '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': '6171039', 'n_tokens_mistral': 1528, 'n_tokens_neox': 1480, 'n_words': 385}