assertNull($result); } elseif ($expected instanceof QtiDatatype) { $this->assertTrue($expected->equals($result), $expected . ' != ' . $result); } else { $this->fail('testToQtiDatatype only deals with QtiDatatype objects or null.'); } } public function toQtiDatatypeProvider() { return array( array('single', 'identifier', '', null), array('single', 'pair', '', null), array('single', 'directedPair', '', null), array('single', 'boolean', '', null), array('multiple', 'identifier', '', null), array('multiple', 'pair', '', null), array('multiple', 'boolean', '', null), array('multiple', 'directedPair', '', null), array('ordered', 'identifier', '', null), array('ordered', 'pair', '', null), array('ordered', 'directedPair', '', null), array('ordered', 'boolean', '', null), array('record', 'unknown', '', null), array('single', 'identifier', 'choice_1', new QtiIdentifier('choice_1')), array('single', 'pair', 'choice_1 choice_2', new QtiPair('choice_1', 'choice_2')), array('single', 'directedPair', 'choice_1 choice_2', new QtiDirectedPair('choice_1', 'choice_2')), array('single', 'boolean', 'true', new QtiBoolean(true)), array('single', 'boolean', 'false', new QtiBoolean(false)), array('multiple', 'identifier', '[]', new MultipleContainer(BaseType::IDENTIFIER)), array('multiple', 'identifier', '[choice_1]', new MultipleContainer(BaseType::IDENTIFIER, array(new QtiIdentifier('choice_1')))), array('multiple', 'identifier', '[choice_1; choice_2]', new MultipleContainer(BaseType::IDENTIFIER, array(new QtiIdentifier('choice_1'), new QtiIdentifier('choice_2')))), array('multiple', 'pair', '[]', new MultipleContainer(BaseType::PAIR)), array('multiple', 'pair', '[choice_1 choice_2]', new MultipleContainer(BaseType::PAIR, array(new QtiPair('choice_1', 'choice_2')))), array('multiple', 'pair', '[choice_1 choice_2; choice_3 choice_4]', new MultipleContainer(BaseType::PAIR, array(new QtiPair('choice_1', 'choice_2'), new QtiPair('choice_3', 'choice_4')))), array('multiple', 'directedPair', '[]', new MultipleContainer(BaseType::DIRECTED_PAIR)), array('multiple', 'directedPair', '[choice_1 choice_2]', new MultipleContainer(BaseType::DIRECTED_PAIR, array(new QtiDirectedPair('choice_1', 'choice_2')))), array('multiple', 'directedPair', '[choice_1 choice_2; choice_3 choice_4]', new MultipleContainer(BaseType::DIRECTED_PAIR, array(new QtiDirectedPair('choice_1', 'choice_2'), new QtiDirectedPair('choice_3', 'choice_4')))), array('multiple', 'boolean', '[]', new MultipleContainer(BaseType::BOOLEAN)), array('multiple', 'boolean', '[false]', new MultipleContainer(BaseType::BOOLEAN, array(new QtiBoolean(false)))), array('multiple', 'boolean', '[true; false]', new MultipleContainer(BaseType::BOOLEAN, array(new QtiBoolean(true), new QtiBoolean(false)))), array('ordered', 'identifier', '<>', new OrderedContainer(BaseType::IDENTIFIER)), array('ordered', 'identifier', '', new OrderedContainer(BaseType::IDENTIFIER, array(new QtiIdentifier('choice_1')))), array('ordered', 'identifier', '', new OrderedContainer(BaseType::IDENTIFIER, array(new QtiIdentifier('choice_1'), new QtiIdentifier('choice_2')))), array('ordered', 'pair', '<>', new OrderedContainer(BaseType::PAIR)), array('ordered', 'pair', '', new OrderedContainer(BaseType::PAIR, array(new QtiPair('choice_1', 'choice_2')))), array('ordered', 'pair', '', new OrderedContainer(BaseType::PAIR, array(new QtiPair('choice_1', 'choice_2'), new QtiPair('choice_3', 'choice_4')))), array('ordered', 'directedPair', '<>', new OrderedContainer(BaseType::DIRECTED_PAIR)), array('ordered', 'directedPair', '', new OrderedContainer(BaseType::DIRECTED_PAIR, array(new QtiDirectedPair('choice_1', 'choice_2')))), array('ordered', 'directedPair', '', new OrderedContainer(BaseType::DIRECTED_PAIR, array(new QtiDirectedPair('choice_1', 'choice_2'), new QtiDirectedPair('choice_3', 'choice_4')))), array('ordered', 'boolean', '<>', new OrderedContainer(BaseType::BOOLEAN)), array('ordered', 'boolean', '', new OrderedContainer(BaseType::BOOLEAN, array(new QtiBoolean(false)))), array('ordered', 'boolean', '', new OrderedContainer(BaseType::BOOLEAN, array(new QtiBoolean(true), new QtiBoolean(false)))), array('single', 'pair', 'choice_1 choice_2', null), array('single', 'pair', 'choice_1 x choice_2', null), array('single', 'pair', '1_choice 1_choice', null), array('single', 'boolean', 'erut', null), array('multiple', 'boolean', '[true; erut]', null), array('multiple', 'pair', '[choice_1 choice_2; 3_choice 4_choice]', null), ); } }