예제 #1
0
 public function testEquality()
 {
     $p1 = new Pair('A', 'B');
     $p2 = new Pair('A', 'B');
     $p3 = new Pair('C', 'D');
     $p4 = new Pair('D', 'C');
     $this->assertTrue($p1->equals($p2));
     $this->assertTrue($p2->equals($p1));
     $this->assertFalse($p1->equals($p3));
     $this->assertFalse($p3->equals($p1));
     $this->assertFalse($p3->equals(1337));
     $this->assertTrue($p3->equals($p3));
     $this->assertTrue($p4->equals($p3));
 }
    public function testCreateFromVariableDeclarationDefaultValueSingleCardinality()
    {
        $factory = $this->getMarshallerFactory();
        $element = $this->createDOMElement('
			<outcomeDeclaration xmlns="http://www.imsglobal.org/xsd/imsqti_v2p0" identifier="outcome1" baseType="pair" cardinality="single">
				<defaultValue>
					<value>A B</value>
				</defaultValue>
			</outcomeDeclaration>
		');
        $outcomeDeclaration = $factory->createMarshaller($element)->unmarshall($element);
        $outcomeVariable = OutcomeVariable::createFromDataModel($outcomeDeclaration);
        $pair = new Pair('A', 'B');
        $this->assertTrue($pair->equals($outcomeVariable->getDefaultValue()));
    }