Add unit testing to Mahara

Bug #819396 reported by Andrew Nicols
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Wishlist
Andrew Nicols

Bug Description

As it says on the tin.
Penny was working to add phpunit support to Mahara back in August 2009 but it was never integrated into core.
I've updated her phpunit branch and rebased it against master.

We really should look at seriously adding unit testing and I really think that this should go in to 1.5 to allow us to test the various new features which are planned more thoroughly.

Tags: phpunit tests
Revision history for this message
Andrew Nicols (dobedobedoh) wrote :

As I say, I've updated the original branch. I'm awaiting some feedback on how best to integrate Penny's commits (e.g. squash commits) using gerrit.

Changed in mahara:
importance: Undecided → Wishlist
milestone: none → 1.5.0
assignee: nobody → Andrew Nicols (dobedobedoh)
Revision history for this message
Andrew Nicols (dobedobedoh) wrote :

Another thought - once this is here, we need to consider the 'best' way of running these tests. Not sure whether we want to run the unit tests on every gerrit push or not?

Revision history for this message
François Marier (fmarier) wrote :

Is there a problem with running all of the unit tests on each gerrit push? That seems like the ideal place to me...

Changed in mahara:
status: New → Confirmed
Revision history for this message
Andrew Nicols (dobedobedoh) wrote :

Submitted for review.
The actual framework is in https://reviews.mahara.org/#change,647
Some sample tests are in https://reviews.mahara.org/#change,648

Francois: No problem with doing this what-so-ever having thought about it more.

Changed in mahara:
status: Confirmed → In Progress
Revision history for this message
Andrew Nicols (dobedobedoh) wrote :

This bug also requires inclusion of:
Bug #841708
Bug #841694
Bug #841723
Bug #841711

Revision history for this message
Hugh Davenport (hugh-davenport) wrote :
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/648
Committed: http://gitorious.org/mahara/mahara/commit/b14367d744a6128a09a21ef331eb1772683610dc
Submitter: Francois Marier (<email address hidden>)
Branch: master

commit b14367d744a6128a09a21ef331eb1772683610dc
Author: Andrew Robert Nicols <email address hidden>
Date: Mon Sep 5 11:42:22 2011 +0100

    Bug #819396: Add Example unit test for views/pages

    Change-Id: Ibdd884855d82f5d3e7763cb428f5b0971038b875
    Signed-off-by: Penny Leach <email address hidden>
    Signed-off-by: Andrew Robert Nicols <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/647
Committed: http://gitorious.org/mahara/mahara/commit/feefb5a5a271f73cba9ea25a9160f2f05a422434
Submitter: Francois Marier (<email address hidden>)
Branch: master

