コード例 #1
0
ファイル: phpArray.php プロジェクト: andrewolobo/mpTracker
 public function testOffsetGet()
 {
     $this->if($asserter = new sut($generator = new \mock\mageekguy\atoum\asserter\generator()))->then->exception(function () use($asserter) {
         $asserter[2];
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Array is undefined')->if($asserter->setWith(array(1, 2, $object = new \mock\object(), clone $object)))->then->exception(function () use($asserter) {
         $asserter[2];
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('Value %s at key %s is not an array'), $asserter->getTypeOf($object), 2))->object($asserter->integer[0])->isIdenticalTo($asserter)->if($asserter = new sut($generator = new \mock\mageekguy\atoum\asserter\generator()))->and($asserter->setWith(array(1, 2, $object = new \mock\object(), clone $object)))->then->object($asserter->object[2]->isIdenticalTo($object))->isIdenticalTo($asserter)->object($asserter->object[2]->isIdenticalTo($object))->isIdenticalTo($asserter)->object($asserter->object[3]->isCloneOf($object))->isIdenticalTo($asserter)->object($asserter->object[2])->isIdenticalTo($asserter)->if($asserter = new sut(new \mock\mageekguy\atoum\asserter\generator()))->and($asserter->setWith($array = array($integer = rand(1, PHP_INT_MAX), 2, $innerArray = array(3, 4, 5, $object))))->then->object($asserter[2])->isIdenticalTo($asserter)->array($asserter->getValue())->isEqualTo($innerArray)->if($asserter->setWith($array))->then->object($asserter->integer[0]->isEqualTo($integer))->isIdenticalTo($asserter)->object($asserter->object[2][3]->isIdenticalTo($object))->isIdenticalTo($asserter)->object($asserter->object[2][3]->isIdenticalTo($object)->integer[0]->isEqualTo($integer))->isIdenticalTo($asserter)->object($asserter->object[2][3]->isIdenticalTo($object)->integer($integer)->isEqualTo($integer))->isNotIdenticalTo($asserter)->isInstanceOf('mageekguy\\atoum\\asserters\\integer')->exception(function () use($asserter) {
         $asserter->object[2][4];
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('%s has no key %s'), $asserter->getTypeOf($asserter->getInnerValue()), $asserter->getTypeOf(4)));
 }
コード例 #2
0
ファイル: phpArray.php プロジェクト: ronan-gloo/atoum
 public function testSetWith()
 {
     $this->if($asserter = new asserters\phpArray($generator = new asserter\generator()))->then->exception(function () use($asserter, &$value) {
         $asserter->setWith($value = uniqid());
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('%s is not an array'), $asserter->getTypeOf($value)))->object($asserter->setWith($value = array()))->isIdenticalTo($asserter)->array($asserter->getValue())->isEqualTo($value);
 }