mattwire / uk.co.compucorp.civicrm.giftaid

1 stars 0 forks source link

Add tests, fix bugs on declarations class #21

Closed artfulrobot closed 4 years ago

artfulrobot commented 4 years ago

This PR adds the first tests to the class in CRM/Civigiftaid/Declaration.php.

The initial test revealed a bug in the simplest case of adding a declaration(!), so this PR will now move on to fixing that.

artfulrobot commented 4 years ago

@mattwire I'm suggesting this be merged now, and then I'll branch off for other issues.

This PR is mostly about adding tests which document/test the expected functionality of the current code/docs. I'm not saying all of that makes perfect sense to me (I'll follow those up in issues), but at least it's a base.

It's also not 100% coverage by any means, but some tests are better than none. There are no tests for batch creation yet, but the main calculations (whether a contrib or person is eligible, and whether a contrib should be eligible for a batch) are reasonably covered for the simple cases.

PS. #24 is the only significant change, so checking that makes sense to you is important.