commit feefb5a5a271f73cba9ea25a9160f2f05a422434
Author: Andrew Robert Nicols <email address hidden>
Date: Mon Sep 5 11:42:13 2011 +0100

    Add unit testing framework (Bug #819396)

    This is a combination of Penny Leach's work and my fixes to integrate
    the phpunit unit testing framework into Mahara

    Change-Id: Id3328a3cb4cd505a67e7fd521b92c424543ee960
    Signed-off-by: Penny Leach <email address hidden>
    Signed-off-by: Andrew Robert Nicols <email address hidden>

Revision history for this message
François Marier (fmarier) wrote :

Leaving open for now because Hugh says it doesn't work on MySQL...

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/683
Committed: http://gitorious.org/mahara/mahara/commit/838d1715e708be15ad015dca62e0177835192086
Submitter: Richard Mansfield (<email address hidden>)
Branch: master

commit 838d1715e708be15ad015dca62e0177835192086
Author: Richard Mansfield <email address hidden>
Date: Wed Sep 14 12:42:55 2011 +1200

    Add test for removing a column of a view (bug #819396)

    Change-Id: I6ce075fc4a0d12863fd53d4f30eafcd01fff9ff7
    Signed-off-by: Richard Mansfield <email address hidden>

Revision history for this message
Andrew Nicols (dobedobedoh) wrote :

I've pushed a fix for part of the MySQL stuff - it turns out that you can't simply reverse the order of indexes and keys, as the names will get changed. You have to build the names, then order (the names are cached).

https://reviews.mahara.org/693

Haven't worked out why tearDown is being called twice with MySQL so this bug isn't finished yet

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/693
Committed: http://gitorious.org/mahara/mahara/commit/077e59885bfd46621992389cd7905953b94daa6e
Submitter: Hugh Davenport (<email address hidden>)
Branch: master

commit 077e59885bfd46621992389cd7905953b94daa6e
Author: Andrew Robert Nicols <email address hidden>
Date: Wed Sep 14 17:27:40 2011 +0100

    Fix uninstallation in unit tests (Bug #819396)

    Change-Id: I79a6d00f7ea31397758722ad240876457db3bced
    Signed-off-by: Andrew Robert Nicols <email address hidden>

Revision history for this message
Hugh Davenport (hugh-davenport) wrote :

The view test is still broken with mysql randomly.

PHP Fatal error: Call to a member function delete() on a non-object in /home/hugh/src/mahara/mahara/htdocs/lib/tests/phpunit/ViewTest.php on line 153

It seems that in teardown the view field is null, though in every other function at start and end it has proper content...

Revision history for this message
Hugh Davenport (hugh-davenport) wrote :

wait no, it seems that teardown is called twice..

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/698
Committed: http://gitorious.org/mahara/mahara/commit/0314d6818d7162614c3c279051e110a940ada913
Submitter: Hugh Davenport (<email address hidden>)
Branch: master

commit 0314d6818d7162614c3c279051e110a940ada913
Author: Andrew Robert Nicols <email address hidden>
Date: Thu Sep 15 17:20:22 2011 +0100

    Fix issues with mysql unit testing (Bug #819396)

    Change-Id: I6693636c0847e485e0e06949e618f62aa8edc4b7
    Signed-off-by: Andrew Robert Nicols <email address hidden>

Changed in mahara:
status: In Progress → Fix Committed
Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/699
Committed: http://gitorious.org/mahara/mahara/commit/818468077116a4003ee2a17aaee4a42aaf04de0d
Submitter: Francois Marier (<email address hidden>)
Branch: master

commit 818468077116a4003ee2a17aaee4a42aaf04de0d
Author: Andrew Robert Nicols <email address hidden>
Date: Thu Sep 15 17:22:45 2011 +0100

    Remove phpunit tests from .gitignore (Bug #819396)

    Change-Id: I066682097534b9152feeb7ce3910c03b648007a7
    Signed-off-by: Andrew Robert Nicols <email address hidden>

tags: added: tests
removed: core infrastructure test unit
Revision history for this message
Melissa Draper (melissa) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

 status fixreleased
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPjrXHAAoJECXBtiziiXdcU94IALII/v8XTSOgD0jBkOXYzDms
uLkrvC+Z5YqYhQVjIR5cVYg7X3SJPUjuaorS2uVVfIkGlz+38KdZdczOYV+JaNQV
S8aVo/Rqrsx8h6fKtVAgTl8bd1CCMos1YnrOTNvqoYSOV2iGSSX/paQf6R9BjDbz
hx6GM7pkUp/gOa3Zqo+E6NfUrMWASanjbh9kbHdm09L7/10f7a5Q9w2Cf5o1yjC7
xqM9hEbPe32C9tBBcXDGPzQDFpJ6b6Rys2dzt6NTNkv2FCyzKS4RLwGDUDRNBEEZ
iYxQ5wJJaxW+/RO8k4lGYSo7Mtt99aIxhkQX7DKxcEoOSNMdPUi9ptwjolgG4iI=
=AeF+
-----END PGP SIGNATURE-----

Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.