Code Review for PHPUnit Tests

iankarlwallace wrote on Sunday, April 06, 2014:

Hello. When anyone has time and can review the PHPUnit testing code it’s
available at:

Commit (deec1d6eddca7f5f9e8543cdf45489edd9badadf) on this branch is to fix
the PHP Unit testing framework. It includes fixes for phpunit.xml and code
corrections for tests (to get this to actually work). I have turned on
Code Coverage so it’s easier to tell what’s being tested.

Comments, improvements, suggestions welcome. I’ll keep working on
expanding the tests over the next several weeks.

cheers
ian


Ian Wallace - Advanced Procedures Fellow - Salud Family Health Center ©
303.681.5732

bradymiller wrote on Friday, April 11, 2014:

Hi Ian,

Seems ok. If I’m using ubuntu, is there a way I can run these tests? And will it be easy to have these tests run automatically on a daily build?

-brady
OpenEMR

iankarlwallace wrote on Saturday, April 12, 2014:

Brady - Don’t have my laptop with me this weekend (working in Eastern
Colorado covering a hospital here …) but I think I just installed the
‘phpunit’ package for ubuntu. For automated tests on a daily build we are
venturing into the Continuous Integration realm which there are several
tools for but I haven’t used any of them in a long time. From a quick
search it would look like PHP Under Control (running with Cruise Control -
which I have used) and Jenkins-PHP are the two biggies. I can look into
them if you think we should set them up for the daily demos.

I have several other additions to check in on to the branch before a merge
to master. I have been picking out certain classes/files and then writing
tests to cover all the code in the file - using the code coverage portion
of PHP Unit to identify those methods/lines not tested.

One of the hardest parts of testing OpenEMR is that lots of the code is
tightly coupled with the DB. There’s little to no way for me to insert a
Mock Object to isolate a procedure b/c it’s calling on ADODB directly.
This is a much longer discussion than I will get into in this email but it
kinda directs towards are we thinking of becoming more OO (object oriented)
in version 5 with some separation of the database access layer (since we
have to migrate away from mysql to mysqli or PDO) or where are things
headed? Happy to lend a hand refactoring/testing classes as time permits
but wasn’t sure where we are headed.

In your view which part of OpenEMR should get testing? Where are you
seeing the most problems? I can focus there if people would like.

cheers
ian

p.s. I am transitioning from my current job here in Colorado to a different
position in California in late May. I might fall off of email for the
first part of May due to the move with my wife, 2 year old and dog.

On Fri, Apr 11, 2014 at 1:55 AM, Brady Miller bradymiller@users.sf.netwrote:

Hi Ian,

Seems ok. If I’m using ubuntu, is there a way I can run these tests? And
will it be easy to have these tests run automatically on a daily build?

-brady
OpenEMR http://www.open-emr.org/

Code Review for PHPUnit Testshttps://sourceforge.net/p/openemr/discussion/202506/thread/5680dd7d/?limit=25#4083

Sent from sourceforge.net because you indicated interest in
OpenEMR / Discussion / Developers

To unsubscribe from further messages, please visit
SourceForge.net: Log In to SourceForge.net


Ian Wallace - Advanced Procedures Fellow - Salud Family Health Center (c)
303.681.5732

bradymiller wrote on Saturday, April 12, 2014:

Hi Ian,

It wouldn’t be very tough to get automated testing of daily build done, since could just build the option into the demo farm, which is based on ubuntu. I’d just place another option in:
https://github.com/bradymiller/demo_farm_openemr/blob/master/ip_map_branch.txt
and then modify the demo build to incorporate the option:
https://github.com/bradymiller/demo_farm_openemr/blob/master/demo_build.sh
if curious about the demo farm checkout out the readme at bottom of screen here:
https://github.com/bradymiller/demo_farm_openemr

