. */ /** * Unit tests for the PENSPackageHandler class * * This class provides unit tests for the PENSPackageHandler class * * @package PENS * @subpackage Tests * @author Guillaume Viguier-Just * @licence http://www.gnu.org/licenses/gpl.txt */ require_once 'simpletest/autorun.php'; require_once __DIR__.'/../pens.php'; class MyPackageHandler extends PENSPackageHandler { public function processPackage($request, $path_to_package) { } } /** * Unit tests for the PENSPackageHandler class * * This class provides unit tests for the PENSPackageHandler class * * @package PENS * @subpackage Tests * @author Guillaume Viguier-Just * @licence http://www.gnu.org/licenses/gpl.txt */ class TestPENSPackageHandler extends UnitTestCase { public function testSupportedPackageTypesInvalid() { $object = new MyPackageHandler(); $object->setSupportedPackageTypes("testing"); $this->assertEqual($object->getSupportedPackageTypes(), null); } public function testSupportedPackageTypesInvalid2() { $object = new MyPackageHandler(); $object->setSupportedPackageTypes(array("aicc-pkg", "testing")); $this->assertEqual($object->getSupportedPackageTypes(), array("aicc-pkg")); } public function testSupportedPackageTypesValid() { $object = new MyPackageHandler(); $object->setSupportedPackageTypes(array("aicc-pkg", "lms-qti")); $this->assertEqual($object->getSupportedPackageTypes(), array("aicc-pkg", "lms-qti")); } public function testSupportedPackageFormatsInvalid() { $object = new MyPackageHandler(); $object->setSupportedPackageFormats("testing"); $this->assertEqual($object->getSupportedPackageFormats(), null); } public function testSupportedPackageFormatsInvalid2() { $object = new MyPackageHandler(); $object->setSupportedPackageFormats(array("zip", "testing")); $this->assertEqual($object->getSupportedPackageFormats(), array("zip")); } public function testSupportedPackageFormatsValid() { $object = new MyPackageHandler(); $object->setSupportedPackageFormats(array("zip", "jar")); $this->assertEqual($object->getSupportedPackageFormats(), array("zip", "jar")); } }