示例#1
0
 public function testConstruct()
 {
     $this->if($object = new TestedModel('Test'))->string($object->getText())->isEqualTo('Test')->array($object->getOptions())->isEmpty();
     $this->if($object = new TestedModel('Test', array('param' => 'test')))->string($object->getText())->isEqualTo('Test')->when($object->setText('Test 2'))->string($object->getText())->isEqualTo('Test 2')->array($object->getOptions())->hasKey('param')->contains('test')->size->isEqualTo(1);
 }
 public function testMethods()
 {
     $this->if($object = new Message('Test', array('param' => 'test')))->boolean($object->hasOption('param'))->isTrue()->string($object->getOption('param'))->isEqualTo('test')->boolean($object->hasOption('notExist'))->isFalse()->variable($object->getOption('notExist'))->isNull()->string($object->getOption('renotExist', '12345'))->isEqualTo('12345')->when($object->setOptions(array('chuck' => 'norris')))->boolean($object->hasOption('chuck'))->isTrue()->string($object->getOption('chuck'))->isEqualTo('norris')->when($object->setOption('poney', 'powerful'))->boolean($object->hasOption('poney'))->isTrue()->string($object->getOption('poney'))->isEqualTo('powerful')->when($object->setOption('null', null))->boolean($object->hasOption('null'))->isTrue()->variable($object->getOption('null'))->isNull();
 }