예제 #1
0
 /**
  * @depends testSimple
  */
 public function testEmptyStringValue()
 {
     $baseValue = new BaseValue(BaseType::STRING, '');
     $customOperator = new CustomOperator(new ExpressionCollection(array($baseValue)), '<customOperator class="qti.customOperators.csvToOrdered"><baseValue baseType="string"></baseValue></customOperator>');
     $operands = new OperandsCollection(array(new QtiString('')));
     $operator = new CsvToOrdered($customOperator, $operands);
     $result = $operator->process();
     $expected = new OrderedContainer(BaseType::STRING, array(new QtiString('')));
     $this->assertInstanceOf('qtism\\runtime\\common\\OrderedContainer', $result);
     $this->assertTrue($expected->equals($result));
 }
예제 #2
0
 public function testMixed()
 {
     $expression = $this->createFakeExpression(2);
     $operands = new OperandsCollection();
     $operands[] = new QtiPoint(0, 0);
     $operands[] = new OrderedContainer(BaseType::POINT, array(new QtiPoint(1, 2), new QtiPoint(2, 3), new QtiPoint(3, 4)));
     $operands[] = new QtiPoint(10, 10);
     $operands[] = new OrderedContainer(BaseType::POINT, array(new QtiPoint(4, 5)));
     $processor = new RepeatProcessor($expression, $operands);
     $result = $processor->process();
     $comparison = new OrderedContainer(BaseType::POINT, array(new QtiPoint(0, 0), new QtiPoint(1, 2), new QtiPoint(2, 3), new QtiPoint(3, 4), new QtiPoint(10, 10), new QtiPoint(4, 5), new QtiPoint(0, 0), new QtiPoint(1, 2), new QtiPoint(2, 3), new QtiPoint(3, 4), new QtiPoint(10, 10), new QtiPoint(4, 5)));
     $this->assertTrue($comparison->equals($result));
 }
예제 #3
0
    public function testMultipleCardinality()
    {
        $variableDeclaration = $this->createComponentFromXml('
			<responseDeclaration identifier="response1" baseType="duration" cardinality="ordered">
				<defaultValue>
					<value>P2D</value>
					<value>P3D</value>
					<value>P4D</value>
				</defaultValue>
			</responseDeclaration>
		');
        $expr = $this->createComponentFromXml('<default identifier="response1"/>');
        $variable = ResponseVariable::createFromDataModel($variableDeclaration);
        $processor = new DefaultProcessor($expr);
        $processor->setState(new State(array($variable)));
        $comparable = new OrderedContainer(BaseType::DURATION);
        $comparable[] = new QtiDuration('P2D');
        $comparable[] = new QtiDuration('P3D');
        $comparable[] = new QtiDuration('P4D');
        $this->assertTrue($comparable->equals($processor->process()));
    }