PageRenderTime 375ms CodeModel.GetById 91ms app.highlight 210ms RepoModel.GetById 61ms app.codeStats 1ms

/tests/units/classes/score.php

http://github.com/mageekguy/atoum
PHP | 1189 lines | 1155 code | 34 blank | 0 comment | 0 complexity | 8db694386f4e93302adef690d180f0e0 MD5 | raw file
   1<?php
   2
   3namespace mageekguy\atoum\tests\units;
   4
   5use
   6	mageekguy\atoum,
   7	mageekguy\atoum\exceptions
   8;
   9
  10require_once __DIR__ . '/../runner.php';
  11
  12class score extends atoum\test
  13{
  14	public function test__construct()
  15	{
  16		$this
  17			->if($score = new atoum\score())
  18			->then
  19				->integer($score->getPassNumber())->isZero()
  20				->array($score->getFailAssertions())->isEmpty()
  21				->array($score->getExceptions())->isEmpty()
  22				->array($score->getErrors())->isEmpty()
  23				->array($score->getOutputs())->isEmpty()
  24				->array($score->getDurations())->isEmpty()
  25				->array($score->getMemoryUsages())->isEmpty()
  26				->array($score->getUncompletedMethods())->isEmpty()
  27				->array($score->getSkippedMethods())->isEmpty()
  28				->object($score->getCoverage())->isInstanceOf('mageekguy\atoum\score\coverage')
  29			->and($score = new atoum\score($coverage = new atoum\score\coverage()))
  30			->then
  31				->integer($score->getPassNumber())->isZero()
  32				->array($score->getFailAssertions())->isEmpty()
  33				->array($score->getExceptions())->isEmpty()
  34				->array($score->getErrors())->isEmpty()
  35				->array($score->getOutputs())->isEmpty()
  36				->array($score->getDurations())->isEmpty()
  37				->array($score->getMemoryUsages())->isEmpty()
  38				->array($score->getUncompletedMethods())->isEmpty()
  39				->array($score->getSkippedMethods())->isEmpty()
  40				->object($score->getCoverage())->isIdenticalTo($coverage)
  41		;
  42	}
  43
  44	public function testAddException()
  45	{
  46		$this
  47			->if($score = new atoum\score())
  48			->then
  49				->object($score->addException($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $exception = new \exception()))->isIdenticalTo($score)
  50				->array($score->getExceptions())->isEqualTo(array(
  51						array(
  52							'case' => null,
  53							'dataSetKey' => null,
  54							'dataSetProvider' => null,
  55							'class' => $class,
  56							'method' => $method,
  57							'file' => $file,
  58							'line' => $line,
  59							'value' => (string) $exception
  60						)
  61					)
  62				)
  63				->integer($score->getExceptionNumber())->isEqualTo(1)
  64				->object($score->addException($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherLine = rand(1, PHP_INT_MAX), $otherException = new \exception()))->isIdenticalTo($score)
  65					->array($score->getExceptions())->isEqualTo(array(
  66						array(
  67							'case' => null,
  68							'dataSetKey' => null,
  69							'dataSetProvider' => null,
  70							'class' => $class,
  71							'method' => $method,
  72							'file' => $file,
  73							'line' => $line,
  74							'value' => (string) $exception
  75						),
  76						array(
  77							'case' => null,
  78							'dataSetKey' => null,
  79							'dataSetProvider' => null,
  80							'class' => $otherClass,
  81							'method' => $otherMethod,
  82							'file' => $otherFile,
  83							'line' => $otherLine,
  84							'value' => (string) $otherException
  85						)
  86					)
  87				)
  88		;
  89	}
  90
  91	public function testAddPass()
  92	{
  93		$this
  94			->if($score = new atoum\score())
  95			->then
  96				->object($score->addPass())->isIdenticalTo($score)
  97				->integer($score->getPassNumber())->isEqualTo(1)
  98				->object($score->addPass())->isIdenticalTo($score)
  99				->integer($score->getPassNumber())->isEqualTo(2)
 100		;
 101	}
 102
 103	public function testAddFail()
 104	{
 105		$this
 106			->if($score = new atoum\score())
 107			->then
 108				->integer($score->addFail($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $asserter = new atoum\asserters\integer(new atoum\asserter\generator()), $reason = uniqid()))->isGreaterThan(0)
 109				->array($score->getFailAssertions())->isEqualTo(array(
 110						array(
 111							'case' => null,
 112							'dataSetKey' => null,
 113							'dataSetProvider' => null,
 114							'class' => $class,
 115							'method' => $method,
 116							'file' => $file,
 117							'line' => $line,
 118							'asserter' => $asserter,
 119							'fail' => $reason
 120						)
 121					)
 122				)
 123				->integer($score->addFail($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherLine = rand(1, PHP_INT_MAX), $otherAsserter = new atoum\asserters\integer(new atoum\asserter\generator()), $otherReason = uniqid()))->isGreaterThan(0)
 124				->array($score->getFailAssertions())->isEqualTo(array(
 125						array(
 126							'case' => null,
 127							'dataSetKey' => null,
 128							'dataSetProvider' => null,
 129							'class' => $class,
 130							'method' => $method,
 131							'file' => $file,
 132							'line' => $line,
 133							'asserter' => $asserter,
 134							'fail' => $reason
 135						),
 136						array(
 137							'case' => null,
 138							'dataSetKey' => null,
 139							'dataSetProvider' => null,
 140							'class' => $otherClass,
 141							'method' => $otherMethod,
 142							'file' => $otherFile,
 143							'line' => $otherLine,
 144							'asserter' => $otherAsserter,
 145							'fail' => $otherReason
 146						)
 147					)
 148				)
 149		;
 150	}
 151
 152	public function testAddError()
 153	{
 154		$this
 155			->if($score = new atoum\score())
 156			->then
 157				->array($score->getErrors())->isEmpty()
 158				->integer($score->getErrorNumber())->isZero()
 159				->object($score->addError($file = 'file1', $class = 'class1', $method = 'method1', $line = 1, $type = 5, $message = 'message1', $errorFile = 'errorFile1', $errorLine = 2))->isIdenticalTo($score)
 160				->array($score->getErrors())->isEqualTo(array(
 161						array(
 162							'case' => null,
 163							'dataSetKey' => null,
 164							'dataSetProvider' => null,
 165							'class' => $class,
 166							'method' => $method,
 167							'file' => $file,
 168							'line' => $line,
 169							'type' => $type,
 170							'message' => $message,
 171							'errorFile' => $errorFile,
 172							'errorLine' => $errorLine
 173						)
 174					)
 175				)
 176				->integer($score->getErrorNumber())->isEqualTo(1)
 177				->object($score->addError($otherFile = 'file2', $otherClass = 'class2', $otherMethod = 'method2', $otherLine = 10, $otherType = 15, $otherMessage = 'message2', $otherErrorFile = 'errorFile2', $otherErrorLine = 20))->isIdenticalTo($score)
 178				->array($score->getErrors())->isEqualTo(array(
 179						array(
 180							'case' => null,
 181							'dataSetKey' => null,
 182							'dataSetProvider' => null,
 183							'class' => $class,
 184							'method' => $method,
 185							'file' => $file,
 186							'line' => $line,
 187							'type' => $type,
 188							'message' => $message,
 189							'errorFile' => $errorFile,
 190							'errorLine' => $errorLine
 191						),
 192						array(
 193							'case' => null,
 194							'dataSetKey' => null,
 195							'dataSetProvider' => null,
 196							'class' => $otherClass,
 197							'method' => $otherMethod,
 198							'file' => $otherFile,
 199							'line' => $otherLine,
 200							'type' => $otherType,
 201							'message' => $otherMessage,
 202							'errorFile' => $otherErrorFile,
 203							'errorLine' => $otherErrorLine
 204						)
 205					)
 206				)
 207				->integer($score->getErrorNumber())->isEqualTo(2)
 208				->object($score->addError($file, $class, $method, $line, $type, $anAnotherMessage = 'message1.1', $errorFile, $errorLine))->isIdenticalTo($score)
 209				->array($score->getErrors())->isEqualTo(array(
 210						array(
 211							'case' => null,
 212							'dataSetKey' => null,
 213							'dataSetProvider' => null,
 214							'class' => $class,
 215							'method' => $method,
 216							'file' => $file,
 217							'line' => $line,
 218							'type' => $type,
 219							'message' => $message,
 220							'errorFile' => $errorFile,
 221							'errorLine' => $errorLine
 222						),
 223						array(
 224							'case' => null,
 225							'dataSetKey' => null,
 226							'dataSetProvider' => null,
 227							'class' => $class,
 228							'method' => $method,
 229							'file' => $file,
 230							'line' => $line,
 231							'type' => $type,
 232							'message' => $anAnotherMessage,
 233							'errorFile' => $errorFile,
 234							'errorLine' => $errorLine
 235						),
 236						array(
 237							'case' => null,
 238							'dataSetKey' => null,
 239							'dataSetProvider' => null,
 240							'class' => $otherClass,
 241							'method' => $otherMethod,
 242							'file' => $otherFile,
 243							'line' => $otherLine,
 244							'type' => $otherType,
 245							'message' => $otherMessage,
 246							'errorFile' => $otherErrorFile,
 247							'errorLine' => $otherErrorLine
 248						)
 249					)
 250				)
 251				->integer($score->getErrorNumber())->isEqualTo(3)
 252				->object($score->addError($file, $class, $method, $line + 1, $type, ("   \t	\t" . $messageWithWhitespace = 'message with withespace' . "	  \t	" . PHP_EOL), $errorFile, $errorLine))->isIdenticalTo($score)
 253				->array($score->getErrors())->isEqualTo(array(
 254						array(
 255							'case' => null,
 256							'dataSetKey' => null,
 257							'dataSetProvider' => null,
 258							'class' => $class,
 259							'method' => $method,
 260							'file' => $file,
 261							'line' => $line,
 262							'type' => $type,
 263							'message' => $anAnotherMessage,
 264							'errorFile' => $errorFile,
 265							'errorLine' => $errorLine
 266						),
 267						array(
 268							'case' => null,
 269							'dataSetKey' => null,
 270							'dataSetProvider' => null,
 271							'class' => $class,
 272							'method' => $method,
 273							'file' => $file,
 274							'line' => $line,
 275							'type' => $type,
 276							'message' => $message,
 277							'errorFile' => $errorFile,
 278							'errorLine' => $errorLine
 279						),
 280						array(
 281							'case' => null,
 282							'dataSetKey' => null,
 283							'dataSetProvider' => null,
 284							'class' => $class,
 285							'method' => $method,
 286							'file' => $file,
 287							'line' => $line + 1,
 288							'type' => $type,
 289							'message' => trim($messageWithWhitespace),
 290							'errorFile' => $errorFile,
 291							'errorLine' => $errorLine
 292						),
 293						array(
 294							'case' => null,
 295							'dataSetKey' => null,
 296							'dataSetProvider' => null,
 297							'class' => $otherClass,
 298							'method' => $otherMethod,
 299							'file' => $otherFile,
 300							'line' => $otherLine,
 301							'type' => $otherType,
 302							'message' => $otherMessage,
 303							'errorFile' => $otherErrorFile,
 304							'errorLine' => $otherErrorLine
 305						),
 306					)
 307				)
 308				->integer($score->getErrorNumber())->isEqualTo(4)
 309		;
 310	}
 311
 312	public function testAddOutput()
 313	{
 314		$this
 315			->if($score = new atoum\score())
 316			->then
 317				->array($score->getOutputs())->isEmpty()
 318				->integer($score->getOutputNumber())->isZero()
 319				->object($score->addOutput($file = uniqid(), $class = uniqid(), $method = uniqid(), $output = uniqid()))->isIdenticalTo($score)
 320				->array($score->getOutputs())->isEqualTo(array(
 321						array(
 322							'class' => $class,
 323							'method' => $method,
 324							'value' => $output
 325						)
 326					)
 327				)
 328				->integer($score->getOutputNumber())->isEqualTo(1)
 329				->object($score->addOutput($file = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherOutput = uniqid()))->isIdenticalTo($score)
 330				->array($score->getOutputs())->isEqualTo(array(
 331						array(
 332							'class' => $class,
 333							'method' => $method,
 334							'value' => $output
 335						),
 336						array(
 337							'class' => $otherClass,
 338							'method' => $otherMethod,
 339							'value' => $otherOutput
 340						)
 341					)
 342				)
 343				->integer($score->getOutputNumber())->isEqualTo(2)
 344				->object($score->addOutput($file = uniqid(), $class, $method, $moreOutput = uniqid()))->isIdenticalTo($score)
 345				->array($score->getOutputs())->isEqualTo(array(
 346						array(
 347							'class' => $class,
 348							'method' => $method,
 349							'value' => $output
 350						),
 351						array(
 352							'class' => $otherClass,
 353							'method' => $otherMethod,
 354							'value' => $otherOutput
 355						),
 356						array(
 357							'class' => $class,
 358							'method' => $method,
 359							'value' => $moreOutput
 360						)
 361					)
 362				)
 363				->integer($score->getOutputNumber())->isEqualTo(3)
 364		;
 365	}
 366
 367	public function testAddDuration()
 368	{
 369		$this
 370			->if($score = new atoum\score())
 371			->then
 372				->array($score->getDurations())->isEmpty()
 373				->integer($score->getDurationNumber())->isZero()
 374				->object($score->addDuration($path = uniqid(), $class = uniqid(), $method = uniqid(), $duration = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)
 375				->array($score->getDurations())->isEqualTo(array(
 376						array(
 377							'class' => $class,
 378							'method' => $method,
 379							'value' => $duration,
 380							'path' => $path
 381						)
 382					)
 383				)
 384				->integer($score->getDurationNumber())->isEqualTo(1)
 385				->object($score->addDuration($otherPath = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherDuration = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)
 386				->array($score->getDurations())->isEqualTo(array(
 387						array(
 388							'class' => $class,
 389							'method' => $method,
 390							'value' => $duration,
 391							'path' => $path
 392						),
 393						array(
 394							'class' => $otherClass,
 395							'method' => $otherMethod,
 396							'value' => $otherDuration,
 397							'path' => $otherPath
 398						)
 399					)
 400				)
 401				->integer($score->getDurationNumber())->isEqualTo(2)
 402				->object($score->addDuration(uniqid(), uniqid(), uniqid(), 0))->isIdenticalTo($score)
 403				->array($score->getDurations())->isEqualTo(array(
 404						array(
 405							'class' => $class,
 406							'method' => $method,
 407							'value' => $duration,
 408							'path' => $path
 409						),
 410						array(
 411							'class' => $otherClass,
 412							'method' => $otherMethod,
 413							'value' => $otherDuration,
 414							'path' => $otherPath
 415						)
 416					)
 417				)
 418				->integer($score->getDurationNumber())->isEqualTo(2)
 419				->object($score->addDuration(uniqid(), uniqid(), uniqid(), - rand(1, PHP_INT_MAX)))->isIdenticalTo($score)
 420				->array($score->getDurations())->isEqualTo(array(
 421						array(
 422							'class' => $class,
 423							'method' => $method,
 424							'value' => $duration,
 425							'path' => $path
 426						),
 427						array(
 428							'class' => $otherClass,
 429							'method' => $otherMethod,
 430							'value' => $otherDuration,
 431							'path' => $otherPath
 432						)
 433					)
 434				)
 435				->integer($score->getDurationNumber())->isEqualTo(2)
 436				->object($score->addDuration($path, $class, $method, $moreDuration = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)
 437				->array($score->getDurations())->isEqualTo(array(
 438						array(
 439							'class' => $class,
 440							'method' => $method,
 441							'value' => $duration,
 442							'path' => $path
 443						),
 444						array(
 445							'class' => $otherClass,
 446							'method' => $otherMethod,
 447							'value' => $otherDuration,
 448							'path' => $otherPath
 449						),
 450						array(
 451							'class' => $class,
 452							'method' => $method,
 453							'value' => $moreDuration,
 454							'path' => $path
 455						)
 456					)
 457				)
 458				->integer($score->getDurationNumber())->isEqualTo(3)
 459		;
 460	}
 461
 462	public function testAddMemoryUsage()
 463	{
 464		$this
 465			->if($score = new atoum\score())
 466			->then
 467				->array($score->getMemoryUsages())->isEmpty()
 468				->object($score->addMemoryUsage($file = uniqid(), $class = uniqid(), $method = uniqid(), $memoryUsage = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)
 469				->array($score->getMemoryUsages())->isEqualTo(array(
 470						array(
 471							'class' => $class,
 472							'method' => $method,
 473							'value' => $memoryUsage
 474						)
 475					)
 476				)
 477				->object($score->addMemoryUsage($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherMemoryUsage = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)
 478				->array($score->getMemoryUsages())->isEqualTo(array(
 479						array(
 480							'class' => $class,
 481							'method' => $method,
 482							'value' => $memoryUsage
 483						),
 484						array(
 485							'class' => $otherClass,
 486							'method' => $otherMethod,
 487							'value' => $otherMemoryUsage
 488						)
 489					)
 490				)
 491				->object($score->addMemoryUsage(uniqid(), uniqid(), uniqid(), 0))->isIdenticalTo($score)
 492				->array($score->getMemoryUsages())->isEqualTo(array(
 493						array(
 494							'class' => $class,
 495							'method' => $method,
 496							'value' => $memoryUsage
 497						),
 498						array(
 499							'class' => $otherClass,
 500							'method' => $otherMethod,
 501							'value' => $otherMemoryUsage
 502						)
 503					)
 504				)
 505				->object($score->addMemoryUsage(uniqid(), uniqid(), uniqid(), - rand(1, PHP_INT_MAX)))->isIdenticalTo($score)
 506				->array($score->getMemoryUsages())->isEqualTo(array(
 507						array(
 508							'class' => $class,
 509							'method' => $method,
 510							'value' => $memoryUsage
 511						),
 512						array(
 513							'class' => $otherClass,
 514							'method' => $otherMethod,
 515							'value' => $otherMemoryUsage
 516						)
 517					)
 518				)
 519				->object($score->addMemoryUsage($file, $class, $method, $moreMemoryUsage = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)
 520				->array($score->getMemoryUsages())->isEqualTo(array(
 521						array(
 522							'class' => $class,
 523							'method' => $method,
 524							'value' => $memoryUsage
 525						),
 526						array(
 527							'class' => $otherClass,
 528							'method' => $otherMethod,
 529							'value' => $otherMemoryUsage
 530						),
 531						array(
 532							'class' => $class,
 533							'method' => $method,
 534							'value' => $moreMemoryUsage
 535						)
 536					)
 537				)
 538		;
 539	}
 540
 541	public function testAddUncompletedMethod()
 542	{
 543		$this
 544			->if($score = new atoum\score())
 545			->then
 546				->array($score->getUncompletedMethods())->isEmpty()
 547				->object($score->addUncompletedMethod($file = uniqid(), $class = uniqid(), $method = uniqid(), $exitCode = rand(1, PHP_INT_MAX), $output = uniqid()))->isIdenticalTo($score)
 548				->array($score->getUncompletedMethods())->isEqualTo(array(
 549						array(
 550							'file' => $file,
 551							'class' => $class,
 552							'method' => $method,
 553							'exitCode' => $exitCode,
 554							'output' => $output,
 555						)
 556					)
 557				)
 558				->object($score->addUncompletedMethod($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherExitCode = rand(1, PHP_INT_MAX), $otherOutput = uniqid()))->isIdenticalTo($score)
 559				->array($score->getUncompletedMethods())->isEqualTo(array(
 560						array(
 561							'file' => $file,
 562							'class' => $class,
 563							'method' => $method,
 564							'exitCode' => $exitCode,
 565							'output' => $output,
 566						),
 567						array(
 568							'file' => $otherFile,
 569							'class' => $otherClass,
 570							'method' => $otherMethod,
 571							'exitCode' => $otherExitCode,
 572							'output' => $otherOutput,
 573						)
 574					)
 575				)
 576		;
 577	}
 578
 579	public function testAddSkippedMethod()
 580	{
 581		$this
 582			->if($score = new atoum\score())
 583			->then
 584				->array($score->getSkippedMethods())->isEmpty()
 585				->object($score->addSkippedMethod($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $message = uniqid()))->isIdenticalTo($score)
 586				->array($score->getSkippedMethods())->isEqualTo(array(
 587						array(
 588							'file' => $file,
 589							'class' => $class,
 590							'method' => $method,
 591							'line' => $line,
 592							'message' => $message
 593						)
 594					)
 595				)
 596		;
 597	}
 598
 599	public function testAddRuntimeException()
 600	{
 601		$this
 602			->if($score = new atoum\score())
 603			->then
 604				->array($score->getRuntimeExceptions())->isEmpty()
 605				->integer($score->getRuntimeExceptionNumber())->isZero()
 606				->object($score->addRuntimeException(uniqid(), uniqid(), uniqid(), $exception = new atoum\test\exceptions\runtime()))->isIdenticalTo($score)
 607				->array($score->getRuntimeExceptions())->isEqualTo(array(
 608						$exception
 609					)
 610				)
 611				->integer($score->getRuntimeExceptionNumber())->isEqualTo(1)
 612				->object($score->addRuntimeException(uniqid(), uniqid(), uniqid(), $otherException = new atoum\test\exceptions\runtime()))->isIdenticalTo($score)
 613				->array($score->getRuntimeExceptions())->isEqualTo(array(
 614						$exception,
 615						$otherException
 616					)
 617				)
 618				->integer($score->getRuntimeExceptionNumber())->isEqualTo(2)
 619		;
 620	}
 621
 622	public function testSetCoverage()
 623	{
 624		$this
 625			->if($score = new atoum\score())
 626			->then
 627				->object($score->setCoverage($coverage = new atoum\score\coverage()))->isIdenticalTo($score)
 628				->object($score->getCoverage())->isIdenticalTo($coverage)
 629		;
 630	}
 631
 632	public function testGetExceptionNumber()
 633	{
 634		$this
 635			->if($score = new atoum\score())
 636			->then
 637				->integer($score->getExceptionNumber())->isZero()
 638			->if($score->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))
 639			->then
 640				->integer($score->getExceptionNumber())->isEqualTo(1)
 641			->if($score->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))
 642			->then
 643				->integer($score->getExceptionNumber())->isEqualTo(2)
 644		;
 645	}
 646
 647	public function testGetFailNumber()
 648	{
 649		$this
 650			->if($score = new atoum\score())
 651			->then
 652				->integer($score->getFailNumber())->isZero()
 653			->if($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))
 654			->then
 655				->integer($score->getFailNumber())->isEqualTo(1)
 656			->if($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))
 657			->then
 658				->integer($score->getFailNumber())->isEqualTo(2)
 659		;
 660	}
 661
 662	public function testGetFailAssertions()
 663	{
 664		$this
 665			->if($score = new atoum\score())
 666			->then
 667				->array($score->getFailAssertions())->isEmpty()
 668			->if($score->addPass())
 669			->then
 670				->array($score->getFailAssertions())->isEmpty()
 671			->if($score->addFail($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $asserter = new atoum\asserters\integer(new atoum\asserter\generator()), $reason = uniqid()))
 672			->then
 673				->array($score->getFailAssertions())->isEqualTo(array(
 674						array(
 675							'case' => null,
 676							'dataSetKey' => null,
 677							'dataSetProvider' => null,
 678							'class' => $class,
 679							'method' => $method,
 680							'file' => $file,
 681							'line' => $line,
 682							'asserter' => $asserter,
 683							'fail' => $reason
 684						)
 685					)
 686				)
 687		;
 688	}
 689
 690	public function testGetLastFailAssertion()
 691	{
 692		$this
 693			->if($score = new atoum\score())
 694			->then
 695				->variable($score->getLastFailAssertion())->isNull()
 696			->if($score->addPass())
 697			->then
 698				->variable($score->getLastFailAssertion())->isNull()
 699			->if($score->addFail($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $asserter = new atoum\asserters\integer(new atoum\asserter\generator()), $reason = uniqid()))
 700			->then
 701				->array($score->getLastFailAssertion())->isEqualTo(array(
 702						'case' => null,
 703						'dataSetKey' => null,
 704						'dataSetProvider' => null,
 705						'class' => $class,
 706						'method' => $method,
 707						'file' => $file,
 708						'line' => $line,
 709						'asserter' => $asserter,
 710						'fail' => $reason
 711					)
 712				)
 713		;
 714	}
 715
 716	public function testGetLastVoidMethod()
 717	{
 718		$this
 719			->if($score = new atoum\score())
 720			->then
 721				->variable($score->getLastVoidMethod())->isNull()
 722			->if($score->addPass())
 723			->then
 724				->variable($score->getLastVoidMethod())->isNull()
 725			->if($score->addVoidMethod($file = uniqid(), $class = uniqid(), $method = uniqid()))
 726			->then
 727				->array($score->getLastVoidMethod())->isEqualTo(array(
 728						'file' => $file,
 729						'class' => $class,
 730						'method' => $method
 731					)
 732				)
 733		;
 734	}
 735
 736	public function testGetLastSkippedMethod()
 737	{
 738		$this
 739			->if($score = new atoum\score())
 740			->then
 741				->variable($score->getLastSkippedMethod())->isNull()
 742			->if($score->addPass())
 743			->then
 744				->variable($score->getLastSkippedMethod())->isNull()
 745			->if($score->addSkippedMethod($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $message = uniqid()))
 746			->then
 747				->array($score->getLastSkippedMethod())->isEqualTo(array(
 748						'file' => $file,
 749						'class' => $class,
 750						'method' => $method,
 751						'line' => $line,
 752						'message' => $message
 753					)
 754				)
 755		;
 756	}
 757
 758	public function testGetLastErroredMethod()
 759	{
 760		$this
 761			->if($score = new atoum\score())
 762			->then
 763				->variable($score->getLastErroredMethod())->isNull()
 764			->if($score->addPass())
 765			->then
 766				->variable($score->getLastErroredMethod())->isNull()
 767			->if($score->addError($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $type = rand(E_ERROR, E_USER_DEPRECATED), $message = uniqid()))
 768			->then
 769				->array($score->getLastErroredMethod())->isEqualTo(array(
 770						'case' => null,
 771						'dataSetKey' => null,
 772						'dataSetProvider' => null,
 773						'class' => $class,
 774						'method' => $method,
 775						'file' => $file,
 776						'line' => $line,
 777						'type' => $type,
 778						'message' => trim($message),
 779						'errorFile' => null,
 780						'errorLine' => null
 781					)
 782				)
 783			->if($score->addError($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $type = rand(E_ERROR, E_USER_DEPRECATED), $message = uniqid(), $errorFile = uniqid(), $errorLine = rand(1, PHP_INT_MAX), $case = uniqid(), $dataSetKey = uniqid(), $dataSetProvider = uniqid()))
 784			->then
 785				->array($score->getLastErroredMethod())->isEqualTo(array(
 786						'case' => $case,
 787						'dataSetKey' => $dataSetKey,
 788						'dataSetProvider' => $dataSetProvider,
 789						'class' => $class,
 790						'method' => $method,
 791						'file' => $file,
 792						'line' => $line,
 793						'type' => $type,
 794						'message' => trim($message),
 795						'errorFile' => $errorFile,
 796						'errorLine' => $errorLine
 797					)
 798				)
 799		;
 800	}
 801
 802	public function testGetLastException()
 803	{
 804		$this
 805			->if($score = new atoum\score())
 806			->then
 807				->variable($score->getLastException())->isNull()
 808			->if($score->addPass())
 809			->then
 810				->variable($score->getLastException())->isNull()
 811			->if($score->addException($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $exception = new \exception()))
 812			->then
 813				->array($score->getLastException())->isEqualTo(array(
 814						'case' => null,
 815						'dataSetKey' => null,
 816						'dataSetProvider' => null,
 817						'class' => $class,
 818						'method' => $method,
 819						'file' => $file,
 820						'line' => $line,
 821						'value' => (string) $exception
 822					)
 823				)
 824			->if($score->addException($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherLine = rand(1, PHP_INT_MAX), $otherException = new \exception(), $case = uniqid(), $dataSetKey = uniqid(), $dataSetProvider = uniqid()))
 825			->then
 826				->array($score->getLastException())->isEqualTo(array(
 827						'case' => $case,
 828						'dataSetKey' => $dataSetKey,
 829						'dataSetProvider' => $dataSetProvider,
 830						'class' => $otherClass,
 831						'method' => $otherMethod,
 832						'file' => $otherFile,
 833						'line' => $otherLine,
 834						'value' => (string) $otherException
 835					)
 836				)
 837		;
 838	}
 839
 840	public function testGetLastUncompleteMethod()
 841	{
 842		$this
 843			->if($score = new atoum\score())
 844			->then
 845				->variable($score->getLastUncompleteMethod())->isNull()
 846			->if($score->addPass())
 847			->then
 848				->variable($score->getLastUncompleteMethod())->isNull()
 849			->if($score->addUncompletedMethod($file = uniqid(), $class = uniqid(), $method = uniqid(), $exitCode = rand(1, PHP_INT_MAX), $output = uniqid()))
 850			->then
 851				->array($score->getLastUncompleteMethod())->isEqualTo(array(
 852						'file' => $file,
 853						'class' => $class,
 854						'method' => $method,
 855						'exitCode' => $exitCode,
 856						'output' => $output,
 857					)
 858				)
 859			->if($score->addUncompletedMethod($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherExitCode = rand(1, PHP_INT_MAX), $otherOutput = uniqid()))
 860			->then
 861				->array($score->getLastUncompleteMethod())->isEqualTo(array(
 862						'file' => $otherFile,
 863						'class' => $otherClass,
 864						'method' => $otherMethod,
 865						'exitCode' => $otherExitCode,
 866						'output' => $otherOutput,
 867					)
 868				)
 869		;
 870	}
 871
 872	public function testGetLastRuntimeException()
 873	{
 874		$this
 875			->if($score = new atoum\score())
 876			->then
 877				->variable($score->getLastRuntimeException())->isNull()
 878			->if($score->addPass())
 879			->then
 880				->variable($score->getLastRuntimeException())->isNull()
 881			->if($score->addRuntimeException($file = uniqid(), $class = uniqid(), $method = uniqid(), $exception = new exceptions\runtime()))
 882			->then
 883				->object($score->getLastRuntimeException())->isIdenticalTo($exception)
 884			->if($score->addRuntimeException($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherException = new exceptions\runtime()))
 885			->then
 886				->object($score->getLastRuntimeException())->isIdenticalTo($otherException)
 887		;
 888	}
 889
 890	public function testGetPassAssertions()
 891	{
 892		$this
 893			->if($score = new atoum\score())
 894			->then
 895				->integer($score->getPassNumber())->isZero()
 896			->if($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))
 897			->then
 898				->integer($score->getPassNumber())->isZero()
 899			->if($score->addPass())
 900			->then
 901				->integer($score->getPassNumber())->isEqualTo(1)
 902		;
 903	}
 904
 905	public function testGetCoverage()
 906	{
 907		$this
 908			->if($score = new atoum\score())
 909			->then
 910				->object($coverage = $score->getCoverage())->isInstanceOf('mageekguy\atoum\score\coverage')
 911		;
 912	}
 913
 914	public function testGetMethodsWithFail()
 915	{
 916		$this
 917			->if($score = new atoum\score())
 918			->then
 919				->array($score->getMethodsWithFail())->isEmpty()
 920			->if($asserter = new atoum\asserters\integer(new atoum\asserter\generator()))
 921			->and($score->addFail(uniqid(), $class = uniqid(), $classMethod = uniqid(), rand(1, PHP_INT_MAX), $asserter, uniqid()))
 922			->then
 923				->array($score->getMethodsWithFail())->isEqualTo(array($class => array($classMethod)))
 924			->if($score->addFail(uniqid(), $class, $classOtherMethod = uniqid(), rand(1, PHP_INT_MAX), $asserter, uniqid()))
 925			->then
 926				->array($score->getMethodsWithFail())->isEqualTo(array($class => array($classMethod, $classOtherMethod)))
 927			->if($score->addFail(uniqid(), $otherClass = uniqid(), $otherClassMethod = uniqid(), rand(1, PHP_INT_MAX), $asserter, uniqid()))
 928			->then
 929				->array($score->getMethodsWithFail())->isEqualTo(array(
 930						$class => array($classMethod, $classOtherMethod),
 931						$otherClass => array($otherClassMethod)
 932					)
 933				)
 934		;
 935	}
 936
 937	public function testGetMethodsWithError()
 938	{
 939		$this
 940			->if($score = new atoum\score())
 941			->then
 942				->array($score->getMethodsWithError())->isEmpty()
 943			->if($score->addError(uniqid(), $class = uniqid(), $classMethod = uniqid(), rand(1, PHP_INT_MAX), rand(1, PHP_INT_MAX), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
 944			->then
 945				->array($score->getMethodsWithError())->isEqualTo(array($class => array($classMethod)))
 946			->if($score->addError(uniqid(), $class, $classOtherMethod = uniqid(), rand(1, PHP_INT_MAX), rand(1, PHP_INT_MAX), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
 947			->then
 948				->array($score->getMethodsWithError())->isEqualTo(array($class => array($classMethod, $classOtherMethod)))
 949			->if($score->addError(uniqid(), $otherClass = uniqid(), $otherClassMethod = uniqid(), rand(1, PHP_INT_MAX), rand(1, PHP_INT_MAX), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
 950			->then
 951				->array($score->getMethodsWithError())->isEqualTo(array(
 952						$class => array($classMethod, $classOtherMethod),
 953						$otherClass => array($otherClassMethod)
 954					)
 955				)
 956		;
 957	}
 958
 959	public function testGetMethodsWithException()
 960	{
 961		$this
 962			->if($score = new atoum\score())
 963			->then
 964				->array($score->getMethodsWithError())->isEmpty()
 965			->if($score->addException(uniqid(), $class = uniqid(), $classMethod = uniqid(), rand(1, PHP_INT_MAX), new \exception()))
 966			->then
 967				->array($score->getMethodsWithException())->isEqualTo(array($class => array($classMethod)))
 968			->if($score->addException(uniqid(), $class, $classOtherMethod = uniqid(), rand(1, PHP_INT_MAX), new \exception()))
 969			->then
 970				->array($score->getMethodsWithException())->isEqualTo(array($class => array($classMethod, $classOtherMethod)))
 971			->if($score->addException(uniqid(), $otherClass = uniqid(), $otherClassMethod = uniqid(), rand(1, PHP_INT_MAX), new \exception()))
 972			->then
 973				->array($score->getMethodsWithException())->isEqualTo(array(
 974						$class => array($classMethod, $classOtherMethod),
 975						$otherClass => array($otherClassMethod)
 976					)
 977				)
 978		;
 979	}
 980
 981	public function testReset()
 982	{
 983		$this
 984			->if($score = new atoum\score())
 985			->then
 986				->integer($score->getPassNumber())->isZero()
 987				->array($score->getFailAssertions())->isEmpty()
 988				->array($score->getExceptions())->isEmpty()
 989				->array($score->getRuntimeExceptions())->isEmpty()
 990				->array($score->getErrors())->isEmpty()
 991				->array($score->getOutputs())->isEmpty()
 992				->array($score->getDurations())->isEmpty()
 993				->array($score->getMemoryUsages())->isEmpty()
 994				->array($score->getUncompletedMethods())->isEmpty()
 995				->object($score->reset())->isIdenticalTo($score)
 996				->integer($score->getPassNumber())->isZero()
 997				->array($score->getFailAssertions())->isEmpty()
 998				->array($score->getExceptions())->isEmpty()
 999				->array($score->getRuntimeExceptions())->isEmpty()
1000				->array($score->getErrors())->isEmpty()
1001				->array($score->getOutputs())->isEmpty()
1002				->array($score->getDurations())->isEmpty()
1003				->array($score->getMemoryUsages())->isEmpty()
1004				->array($score->getUncompletedMethods())->isEmpty()
1005			->if($score
1006				->addPass()
1007				->addException(uniqid(), rand(1, PHP_INT_MAX), uniqid(), uniqid(), new \exception())
1008				->addRuntimeException(uniqid(), uniqid(), uniqid(), new atoum\exceptions\runtime())
1009				->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), E_ERROR, uniqid(), uniqid(), rand(1, PHP_INT_MAX))
1010				->addOutput(uniqid(), uniqid(), uniqid(), uniqid())
1011				->addDuration(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX))
1012				->addMemoryUsage(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX))
1013				->addUncompletedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid())
1014			)
1015			->and($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))
1016			->then
1017				->integer($score->getPassNumber())->isGreaterThan(0)
1018				->array($score->getFailAssertions())->isNotEmpty()
1019				->array($score->getExceptions())->isNotEmpty()
1020				->array($score->getRuntimeExceptions())->isNotEmpty()
1021				->array($score->getErrors())->isNotEmpty()
1022				->array($score->getOutputs())->isNotEmpty()
1023				->array($score->getDurations())->isNotEmpty()
1024				->array($score->getMemoryUsages())->isNotEmpty()
1025				->array($score->getUncompletedMethods())->isNotEmpty()
1026				->object($score->reset())->isIdenticalTo($score)
1027				->integer($score->getPassNumber())->isZero()
1028				->array($score->getFailAssertions())->isEmpty()
1029				->array($score->getExceptions())->isEmpty()
1030				->array($score->getRuntimeExceptions())->isEmpty()
1031				->array($score->getErrors())->isEmpty()
1032				->array($score->getOutputs())->isEmpty()
1033				->array($score->getDurations())->isEmpty()
1034				->array($score->getMemoryUsages())->isEmpty()
1035				->array($score->getUncompletedMethods())->isEmpty()
1036		;
1037	}
1038
1039	public function testMerge()
1040	{
1041		$this
1042			->if($score = new atoum\score())
1043			->and($otherScore = new atoum\score())
1044			->then
1045				->object($score->merge($otherScore))->isIdenticalTo($score)
1046				->integer($score->getPassNumber())->isZero()
1047				->array($score->getFailAssertions())->isEmpty()
1048				->array($score->getExceptions())->isEmpty()
1049				->array($score->getRuntimeExceptions())->isEmpty()
1050				->array($score->getErrors())->isEmpty()
1051				->array($score->getOutputs())->isEmpty()
1052				->array($score->getDurations())->isEmpty()
1053				->array($score->getMemoryUsages())->isEmpty()
1054				->array($score->getUncompletedMethods())->isEmpty()
1055				->array($score->getSkippedMethods())->isEmpty()
1056			->if($score->addPass())
1057			->and($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))
1058			->and($score->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))
1059			->and($score->addRuntimeException(uniqid(), uniqid(), uniqid(), new atoum\exceptions\runtime()))
1060			->and($score->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), E_ERROR, uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
1061			->and($score->addOutput(uniqid(), uniqid(), uniqid(), uniqid()))
1062			->and($score->addDuration(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
1063			->and($score->addMemoryUsage(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
1064			->and($score->addUncompletedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))
1065			->and($score->addSkippedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))
1066			->then
1067				->object($score->merge($otherScore))->isIdenticalTo($score)
1068				->integer($score->getPassNumber())->isEqualTo(1)
1069				->integer($score->getFailNumber())->isEqualTo(1)
1070				->integer($score->getExceptionNumber())->isEqualTo(1)
1071				->integer($score->getErrorNumber())->isEqualTo(1)
1072				->integer($score->getOutputNumber())->isEqualTo(1)
1073				->integer($score->getDurationNumber())->isEqualTo(1)
1074				->integer($score->getMemoryUsageNumber())->isEqualTo(1)
1075				->integer($score->getUncompletedMethodNumber())->isEqualTo(1)
1076				->integer($score->getSkippedMethodNumber())->isEqualTo(1)
1077			->if($otherScore->addPass())
1078			->and($otherScore->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))
1079			->and($otherScore->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))
1080			->and($otherScore->addRuntimeException(uniqid(), uniqid(), uniqid(), new atoum\exceptions\runtime()))
1081			->and($otherScore->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), E_ERROR, uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
1082			->and($otherScore->addOutput(uniqid(), uniqid(), uniqid(), uniqid()))
1083			->and($otherScore->addDuration(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
1084			->and($otherScore->addMemoryUsage(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
1085			->and($otherScore->addUncompletedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))
1086			->and($otherScore->addSkippedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))
1087			->then
1088				->object($score->merge($otherScore))->isIdenticalTo($score)
1089				->integer($score->getPassNumber())->isEqualTo(2)
1090				->integer($score->getFailNumber())->isEqualTo(2)
1091				->integer($score->getExceptionNumber())->isEqualTo(2)
1092				->integer($score->getRuntimeExceptionNumber())->isEqualTo(2)
1093				->integer($score->getErrorNumber())->isEqualTo(2)
1094				->integer($score->getOutputNumber())->isEqualTo(2)
1095				->integer($score->getDurationNumber())->isEqualTo(2)
1096				->integer($score->getMemoryUsageNumber())->isEqualTo(2)
1097				->integer($score->getUncompletedMethodNumber())->isEqualTo(2)
1098				->integer($score->getSkippedMethodNumber())->isEqualTo(2)
1099				->object($score->merge($otherScore))->isIdenticalTo($score)
1100				->integer($score->getPassNumber())->isEqualTo(3)
1101				->integer($score->getFailNumber())->isEqualTo(3)
1102				->integer($score->getExceptionNumber())->isEqualTo(3)
1103				->integer($score->getRuntimeExceptionNumber())->isEqualTo(3)
1104				->integer($score->getErrorNumber())->isEqualTo(3)
1105				->integer($score->getOutputNumber())->isEqualTo(3)
1106				->integer($score->getDurationNumber())->isEqualTo(3)
1107				->integer($score->getMemoryUsageNumber())->isEqualTo(3)
1108				->integer($score->getUncompletedMethodNumber())->isEqualTo(3)
1109				->integer($score->getSkippedMethodNumber())->isEqualTo(3)
1110		;
1111	}
1112
1113	public function testErrorExists()
1114	{
1115		$this
1116			->if($score = new atoum\score())
1117			->then
1118				->variable($score->errorExists(uniqid()))->isNull()
1119				->variable($score->errorExists(uniqid(), rand(1, PHP_INT_MAX)))->isNull()
1120				->variable($score->errorExists(uniqid(), rand(1, PHP_INT_MAX), rand(1, PHP_INT_MAX)))->isNull()
1121			->if($score->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), $type = rand(1, PHP_INT_MAX - 1), $message = uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
1122			->then
1123				->variable($score->errorExists(uniqid()))->isNull()
1124				->variable($score->errorExists(uniqid(), rand(1, PHP_INT_MAX)))->isNull()
1125				->integer($score->errorExists($message))->isEqualTo(0)
1126				->integer($score->errorExists(null, $type))->isEqualTo(0)
1127				->integer($score->errorExists($message, $type))->isEqualTo(0)
1128			->if($score->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), $type, $otherMessage = uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
1129			->then
1130				->variable($score->errorExists(uniqid()))->isNull()
1131				->variable($score->errorExists(uniqid(), rand(1, PHP_INT_MAX)))->isNull()
1132				->integer($score->errorExists($message))->isEqualTo(0)
1133				->integer($score->errorExists(null, $type))->isEqualTo(0)
1134				->integer($score->errorExists($message, $type))->isEqualTo(0)
1135				->integer($score->errorExists($otherMessage, $type))->isEqualTo(1)
1136			->if($score->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), $otherType = $type + 1, $message, uniqid(), rand(1, PHP_INT_MAX)))
1137			->then
1138				->variable($score->errorExists(uniqid()))->isNull()
1139				->variable($score->errorExists(uniqid(), rand(1, PHP_INT_MAX)))->isNull()
1140				->integer($score->errorExists($message))->isEqualTo(0)
1141				->integer($score->errorExists(null, $type))->isEqualTo(0)
1142				->integer($score->errorExists($message, $type))->isEqualTo(0)
1143				->integer($score->errorExists($otherMessage, $type))->isEqualTo(1)
1144				->variable($score->errorExists($otherMessage, $otherType))->isNull()
1145				->integer($score->errorExists($message, $otherType))->isEqualTo(2)
1146				->integer($score->errorExists(null, $otherType))->isEqualTo(2)
1147			->if($score->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), $otherType, $otherMessage, uniqid(), rand(1, PHP_INT_MAX)))
1148			->then
1149				->variable($score->errorExists(uniqid()))->isNull()
1150				->variable($score->errorExists(uniqid(), rand(1, PHP_INT_MAX)))->isNull()
1151				->integer($score->errorExists($message))->isEqualTo(0)
1152				->integer($score->errorExists(null, $type))->isEqualTo(0)
1153				->integer($score->errorExists($message, $type))->isEqualTo(0)
1154				->integer($score->errorExists($otherMessage, $type))->isEqualTo(1)
1155				->integer($score->errorExists($otherMessage, $otherType))->isEqualTo(3)
1156				->integer($score->errorExists($message, $otherType))->isEqualTo(2)
1157				->integer($score->errorExists(null, $otherType))->isEqualTo(2)
1158			->if($score->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), $otherType, $pattern = uniqid() . 'FOO' . uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
1159			->then
1160				->variable($score->errorExists(uniqid()))->isNull()
1161				->variable($score->errorExists(uniqid(), rand(1, PHP_INT_MAX)))->isNull()
1162				->integer($score->errorExists($message))->isEqualTo(0)
1163				->integer($score->errorExists(null, $type))->isEqualTo(0)
1164				->integer($score->errorExists($message, $type))->isEqualTo(0)
1165				->integer($score->errorExists($otherMessage, $type))->isEqualTo(1)
1166				->integer($score->errorExists($otherMessage, $otherType))->isEqualTo(3)
1167				->integer($score->errorExists($message, $otherType))->isEqualTo(2)
1168				->integer($score->errorExists(null, $otherType))->isEqualTo(2)
1169				->integer($score->errorExists($pattern, $otherType))->isEqualTo(4)
1170				->variable($score->errorExists('/FOO/', $otherType))->isNull()
1171				->integer($score->errorExists('/FOO/', $otherType, true))->isEqualTo(4)
1172		;
1173	}
1174
1175	public function testDeleteError()
1176	{
1177		$this
1178			->if($score = new atoum\score())
1179			->exception(function() use ($score, & $key) { $score->deleteError($key = rand(- PHP_INT_MAX, PHP_INT_MAX)); })
1180				->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')
1181				->hasMessage('Error key \'' . $key . '\' does not exist')
1182			->if($score->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), $type = rand(1, PHP_INT_MAX), $message = uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
1183			->then
1184				->integer($score->errorExists($message, $type))->isEqualTo(0)
1185				->object($score->deleteError(0))->isIdenticalTo($score)
1186				->variable($score->errorExists($message, $type))->isNull()
1187		;
1188	}
1189}