Index: lib/simpletest/testportfolioaddbutton.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/simpletest/testportfolioaddbutton.php,v retrieving revision 1.8 diff -u -r1.8 testportfolioaddbutton.php --- lib/simpletest/testportfolioaddbutton.php 8 Nov 2010 11:07:09 -0000 1.8 +++ lib/simpletest/testportfolioaddbutton.php 8 Nov 2010 15:15:25 -0000 @@ -60,13 +60,25 @@ parent::tearDown(); // In charge of droppng all the test tables } + /* + * A test of setting and getting formats. What is returned in the getter is a combination of what is explicitly set in + * the button, and what is set in the static method of the export class. + * + * In some cases they conflict, in which case the button wins. + */ + function test_set_formats() { $button = new portfolio_add_button(); $button->set_callback_options('assignment_portfolio_caller', array('id' => 6), '/mod/assignment/locallib.php'); $formats = array(PORTFOLIO_FORMAT_FILE, PORTFOLIO_FORMAT_IMAGE); $button->set_formats($formats); - $this->assertEqual(2, count($button->get_formats())); + + // Expecting $formats + assignment_portfolio_caller::base_supported_formats merged to unique values. + $formats_combined = array_unique(array_merge($formats, assignment_portfolio_caller::base_supported_formats())); + + // In this case, neither file or image conflict with leap2a, which is why all three are returned. + $this->assertEqual(count($formats_combined), count($button->get_formats())); } }