예제 #1
0
 public function testStartWith()
 {
     $this->if($asserter = new sut($generator = new asserter\generator()))->then->exception(function () use($asserter) {
         $asserter->startWith(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->startWith($fragment = uniqid());
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($this->getLocale()->_('String does not start with %s'), $fragment))->object($asserter->startWith($string))->isIdenticalTo($asserter)->if($asserter->setWith(uniqid() . $string))->then->exception(function () use($asserter, $string) {
         $asserter->startWith($string);
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($this->getLocale()->_('String does not start with %s'), $string))->if($asserter->setWith($string . uniqid()))->then->object($asserter->startWith($string))->isIdenticalTo($asserter)->exception(function () use($asserter, $string, &$fragment) {
         $asserter->startWith($fragment = strtoupper($string));
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($this->getLocale()->_('String does not start with %s'), $fragment));
 }