Example #1
0
 function testReturnValues()
 {
     $entry = new PelEntrySRational();
     $pattern = new WantedPatternExpectation('/Missing argument 1 for ' . 'PelEntrySRational::__construct()/');
     $this->assertError($pattern);
     $this->assertError('Undefined variable: tag');
     $entry = new PelEntrySRational(42);
     $this->assertEqual($entry->getValue(), array());
     $entry->setValue(array(-1, 2), array(3, 4), array(5, -6));
     $this->assertEqual($entry->getValue(), array(array(-1, 2), array(3, 4), array(5, -6)));
     $this->assertEqual($entry->getText(), '-1/2, 3/4, -5/6');
     $entry->setValue(array(-7, -8));
     $this->assertEqual($entry->getValue(), array(-7, -8));
     $this->assertEqual($entry->getText(), '7/8');
     $entry->setValue();
     $this->assertEqual($entry->getValue(), array());
     $this->assertEqual($entry->getText(), '');
     $entry->setValue(array(0, 2147483647));
     $this->assertEqual($entry->getValue(), array(0, 2147483647));
     $this->assertEqual($entry->getText(), '0/2147483647');
 }