Regarding database, I am guessing the project may be modifying the library/sql.inc functions to use Zend database model(via PDO) rather than adodb in the future in order to solve the mysql php deprecation issue (note there is a big Zend project ongoing to bring in a large amount of MU2 items: https://github.com/zhhealthcare/openemr/commits/ModuleInstaller-V14)

Can’t think of any specific things to focus on. Bugs are generally not predictable, so good to just build functions systematically. Would be nice to get installer stuff tested since critical, but can get to that later; note the online demos test installation stuff every day, which makes testing that less critical.

Good luck on the move and don’t go dark for too long :slight_smile:

-brady
OpenEMR

iankarlwallace wrote on Tuesday, April 15, 2014:

Brady - Thanks for the links to the demo farm. Will read the README file
and see if we can hook in a regular run of the unit tests. Ubuntu probably
has packages built for the Jenkins or can easily be integrated. I’ll check
on the version we are using in the Demo farm (most likely the 12.04 LTS).

The Zend DB model would be a great place to start.

More information on the Jenkins stuff and/or more tests that I have added
to the PHPUnit_Testing_Fixes branch as I add them.

cheers
ian

On Sat, Apr 12, 2014 at 12:31 PM, Brady Miller bradymiller@users.sf.netwrote:

Hi Ian,

It wouldn’t be very tough to get automated testing of daily build done,
since could just build the option into the demo farm, which is based on
ubuntu. I’d just place another option in:

demo_farm_openemr/ip_map_branch.txt at master · bradymiller/demo_farm_openemr · GitHub
and then modify the demo build to incorporate the option:
demo_farm_openemr/demo_build.sh at master · bradymiller/demo_farm_openemr · GitHub
if curious about the demo farm checkout out the readme at bottom of screen
here:
GitHub - bradymiller/demo_farm_openemr: The repo will hold the pieces for an OpenEMR demo farm.

Regarding database, I am guessing the project may be modifying the
library/sql.inc functions to use Zend database model(via PDO) rather than
adodb in the future in order to solve the mysql php deprecation issue (note
there is a big Zend project ongoing to bring in a large amount of MU2
items: zhhealthcare/openemr · GitHub
)

Can’t think of any specific things to focus on. Bugs are generally not
predictable, so good to just build functions systematically. Would be nice
to get installer stuff tested since critical, but can get to that later;
note the online demos test installation stuff every day, which makes
testing that less critical.

Good luck on the move and don’t go dark for too long :slight_smile:

-brady
OpenEMR http://www.open-emr.org/

Code Review for PHPUnit Testshttps://sourceforge.net/p/openemr/discussion/202506/thread/5680dd7d/?limit=25#0b80

Sent from sourceforge.net because you indicated interest in
OpenEMR / Discussion / Developers

To unsubscribe from further messages, please visit
SourceForge.net: Log In to SourceForge.net


Ian Wallace - Advanced Procedures Fellow - Salud Family Health Center (c)
303.681.5732

bradymiller wrote on Wednesday, April 16, 2014:

Hi Ian,
Sounds great. You are correct on the Ubuntu 12.04 version.
-brady

iankarlwallace wrote on Wednesday, April 16, 2014:

Brady - Thanks. I’ll get a version of Ubuntu 12.04 then and clean default
install so that I can figure out all the dependencies for the Jenkins
stuff. There’s a bunch of stuff that Jenkins needs (plugins, etc) and then
PHAR’s for the PHP mess detector, complexity analysis, etc.

Interestingly enough with setting up Jenkins for PHP it relies on using
Apache Ant/Java to couple the two. I’ll start mucking about and see how
crazy the setup is. The initial run actually exposed one of our most
recent bugs with the “call by reference bug”.

More news soon. I am starting to collect different bugs from the email
list that should be tested.

cheers
ian

On Wed, Apr 16, 2014 at 1:40 AM, Brady Miller bradymiller@users.sf.netwrote:

Hi Ian,
Sounds great. You are correct on the Ubuntu 12.04 version.
-brady

Code Review for PHPUnit Testshttps://sourceforge.net/p/openemr/discussion/202506/thread/5680dd7d/?limit=25#d132

Sent from sourceforge.net because you indicated interest in
OpenEMR / Discussion / Developers

To unsubscribe from further messages, please visit
SourceForge.net: Log In to SourceForge.net


Ian Wallace - Advanced Procedures Fellow - Salud Family Health Center (c)
303.681.5732