Issue Details (XML | Word | Printable)

Key: MDL-15666
Type: Sub-task Sub-task
Status: In Progress In Progress
Priority: Major Major
Assignee: moodle.com
Reporter: Nicolas Connault
Votes: 0
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle
MDL-14591

Create Unit test framework

Created: 16/Jul/08 03:01 PM   Updated: 13/Nov/09 04:08 PM
Return to search
Component/s: Portfolio API
Affects Version/s: 2.0
Fix Version/s: None

Issue Links:
Relates
 

Participants: moodle.com, Nicolas Connault and Penny Leach
Security Level: None
Affected Branches: MOODLE_20_STABLE


 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Nicolas Connault made changes - 19/Aug/08 03:13 PM
Field Original Value New Value
Status Open [ 1 ] In Progress [ 3 ]
Nicolas Connault committed 1 file to 'Moodle CVS' - 19/Aug/08 03:14 PM
MDL-15666 Adding test file with stub methods.
ADD lib/simpletest/testportfoliolib.php   Rev. 1.1    (+0 -0 lines)
Penny Leach made changes - 19/Aug/08 05:16 PM
Link This issue has a non-specific relationship to MDL-16120 [ MDL-16120 ]
Nicolas Connault committed 2 files to 'Moodle CVS' - 19/Aug/08 05:21 PM
Penny Leach added a comment - 19/Aug/08 05:32 PM
things i can think of we need to test

portfolio plugins
----------------------

  • prepare_package returns true
  • send_package returns true

callers
----------

  • sha1 is consistent from the start to finish (i notice that some places seem to be affected by prepare_package calling functions that pass by reference and modify things)
  • prepare_package returns true

