Ejemplo n.º 1
0
 public function testContains()
 {
     $this->if($asserter = new asserters\string($generator = new asserter\generator()))->then->exception(function () use($asserter) {
         $asserter->contains(uniqid());
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Value is undefined')->if($asserter->setWith($string = __METHOD__))->and($diff = new diffs\variable())->then->exception(function () use($asserter, &$fragment) {
         $asserter->contains($fragment = uniqid());
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($this->getLocale()->_('String does not contain %s'), $fragment))->object($asserter->contains($string))->isIdenticalTo($asserter)->if($asserter->setWith(uniqid() . $string . uniqid()))->then->object($asserter->contains($string))->isIdenticalTo($asserter)->exception(function () use($asserter, $string, &$fragment) {
         $asserter->contains($fragment = strtoupper($string));
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($this->getLocale()->_('String does not contain %s'), $fragment));
 }