Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update testsuite; normalizing/parsing fixes #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tentwofour
Copy link

Thanks for picking this up from asgrim and continuing on!

I'm using this library for a personal project, and ran into issues with the OFX::parse() method, specifically with the parseDate(). The OFX data from my financial institution (credit card) outputs the date and offset, but not the timezone abbreviation, so the preg_match() call was failing, but then tried to pass a date like '20240501094851[-8]' to the DateTime::__construct(). I altered the preg_match a bit to allow the optional bits - that might be purely an error with the data my FI provides, but feel the changes are in line with the library's motto of "Our aim is to make the process of importing OFX files as straightforward and hassle-free as possible. "

I looked at the test suite, but noticed that not all fixtures were being tested, so it's been updated to test parsing all fixtures, including a new fixture, based on my FI export.

There was also an issue in OFXUtils::normalizeOfx() where a preg_match on /.*</OFX>/ was returning too early, making the test on tests/fixtures/ofxdata-oneline.ofx fail.

All tests are passing, but I haven't looked to see if they're actually valid OFX documents - some of the other alterations in OFX::parseBankAccount() deal with missing xml nodes (BANKACCTFROM->{ACCTID, ACCTTYPE, BRANCHID, BANKID), and simply assign 'N/A' to the BankAccount constructor for those values.

Alter OFXTest to test all .ofx files in /tests/fixtures
Fix issue with oneline testOfxDataOneline/OFXUtils::normalizeOfx()
 - If no matching <?xml tag, parse on existence of <OFX> tags; don't return the str_replace value, replace the $ofxSgml variable and continue to normalize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant