Exemplo n.º 1
0
 public function testExclusivelyBoolean()
 {
     $operands = new OperandsCollection();
     $this->assertFalse($operands->exclusivelyBoolean());
     $operands[] = new QtiBoolean(true);
     $this->assertTrue($operands->exclusivelyBoolean());
     $operands[] = new QtiBoolean(false);
     $this->assertTrue($operands->exclusivelyBoolean());
     $container = new MultipleContainer(BaseType::BOOLEAN);
     $operands[] = $container;
     $this->assertFalse($operands->exclusivelyBoolean());
     $container[] = new QtiBoolean(false);
     $this->assertTrue($operands->exclusivelyBoolean());
     $operands = new OperandsCollection();
     $operands[] = new QtiBoolean(true);
     $this->assertTrue($operands->exclusivelyBoolean());
     $operands[] = null;
     $this->assertFalse($operands->exclusivelyBoolean());
     $operands = new OperandsCollection();
     $operands[] = new OrderedContainer(BaseType::BOOLEAN, array(new QtiBoolean(true), new QtiBoolean(false), new QtiBoolean(true)));
     $this->assertTrue($operands->exclusivelyBoolean());
     $operands[] = new MultipleContainer(BaseType::BOOLEAN);
     $this->assertFalse($operands->exclusivelyBoolean());
     $operands = new OperandsCollection();
     $operands[] = new QtiBoolean(true);
     $operands[] = new QtiBoolean(false);
     $this->assertTrue($operands->exclusivelyBoolean());
     $operands[] = new RecordContainer(array('b1' => new QtiBoolean(true), 'b2' => new QtiBoolean(false)));
     $operands = new OperandsCollection();
     $operands[] = new QtiBoolean(true);
     $operands[] = new MultipleContainer(BaseType::BOOLEAN, array(new QtiBoolean(true)));
     $this->assertTrue($operands->exclusivelyBoolean());
     $operands[] = new RecordContainer();
     $this->assertFalse($operands->exclusivelyBoolean());
 }