general
-----------

  • objects get constructed without errors happening
  • can we test forms? there are three forms that are generated (admin config, user config and export config (combined portfolio and caller form elements) - and the form handling code relies on get_{$type}_allowed_config or something when it passes the values back to either the caller or plugin. that would be good to test
  • I am thinking we need to change some places to throw exceptions. there are todos everywhere for this - I didn't do it at the time because petr and i couldn't agree on exception handling. in particular constructors should throw exceptions. We need whatever catches exceptions related to portfolios to call portfolio_exporter::raise_error to clear out the session and tempdata, which means passing the exporter object to the exception constructor.

Nicolas Connault committed 1 file to 'Moodle CVS' - 19/Aug/08 11:34 PM
MDL-15666 Tests for creating duplicate instance of plugin that doesn't allow duplicates
MODIFY lib/simpletest/testportfoliolib.php   Rev. 1.3    (+10 -2 lines)
mjollnir_ committed 3 files to 'Moodle CVS' - 20/Aug/08 12:14 AM
MDL-15666 - fixed up the dup test and changed setup to mock the user
MODIFY lib/portfoliolib.php   Rev. 1.31    (+10 -0 lines)
MODIFY lang/en_utf8/portfolio.php   Rev. 1.18    (+1 -0 lines)
MODIFY lib/simpletest/testportfoliolib.php   Rev. 1.4    (+4 -1 lines)
Mitsuhiro Yoshida committed 4 files to 'Lang CVS' - 20/Aug/08 01:56 AM
MDL-15768 Translated new strings for gloassary.
MDL-16047 Updated a translated string for portfolio based on lang/en_utf8 fix.
MDL-15666 MDL-16048 MDL-16124 MDL-16134 Translated new strings for portfolio.
MDL-13766 Translated new strings for repository.
MODIFY ja_utf8/portfolio.php   Rev. 1.14    (+12 -2 lines)
MODIFY ja_utf8/repository.php   Rev. 1.6    (+4 -1 lines)
MODIFY ja_utf8/glossary.php   Rev. 1.43    (+3 -1 lines)
MODIFY ja_utf8/README   Rev. 1.791    (+1 -1 lines)
Penny Leach added a comment - 27/Aug/08 01:09 AM
Nico - the one I really think is important to have is:

callers
----------

  • sha1 is consistent from the start to finish (i notice that some places seem to be affected by prepare_package calling functions that pass by reference and modify things)

as that's going to keep biting people as they add portfolio export buttons to pages in moodle (I can see this happening far more rapidly than people writing new plugins)


martignoni committed 1 file to 'Lang CVS' - 27/Aug/08 05:32 PM
MDL-15666 New string
MODIFY fr_utf8/portfolio.php   Rev. 1.14    (+2 -1 lines)
Nicolas Connault committed 7 files to 'Moodle CVS' - 29/Aug/08 04:01 PM
MDL-15666 MDL-16177
Refactored the generator script into proper Object Oriented code. It can now be used as a CLI tool, as a web form or as an included library with a function call. Stub implementation is demonstrated in portfolio unit tests.
MODIFY portfolio/type/boxnet/simpletest/Attic/testportfoliopluginboxnet.php   Rev. 1.2    (+4 -1 lines)
MODIFY admin/generator.php   Rev. 1.2    (+641 -535 lines)
ADD portfolio/type/flickr/Attic/version.php   Rev. 1.1    (+0 -0 lines)
MODIFY portfolio/type/boxnet/Attic/lib.php   Rev. 1.13    (+1 -1 lines)
MODIFY lib/simpletest/testportfoliolib.php   Rev. 1.5    (+6 -2 lines)
ADD portfolio/type/flickr/Attic/lib.php   Rev. 1.1    (+0 -0 lines)
ADD portfolio/type/download/simpletest/Attic/testportfolioplugindownload.php   Rev. 1.1    (+0 -0 lines)
Nicolas Connault committed 3 files to 'Moodle CVS' - 29/Aug/08 10:46 PM
MDL-15666 Generating test data on-the-fly using the generator!
MODIFY lib/simpletest/testportfoliolib.php   Rev. 1.6    (+11 -0 lines)
MODIFY admin/generator.php   Rev. 1.3    (+74 -65 lines)
MODIFY portfolio/type/boxnet/simpletest/Attic/testportfoliopluginboxnet.php   Rev. 1.3    (+16 -2 lines)
Nicolas Connault committed 4 files to 'Moodle CVS' - 04/Sep/08 07:44 PM
MDL-15666 sha1 tests for glossary callers. Entry caller test currently fails.
MODIFY mod/glossary/lib.php   Rev. 1.229    (+2 -2 lines)
MODIFY lib/portfoliolib.php   Rev. 1.49    (+1 -1 lines)
MODIFY lib/simpletest/testportfoliolib.php   Rev. 1.7    (+4 -0 lines)
ADD mod/glossary/simpletest/test_glossary_portfolio_callers.php   Rev. 1.1    (+0 -0 lines)
Nicolas Connault committed 4 files to 'Moodle CVS' - 04/Sep/08 09:25 PM
MDL-15666 minor fixes to assignment portfolio callers, additional param for generator (assignment type), and unit tests for sha1
MODIFY admin/generator.php   Rev. 1.4    (+33 -22 lines)
MODIFY mod/assignment/type/online/assignment.class.php   Rev. 1.62    (+5 -5 lines)
MODIFY mod/assignment/lib.php   Rev. 1.358    (+5 -4 lines)
ADD mod/assignment/simpletest/test_assignment_portfolio_callers.php   Rev. 1.1    (+0 -0 lines)
Penny Leach added a comment - 06/Sep/08 01:25 AM
nico can you comment on this bug when you resolved the issues we talked about this morning:

1. unit tests dying with no php error (and no buffer flush to see how far it got)
2. being able to run all portfolio related tests from one directory (you talked about linking or something)

i got distracted by MDL-16360 today but am back to testing on monday.


Nicolas Connault committed 2 files to 'Moodle CVS' - 06/Sep/08 07:24 PM
MDL-15666 Fixed error that caused blank page in unit test. Including generator library. Partly fixed generator.
MODIFY admin/generator.php   Rev. 1.5    (+97 -25 lines)
MODIFY lib/simpletest/testportfoliolib.php   Rev. 1.8    (+1 -0 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' - 06/Sep/08 09:34 PM
MDL-15666 Generator fixed. Ready for forum portfolio caller testing
MODIFY admin/generator.php   Rev. 1.6    (+5 -2 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' - 06/Sep/08 10:29 PM
MDL-15666 Unit tests for Forum portfolio callers now passing. But I'm getting intermittent errors from the generator, a problem with contexts during forum generation. Please ignore for now.
MODIFY admin/generator.php   Rev. 1.7    (+4 -1 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' - 06/Sep/08 10:36 PM
MDL-15666 Unit tests can all be run from lib/simpletest/testportfoliolib.php. See requires at the end of the file.
MODIFY lib/simpletest/testportfoliolib.php   Rev. 1.9    (+4 -0 lines)
Penny Leach added a comment - 09/Sep/08 05:04 PM
problems:

1. the glossary tests seems to be silently dying. i wonder if it's in an infinite loop. it's hard to debug.
2. main portfoliotest has: require_once($CFG->dirroot . '/mod/forum/simpletest/test_forum_portfolio_callers.php'); which doesn't exist. The following might be a better approach:

// Load tests for various modules
require_once($CFG>dirroot . '/mod/forum/simpletest/test_forum_portfolio_callers.php');
require_once($CFG>dirroot . '/mod/glossary/simpletest/test_glossary_portfolio_callers.php');
require_once($CFG>dirroot . '/mod/assignment/simpletest/test_assignment_portfolio_callers.php');
+foreach (get_list_of_plugins('mod') as $module) {
+ $modtest = $CFG->dirroot . '/mod/' . $module . '/simpletest/test_' . $module . '_portfolio_callers.php';
+ if (file_exists($modtest)) { + require_once($modtest); + }
+}


Nicolas Connault committed 3 files to 'Moodle CVS' - 09/Sep/08 05:17 PM
Nicolas Connault committed 2 files to 'Moodle CVS' - 09/Sep/08 06:17 PM
MDL-15666 Fixed some fatal errors in database generation
MODIFY admin/generator.php   Rev. 1.9    (+5 -1 lines)
MODIFY lib/simpletest/testportfoliolib.php   Rev. 1.10    (+6 -3 lines)
Nicolas Connault committed 2 files to 'Moodle CVS' - 09/Sep/08 08:49 PM
MDL-15666 database module caller unit test working (get_sha1 only)
MODIFY admin/generator.php   Rev. 1.10    (+11 -8 lines)
MODIFY mod/data/simpletest/test_data_portfolio_callers.php   Rev. 1.2    (+23 -5 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' - 09/Sep/08 09:01 PM
MDL-15666 adding data mod tables to list of tables to clean up
MODIFY admin/generator.php   Rev. 1.11    (+3 -0 lines)
Nicolas Connault committed 2 files to 'Moodle CVS' - 09/Sep/08 10:04 PM
MDL-15666 chat module caller tests and generation
ADD mod/chat/simpletest/test_chat_portfolio_callers.php   Rev. 1.1    (+0 -0 lines)
MODIFY admin/generator.php   Rev. 1.12    (+56 -14 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' - 10/Sep/08 11:14 PM
MDL-15666 MDL-16177 Fixed pgsql bug
MODIFY admin/generator.php   Rev. 1.13    (+12 -29 lines)
Nicolas Connault committed 2 files to 'Moodle CVS' - 11/Sep/08 01:08 AM
MDL-15666 new unit test for new button class
ADD lib/simpletest/testportfolioaddbutton.php   Rev. 1.1    (+0 -0 lines)
MODIFY lib/portfoliolib.php   Rev. 1.57    (+32 -0 lines)
mjollnir_ committed 6 files to 'Moodle CVS' - 11/Sep/08 09:47 PM
MDL-15666 - changes to the portfolio caller tests

now that i changed the api again (adding load_data), rather than add a call to it to
all the callers, i abstracted the caller setup into the parent class (portfoliolib_test)
MODIFY lib/simpletest/testportfoliolib.php   Rev. 1.11    (+32 -0 lines)
MODIFY mod/chat/simpletest/test_chat_portfolio_callers.php   Rev. 1.2    (+2 -7 lines)
MODIFY mod/forum/simpletest/test_forum_portfolio_callers.php   Rev. 1.2    (+2 -5 lines)
MODIFY mod/glossary/simpletest/test_glossary_portfolio_callers.php   Rev. 1.2    (+4 -5 lines)
MODIFY mod/data/simpletest/test_data_portfolio_callers.php   Rev. 1.3    (+3 -9 lines)
MODIFY mod/assignment/simpletest/test_assignment_portfolio_callers.php   Rev. 1.2    (+3 -6 lines)
mjollnir_ committed 1 file to 'Moodle CVS' - 11/Sep/08 10:03 PM
MDL-15666 - adding extra test to forum portfolio caller
MODIFY mod/forum/simpletest/test_forum_portfolio_callers.php   Rev. 1.3    (+15 -6 lines)
mjollnir_ committed 11 files to 'Moodle CVS' - 12/Sep/08 07:22 PM
MDL-15666 - change all the portfolio plugins and callers to use exceptions
rather than relying on return values (send_package and prepare_package)

move zipping of temporary files into the exporter class so it can be overridden during unit tests

fix a small todo in mahara plugin
MODIFY portfolio/type/download/Attic/lib.php   Rev. 1.12    (+3 -15 lines)
MODIFY mod/assignment/lib.php   Rev. 1.365    (+0 -1 lines)
MODIFY portfolio/type/boxnet/Attic/lib.php   Rev. 1.22    (+4 -6 lines)
MODIFY mod/forum/lib.php   Rev. 1.738    (+7 -9 lines)
MODIFY portfolio/type/flickr/Attic/lib.php   Rev. 1.6    (+1 -2 lines)
MODIFY mod/assignment/type/online/assignment.class.php   Rev. 1.65    (+1 -1 lines)
MODIFY mod/chat/lib.php   Rev. 1.125    (+1 -1 lines)
MODIFY lang/en_utf8/portfolio.php   Rev. 1.25    (+4 -3 lines)
MODIFY lang/en_utf8/portfolio_boxnet.php   Rev. 1.7    (+1 -0 lines)
MODIFY lib/portfolio/exporter.php   Rev. 1.5    (+34 -7 lines)
MODIFY portfolio/type/mahara/Attic/lib.php   Rev. 1.11    (+4 -10 lines)
Mitsuhiro Yoshida committed 4 files to 'Lang CVS' - 12/Sep/08 11:31 PM
MDL-16463 - Translated a new string for quiz overview.
MDL-15666 - Translated new strings for portfolio.
MODIFY ja_utf8/quiz_overview.php   Rev. 1.19    (+2 -1 lines)
MODIFY ja_utf8/README   Rev. 1.812    (+1 -1 lines)
MODIFY ja_utf8/portfolio_boxnet.php   Rev. 1.8    (+1 -0 lines)
MODIFY ja_utf8/portfolio.php   Rev. 1.21    (+5 -4 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' - 15/Sep/08 09:45 PM
MDL-15666 Subclassing exporter class so that only local files are written
MODIFY lib/simpletest/portfolio_testclass.php   Rev. 1.2    (+20 -6 lines)
mjollnir_ committed 3 files to 'Moodle CVS' - 16/Sep/08 12:08 AM
MDL-15666 - fixing bugs in resource unit test implementation
MODIFY mod/resource/lib.php   Rev. 1.102    (+3 -0 lines)
MODIFY mod/resource/simpletest/Attic/test_resource_portfolio_callers.php   Rev. 1.2    (+2 -2 lines)
MODIFY lang/en_utf8/resource.php   Rev. 1.16    (+2 -2 lines)
mjollnir_ committed 1 file to 'Moodle CVS' - 16/Sep/08 12:10 AM
MDL-15666 - fake writting files in test portfolio exporter so that we can test integration between callers and plugins
MODIFY lib/simpletest/portfolio_testclass.php   Rev. 1.3    (+45 -5 lines)
Mitsuhiro Yoshida committed 5 files to 'Lang CVS' - 16/Sep/08 02:06 PM
MDL-15666 - Updated a translated string for resource based on lang/en_utf8 fix.
MDL-14404 - Updated translated help files for enrolment expiry notification help based on lang/en_utf8 change.
MDL-16389 - Updated a translated help file for meta course based on lang/en_utf8 change.
MODIFY ja_utf8/help/metacourse.html   Rev. 1.4    (+2 -4 lines)
MODIFY ja_utf8/help/expirynotifystudents.html   Rev. 1.4    (+1 -1 lines)
MODIFY ja_utf8/help/expirythreshold.html   Rev. 1.5    (+1 -1 lines)
MODIFY ja_utf8/help/expirynotify.html   Rev. 1.4    (+1 -1 lines)
MODIFY ja_utf8/resource.php   Rev. 1.34    (+2 -2 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' - 17/Sep/08 10:41 PM
martignoni committed 2 files to 'Lang CVS' - 24/Sep/08 02:58 AM
MDL-15666 strings added/modified
MODIFY fr_utf8/portfolio_boxnet.php   Rev. 1.6    (+2 -1 lines)
MODIFY fr_utf8/portfolio.php   Rev. 1.22    (+5 -4 lines)
martignoni committed 1 file to 'Lang CVS' - 05/Oct/08 03:24 PM
MDL-15666 string added
MODIFY fr_utf8/resource.php   Rev. 1.15    (+2 -2 lines)
mjollnir_ committed 1 file to 'Moodle CVS' - 13/Oct/08 06:18 PM
MDL-15666: assignment portfolio unit tests should not try and use file-ish assignment types yet
MODIFY mod/assignment/simpletest/test_assignment_portfolio_callers.php   Rev. 1.5    (+2 -2 lines)
mjollnir_ committed 1 file to 'Moodle CVS' - 13/Oct/08 06:20 PM
MDL-16587 & MDL-15666: portfolio unit test framework expanded to do 3d rather than 2d testing (caller + plugin + new: exportformat)
MODIFY lib/simpletest/portfolio_testclass.php   Rev. 1.7    (+27 -13 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' - 13/May/09 08:22 PM
MDL-15666 Fixed for HEAD. No longer any need for URL variables to run from browser. Doesn't generate quizzes properly yet.
MODIFY admin/generator.php   Rev. 1.21    (+29 -15 lines)
Martin Dougiamas made changes - 13/Nov/09 04:08 PM
Assignee Nicolas Connault [ nicolasconnault ] moodle.com [ moodle.com ]