From ef6f0f603dd59722a193ae0c59617c199819644b Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Wed, 10 Sep 2008 17:08:14 +0000 Subject: [PATCH] MDL-15666 new unit test for new button class --- lib/portfoliolib.php | 32 ++++++++++++ lib/simpletest/testportfolioaddbutton.php | 64 +++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 lib/simpletest/testportfolioaddbutton.php diff --git a/lib/portfoliolib.php b/lib/portfoliolib.php index fc3cb35a24..3a6addb2f8 100644 --- a/lib/portfoliolib.php +++ b/lib/portfoliolib.php @@ -275,6 +275,38 @@ class portfolio_add_button { } return true; } + + /** + * Getter for $format property + * @return array + */ + public function get_formats() { + return $this->formats; + } + + /** + * Getter for $callbackargs property + * @return array + */ + public function get_callbackargs() { + return $this->callbackargs; + } + + /** + * Getter for $callbackfile property + * @return array + */ + public function get_callbackfile() { + return $this->callbackfile; + } + + /** + * Getter for $callbackclass property + * @return array + */ + public function get_callbackclass() { + return $this->callbackclass; + } } diff --git a/lib/simpletest/testportfolioaddbutton.php b/lib/simpletest/testportfolioaddbutton.php new file mode 100644 index 0000000000..3b0c5517c8 --- /dev/null +++ b/lib/simpletest/testportfolioaddbutton.php @@ -0,0 +1,64 @@ +libdir . '/portfoliolib.php'); + +class portfoliolibaddbutton_test extends UnitTestCase { + + function setUp() { + global $DB, $CFG; + } + + function tearDown() { + global $DB; + } + + function test_addbutton() { + + } + + function test_set_formats() { + $button = new portfolio_add_button(); + $button->set_callback_options('assignment_portfolio_caller', array('id' => 6), '/mod/assignment/lib.php'); + $formats = array(PORTFOLIO_FORMAT_FILE, PORTFOLIO_FORMAT_IMAGE); + $button->set_formats($formats); + + $this->assertEqual(2, count($button->get_formats())); + } +} + +?> -- 2.39.5