/** * @depends testSimple */ public function testEmptyStringValue() { $baseValue = new BaseValue(BaseType::STRING, ''); $customOperator = new CustomOperator(new ExpressionCollection(array($baseValue)), '<customOperator class="qti.customOperators.csvToMultiple"><baseValue baseType="string"></baseValue></customOperator>'); $operands = new OperandsCollection(array(new QtiString(''))); $operator = new CsvToMultiple($customOperator, $operands); $result = $operator->process(); $expected = new MultipleContainer(BaseType::STRING, array(new QtiString(''))); $this->assertInstanceOf('qtism\\runtime\\common\\MultipleContainer', $result); $this->assertTrue($expected->equals($result)); }
public function testEqualsTwo() { $c1 = new MultipleContainer(BaseType::FLOAT, array(new QtiFloat(2.75), new QtiFloat(1.65))); $c2 = new MultipleContainer(BaseType::FLOAT, array(new QtiFloat(2.75), new QtiFloat(1.65))); $this->assertTrue($c1->equals($c2)); }
public function testUnmarshallState() { $json = ' { "RESPONSE1": { "base" : { "identifier" : "ChoiceA" } }, "RESPONSE2": { "list" : { "identifier" : ["_id1", "id2", "ID3"] } }, "RESPONSE3": { "record" : [ { "name" : "rock", "base": { "identifier" : "Paper" } } ] }, "RESPONSE4": { "base" : null } } '; $unmarshaller = self::createUnmarshaller(); $state = $unmarshaller->unmarshall($json); $this->assertEquals(4, count($state)); $this->assertEquals(array('RESPONSE1', 'RESPONSE2', 'RESPONSE3', 'RESPONSE4'), array_keys($state)); $response1 = new Identifier('ChoiceA'); $response2 = new MultipleContainer(BaseType::IDENTIFIER, array(new Identifier('_id1'), new Identifier('id2'), new Identifier('ID3'))); $response3 = new RecordContainer(array('rock' => new Identifier('Paper'))); $response4 = null; $this->assertTrue($response1->equals($state['RESPONSE1'])); $this->assertTrue($response2->equals($state['RESPONSE2'])); $this->assertTrue($response3->equals($state['RESPONSE3'])); $this->assertSame($response4, $state['RESPONSE4']); }