<commit_before><?php

namespace OfxParser;

require_once __DIR__ . '/../../vendor/autoload.php';

class OfxTest extends \PHPUnit_Framework_TestCase
{
    protected $ofxdata;

    public function setUp()
    {
        $ofxFile = dirname(__DIR__).'/fixtures/ofxdata-xml.ofx';

        if (!file_exists($ofxFile))
        {
            $this->markTestSkipped('Could not find data file, cannot test Ofx Class');
        }
        $this->ofxdata = simplexml_load_string( file_get_contents($ofxFile) );
    }

    public function testAcceptOnlySimpleXMLElement()
    {
        $this->setExpectedException('\TypeError');
        new Ofx('This is not an SimpleXMLObject');
    }

    public function testCreateDateTimeFromOFXDateFormats()
    {
        // October 5, 2008, at 1:22 and 124 milliseconds pm, Easter Standard Time
        $expectedDateTime = new \DateTime('2008-10-05 13:22:00');<commit_msg>Fixed test wrong Ofx constructor usage.<commit_after><?php

namespace OfxParser;

require_once __DIR__ . '/../../vendor/autoload.php';

class OfxTest extends \PHPUnit_Framework_TestCase
{
    protected $ofxdata;

    public function setUp()
    {
        $ofxFile = dirname(__DIR__).'/fixtures/ofxdata-xml.ofx';

        if (!file_exists($ofxFile))
        {
            $this->markTestSkipped('Could not find data file, cannot test Ofx Class');
        }
        $this->ofxdata = simplexml_load_string( file_get_contents($ofxFile) );
    }

    /**
     * @expectedException PHPUnit_Framework_Error
     * @expectedExceptionMessage Argument 1 passed to OfxParser\Ofx::__construct() must be an instance of SimpleXMLElement, string given
     */
    public function testAcceptOnlySimpleXMLElement()
    {
        new Ofx('This is not an SimpleXMLObject');
    }

    public function testCreateDateTimeFromOFXDateFormats()
    {
        // October 5, 2008, at 1:22 and 124 milliseconds pm, Easter Standard Time
        $expectedDateTime = new \DateTime('2008-10-05 13:22:00');
{'fraction_non_alphanumeric': 0.11015228426395939, 'fraction_numerical': 0.025888324873096447, 'mean_word_length': 3.0389344262295084, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '93838', 'n_tokens_mistral': 631, 'n_tokens_neox': 584, 'n_words': 141}