How to use testRun method of withStatic class

Best Atoum code snippet using withStatic.testRun

test.php

Source:test.php Github

copy

Full Screen

...150 public function testClassConstants()151 {152 $this153 ->string(atoum\test::testMethodPrefix)->isEqualTo('test')154 ->string(atoum\test::runStart)->isEqualTo('testRunStart')155 ->string(atoum\test::beforeSetUp)->isEqualTo('beforeTestSetUp')156 ->string(atoum\test::afterSetUp)->isEqualTo('afterTestSetUp')157 ->string(atoum\test::beforeTestMethod)->isEqualTo('beforeTestMethod')158 ->string(atoum\test::fail)->isEqualTo('testAssertionFail')159 ->string(atoum\test::error)->isEqualTo('testError')160 ->string(atoum\test::uncompleted)->isEqualTo('testUncompleted')161 ->string(atoum\test::skipped)->isEqualTo('testSkipped')162 ->string(atoum\test::exception)->isEqualTo('testException')163 ->string(atoum\test::success)->isEqualTo('testAssertionSuccess')164 ->string(atoum\test::afterTestMethod)->isEqualTo('afterTestMethod')165 ->string(atoum\test::beforeTearDown)->isEqualTo('beforeTestTearDown')166 ->string(atoum\test::afterTearDown)->isEqualTo('afterTestTearDown')167 ->string(atoum\test::runStop)->isEqualTo('testRunStop')168 ->string(atoum\test::defaultNamespace)->isEqualTo('#(?:^|\\\\)tests?\\\\units?\\\\#i')169 ->string(atoum\test::defaultMethodPrefix)->isEqualTo('#^(?:test|_*[^_]+_should_)#i')170 ;171 }172 public function test__construct()173 {174 $this175 ->if($test = new emptyTest())176 ->then177 ->object($test->getScore())->isInstanceOf(atoum\score::class)178 ->object($test->getLocale())->isEqualTo(new atoum\locale())179 ->object($test->getAdapter())->isEqualTo(new atoum\adapter())180 ->object($test->getPhpFunctionMocker())->isInstanceOf(atoum\php\mocker\funktion::class)181 ->object($test->getPhpConstantMocker())->isInstanceOf(atoum\php\mocker\constant::class)182 ->object($test->getFactoryBuilder())->isInstanceOf(atoum\factory\builder\closure::class)183 ->boolean($test->isIgnored())->isTrue()184 ->boolean($test->debugModeIsEnabled())->isFalse()185 ->array($test->getAllTags())->isEqualTo($tags = ['empty', 'fake', 'dummy'])186 ->array($test->getTags())->isEqualTo($tags)187 ->array($test->getMethodTags())->isEmpty()188 ->array($test->getDataProviders())->isEmpty()189 ->integer($test->getMaxChildrenNumber())->isEqualTo(666)190 ->boolean($test->codeCoverageIsEnabled())->isEqualTo(extension_loaded('xdebug'))191 ->string($test->getTestNamespace())->isEqualTo(atoum\test::defaultNamespace)192 ->integer($test->getMaxChildrenNumber())->isEqualTo(666)193 ->variable($test->getBootstrapFile())->isNull()194 ->array($test->getClassPhpVersions())->isEmpty()195 ->array($test->getMandatoryClassExtensions())->isEmpty()196 ->array($test->getMandatoryMethodExtensions())->isEmpty()197 ->variable($test->getXdebugConfig())->isNull()198 ;199 }200 public function test__toString()201 {202 $this->castToString($this)->isEqualTo(__CLASS__);203 }204 public function test__get()205 {206 $this207 ->if($test = new emptyTest())208 ->then209 ->object($test->assert)->isInstanceOf(atoum\test::class)210 ->object($test->define)->isInstanceOf(atoum\test\assertion\aliaser::class)211 ->object($test->mockGenerator)->isInstanceOf(atoum\mock\generator::class)212 ->if($test->setMockGenerator($mockGenerator = new atoum\test\mock\generator($this)))213 ->then214 ->object($test->mockGenerator)->isIdenticalTo($mockGenerator)215 ->if($test->setAsserterGenerator($asserterGenerator = new atoum\test\asserter\generator(new emptyTest())))216 ->then217 ->object($test->assert)->isIdenticalTo($test)218 ->variable($test->exception)->isNull()219 ->exception(function () use ($test, & $property) {220 $test->{$property = uniqid()};221 })222 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)223 ->hasMessage('Asserter \'' . $property . '\' does not exist')224 ->exception($test->exception)225 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)226 ->hasMessage('Asserter \'' . $property . '\' does not exist')227 ;228 }229 public function test__set()230 {231 $this232 ->given(233 $test = new emptyTest(),234 $test->setAssertionManager($assertionManager = new \mock\atoum\atoum\test\assertion\manager())235 )236 ->if($test->{$event = uniqid()} = $handler = function () {237 })238 ->then239 ->mock($assertionManager)->call('setHandler')->withArguments($event, $handler)->once()240 ;241 }242 public function testEnableDebugMode()243 {244 $this245 ->if($test = new emptyTest())246 ->then247 ->object($test->enableDebugMode())->isIdenticalTo($test)248 ->boolean($test->debugModeIsEnabled())->isTrue()249 ->object($test->enableDebugMode())->isIdenticalTo($test)250 ->boolean($test->debugModeIsEnabled())->isTrue()251 ;252 }253 public function testDisableDebugMode()254 {255 $this256 ->if($test = new emptyTest())257 ->then258 ->object($test->disableDebugMode())->isIdenticalTo($test)259 ->boolean($test->debugModeIsEnabled())->isFalse()260 ->object($test->disableDebugMode())->isIdenticalTo($test)261 ->boolean($test->debugModeIsEnabled())->isFalse()262 ->if($test->enableDebugMode())263 ->then264 ->object($test->disableDebugMode())->isIdenticalTo($test)265 ->boolean($test->debugModeIsEnabled())->isFalse()266 ;267 }268 public function testEnableCodeCoverage()269 {270 $this271 ->assert('Code coverage must be enabled only if xdebug is available')272 ->if($adapter = new atoum\test\adapter())273 ->and($adapter->extension_loaded = function ($extension) {274 return $extension == 'xdebug';275 })276 ->and($test = new emptyTest($adapter))277 ->then278 ->boolean($test->codeCoverageIsEnabled())->isTrue()279 ->object($test->enableCodeCoverage())->isIdenticalTo($test)280 ->boolean($test->codeCoverageIsEnabled())->isTrue()281 ->if($test->disableCodeCoverage())282 ->then283 ->boolean($test->codeCoverageIsEnabled())->isFalse()284 ->object($test->enableCodeCoverage())->isIdenticalTo($test)285 ->boolean($test->codeCoverageIsEnabled())->isTrue()286 ->assert('Code coverage must not be enabled if xdebug is not available')287 ->if($adapter->extension_loaded = function ($extension) {288 return $extension != 'xdebug';289 })290 ->and($test = new emptyTest($adapter))291 ->then292 ->boolean($test->codeCoverageIsEnabled())->isFalse()293 ->object($test->enableCodeCoverage())->isIdenticalTo($test)294 ->boolean($test->codeCoverageIsEnabled())->isFalse()295 ;296 }297 public function testDisableCodeCoverage()298 {299 $this300 ->if($adapter = new atoum\test\adapter())301 ->and($adapter->extension_loaded = true)302 ->and($test = new emptyTest($adapter))303 ->then304 ->boolean($test->codeCoverageIsEnabled())->isTrue()305 ->object($test->disableCodeCoverage())->isIdenticalTo($test)306 ->boolean($test->codeCoverageIsEnabled())->isFalse()307 ->if($test->enableCodeCoverage())308 ->then309 ->boolean($test->codeCoverageIsEnabled())->isTrue()310 ->object($test->disableCodeCoverage())->isIdenticalTo($test)311 ->boolean($test->codeCoverageIsEnabled())->isFalse()312 ;313 }314 public function testGetMockGenerator()315 {316 $this317 ->if($test = new emptyTest())318 ->then319 ->object($test->getMockGenerator())->isInstanceOf(atoum\mock\generator::class)320 ->if($test->setMockGenerator($mockGenerator = new atoum\test\mock\generator($this)))321 ->then322 ->object($test->getMockGenerator())->isIdenticalTo($mockGenerator)323 ->object($mockGenerator->getTest())->isIdenticalTo($test)324 ;325 }326 public function testSetMockGenerator()327 {328 $this329 ->if($test = new emptyTest())330 ->then331 ->object($test->setMockGenerator($mockGenerator = new atoum\test\mock\generator($this)))->isIdenticalTo($test)332 ->object($test->getMockGenerator())->isIdenticalTo($mockGenerator)333 ->object($mockGenerator->getTest())->isIdenticalTo($test)334 ;335 }336 public function testSetMockAutoloader()337 {338 $this339 ->if($test = new emptyTest())340 ->then341 ->object($test->setMockAutoloader($mockAutoloader = new atoum\autoloader\mock()))->isIdenticalTo($test)342 ->object($test->getMockAutoloader())->isIdenticalTo($mockAutoloader)343 ;344 }345 public function testGetAsserterGenerator()346 {347 $this348 ->if($test = new emptyTest())349 ->then350 ->object($test->getAsserterGenerator())->isInstanceOf(atoum\test\asserter\generator::class)351 ->if($test->setAsserterGenerator($asserterGenerator = new atoum\test\asserter\generator($this)))352 ->then353 ->object($test->getAsserterGenerator())->isIdenticalTo($asserterGenerator)354 ->object($asserterGenerator->getTest())->isIdenticalTo($test)355 ;356 }357 public function testSetAsserterGenerator()358 {359 $this360 ->if($test = new emptyTest())361 ->then362 ->object($test->setAsserterGenerator($asserterGenerator = new atoum\test\asserter\generator($test)))->isIdenticalTo($test)363 ->object($test->getAsserterGenerator())->isIdenticalTo($asserterGenerator)364 ->object($asserterGenerator->getTest())->isIdenticalTo($test)365 ->object($asserterGenerator->getLocale())->isIdenticalTo($test->getLocale())366 ;367 }368 public function testGetFactoryBuilder()369 {370 $this371 ->if($test = new emptyTest())372 ->then373 ->object($test->getFactoryBuilder())->isInstanceOf(atoum\factory\builder\closure::class)374 ->if($test->setFactoryBuilder($factoryBuilder = new \mock\atoum\atoum\factory\builder()))375 ->then376 ->object($test->getFactoryBuilder())->isIdenticalTo($factoryBuilder)377 ;378 }379 public function testSetFactoryBuilder()380 {381 $this382 ->if($test = new emptyTest())383 ->then384 ->object($test->setFactoryBuilder($factoryBuilder = new \mock\atoum\atoum\factory\builder()))->isIdenticalTo($test)385 ->object($test->getFactoryBuilder())->isIdenticalTo($factoryBuilder)386 ->object($test->setFactoryBuilder())->isIdenticalTo($test)387 ->object($test->getFactoryBuilder())388 ->isEqualTo(new atoum\Factory\builder\closure())389 ->isNotIdenticalTo($factoryBuilder)390 ;391 }392 public function testSetPhpFunktionMocker()393 {394 $this395 ->if($test = new emptyTest())396 ->then397 ->object($test->setPhpFunctionMocker($phpFunctionMocker = new atoum\php\mocker\funktion()))->isIdenticalTo($test)398 ->object($test->getPhpFunctionMocker())->isIdenticalTo($phpFunctionMocker)399 ->object($test->setPhpFunctionMocker())->isIdenticalTo($test)400 ->object($test->getPhpFunctionMocker())401 ->isNotIdenticalTo($phpFunctionMocker)402 ->isInstanceOf(atoum\php\mocker\funktion::class)403 ;404 }405 public function testSetTestNamespace()406 {407 $this408 ->if($test = new self())409 ->then410 ->object($test->setTestNamespace($testNamespace = uniqid('_')))->isIdenticalTo($test)411 ->string($test->getTestNamespace())->isEqualTo($testNamespace)412 ->object($test->setTestNamespace('\\' . $testNamespace))->isIdenticalTo($test)413 ->string($test->getTestNamespace())->isEqualTo($testNamespace)414 ->object($test->setTestNamespace($testNamespace . '\\'))->isIdenticalTo($test)415 ->string($test->getTestNamespace())->isEqualTo($testNamespace)416 ->object($test->setTestNamespace('\\' . $testNamespace . '\\'))->isIdenticalTo($test)417 ->string($test->getTestNamespace())->isEqualTo($testNamespace)418 ->object($test->setTestNamespace($testNamespace = uniqid('_') . '\\' . $testNamespace))->isIdenticalTo($test)419 ->string($test->getTestNamespace())->isEqualTo($testNamespace)420 ->object($test->setTestNamespace('\\' . $testNamespace))->isIdenticalTo($test)421 ->string($test->getTestNamespace())->isEqualTo($testNamespace)422 ->object($test->setTestNamespace($testNamespace . '\\'))->isIdenticalTo($test)423 ->string($test->getTestNamespace())->isEqualTo($testNamespace)424 ->object($test->setTestNamespace('\\' . $testNamespace . '\\'))->isIdenticalTo($test)425 ->string($test->getTestNamespace())->isEqualTo($testNamespace)426 ->object($test->setTestNamespace($testNamespace = '_' . rand(0, PHP_INT_MAX)))->isIdenticalTo($test)427 ->string($test->getTestNamespace())->isEqualTo((string) $testNamespace)428 ->object($test->setTestNamespace('\\' . $testNamespace))->isIdenticalTo($test)429 ->string($test->getTestNamespace())->isEqualTo($testNamespace)430 ->object($test->setTestNamespace($testNamespace . '\\'))->isIdenticalTo($test)431 ->string($test->getTestNamespace())->isEqualTo($testNamespace)432 ->object($test->setTestNamespace('\\' . $testNamespace . '\\'))->isIdenticalTo($test)433 ->string($test->getTestNamespace())->isEqualTo($testNamespace)434 ->exception(function () use ($test) {435 $test->setTestNamespace('');436 })437 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)438 ->hasMessage('Test namespace must not be empty')439 ->exception(function () use ($test) {440 $test->setTestNamespace('0');441 })442 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)443 ->hasMessage('Test namespace must be a valid regex or identifier')444 ->exception(function () use ($test) {445 $test->setTestNamespace(uniqid('_') . '\\\\' . uniqid('_'));446 })447 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)448 ->hasMessage('Test namespace must be a valid regex or identifier')449 ;450 }451 public function testGetTestNamespace()452 {453 $this454 ->if($test = new self())455 ->then456 ->string($test->getTestNamespace())->isEqualTo(atoum\test::defaultNamespace)457 ->if($test->setTestNamespace($testNamespace = uniqid('_')))458 ->then459 ->string($test->getTestNamespace())->isEqualTo($testNamespace)460 ;461 }462 public function testSetTestMethodPrefix()463 {464 $this465 ->if($test = new self())466 ->then467 ->object($test->setTestMethodPrefix($testMethodPrefix = uniqid('_')))->isIdenticalTo($test)468 ->string($test->getTestMethodPrefix())->isEqualTo($testMethodPrefix)469 ->object($test->setTestMethodPrefix($testMethodPrefix = '/^test/i'))->isIdenticalTo($test)470 ->string($test->getTestMethodPrefix())->isEqualTo($testMethodPrefix)471 ->object($test->setTestMethodPrefix($testMethodPrefix = ('_' . rand(0, PHP_INT_MAX))))->isIdenticalTo($test)472 ->string($test->getTestMethodPrefix())->isEqualTo((string) $testMethodPrefix)473 ->object($test->setTestMethodPrefix($testMethodPrefix = "_0"))->isIdenticalTo($test)474 ->string($test->getTestMethodPrefix())->isEqualTo((string) $testMethodPrefix)475 ->exception(function () use ($test) {476 $test->setTestMethodPrefix('');477 })478 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)479 ->hasMessage('Test method prefix must not be empty')480 ->exception(function () use ($test) {481 $test->setTestMethodPrefix('0');482 })483 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)484 ->hasMessage('Test method prefix must a valid regex or identifier')485 ->exception(function () use ($test) {486 $test->setTestMethodPrefix('/:(/');487 })488 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)489 ->hasMessage('Test method prefix must a valid regex or identifier')490 ;491 }492 public function testGetTestMethodPrefix()493 {494 $this495 ->if($test = new self())496 ->then497 ->string($test->getTestMethodPrefix())->isEqualTo(atoum\test::defaultMethodPrefix)498 ->if($test->setTestMethodPrefix($testMethodPrefix = uniqid('_')))499 ->then500 ->string($test->getTestMethodPrefix())->isEqualTo($testMethodPrefix)501 ;502 }503 public function testGetTestedClassName()504 {505 $mockClass = '\mock\\' . __CLASS__;506 $this507 ->if($test = new $mockClass())508 ->and($test->getMockController()->getClass = $testClass = 'foo')509 ->then510 ->exception(function () use ($test) {511 $test->getTestedClassName();512 })513 ->isInstanceOf(atoum\exceptions\runtime::class)514 ->hasMessage('Test class \'' . $testClass . '\' is not in a namespace which matches pattern \'' . $test->getTestNamespace() . '\'')515 ->if($test->getMockController()->getClass = 'tests\units\foo')516 ->then517 ->string($test->getTestedClassName())->isEqualTo('foo')518 ;519 }520 public function testGetTestedClassPath()521 {522 $this523 ->if($testedClass = new \reflectionClass($this->getTestedClassName()))524 ->then525 ->string($this->getTestedClassPath())->isEqualTo($testedClass->getFilename())526 ;527 }528 public function testGetAdapter()529 {530 $this531 ->if($test = new emptyTest())532 ->then533 ->object($test->getAdapter())->isInstanceOf(atoum\adapter::class)534 ;535 }536 public function testSetAdapter()537 {538 $this539 ->if($test = new emptyTest())540 ->then541 ->object($test->setAdapter($adapter = new atoum\test\adapter()))->isIdenticalTo($test)542 ->object($test->getAdapter())->isIdenticalTo($adapter)543 ;544 }545 public function testSetLocale()546 {547 $this548 ->if($test = new emptyTest())549 ->then550 ->object($test->setLocale($locale = new atoum\locale()))->isIdenticalTo($test)551 ->object($test->getLocale())->isIdenticalTo($locale)552 ;553 }554 public function testSetScore()555 {556 $this557 ->if($test = new emptyTest())558 ->then559 ->object($test->setScore($score = new atoum\test\score()))->isIdenticalTo($test)560 ->object($test->getScore())->isIdenticalTo($score)561 ;562 }563 public function testSetBootstrapFile()564 {565 $this566 ->if($test = new emptyTest())567 ->then568 ->object($test->setBootstrapFile($path = uniqid()))->isIdenticalTo($test)569 ->string($test->getBootstrapFile())->isEqualTo($path)570 ;571 }572 public function testSetMaxChildrenNumber()573 {574 $this575 ->if($test = new emptyTest())576 ->then577 ->exception(function () use ($test) {578 $test->setMaxChildrenNumber(- rand(1, PHP_INT_MAX));579 })580 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)581 ->hasMessage('Maximum number of children must be greater or equal to 1')582 ->exception(function () use ($test) {583 $test->setMaxChildrenNumber(0);584 })585 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)586 ->hasMessage('Maximum number of children must be greater or equal to 1')587 ->object($test->setMaxChildrenNumber($maxChildrenNumber = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)588 ->integer($test->getMaxChildrenNumber())->isEqualTo($maxChildrenNumber)589 ->object($test->setMaxChildrenNumber((string) $maxChildrenNumber = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)590 ->integer($test->getMaxChildrenNumber())->isEqualTo($maxChildrenNumber)591 ;592 }593 public function testGetClass()594 {595 $this596 ->if($test = new emptyTest())597 ->then598 ->string($test->getClass())->isEqualTo(__NAMESPACE__ . '\emptyTest')599 ;600 }601 public function testGetPath()602 {603 $this604 ->if($test = new emptyTest())605 ->then606 ->string($test->getPath())->isEqualTo(__FILE__)607 ;608 }609 public function testGetCoverage()610 {611 $this612 ->if($test = new emptyTest())613 ->then614 ->object($test->getCoverage())->isIdenticalTo($test->getScore()->getCoverage())615 ;616 }617 public function testIsIgnored()618 {619 $this620 ->if($test = new emptyTest())621 ->then622 ->boolean($test->isIgnored())->isTrue()623 ->object($test->ignore(false))->isIdenticalTo($test)624 ->boolean($test->isIgnored())->isTrue()625 ->object($test->ignore(true))->isIdenticalTo($test)626 ->boolean($test->isIgnored())->isTrue()627 ->if($test = new notEmptyTest())628 ->then629 ->boolean($test->isIgnored())->isTrue()630 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()631 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()632 ->object($test->ignore(false))->isIdenticalTo($test)633 ->boolean($test->isIgnored())->isFalse()634 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()635 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()636 ->object($test->ignore(true))->isIdenticalTo($test)637 ->boolean($test->isIgnored())->isTrue()638 ->boolean($test->methodIsIgnored('testMethod1'))->istrue()639 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()640 ;641 }642 public function testGetCurrentMethod()643 {644 $this645 ->if($test = new emptyTest())646 ->then647 ->variable($test->getCurrentMethod())->isNull()648 ;649 }650 public function testCount()651 {652 $this653 ->sizeOf(new emptyTest())->isEqualTo(0)654 ->if($test = new notEmptyTest())655 ->then656 ->sizeOf($test)->isEqualTo(0)657 ->if($test->ignore(false))658 ->then659 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()660 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()661 ->sizeOf($test)->isEqualTo(2)662 ->if($test->ignoreMethod('testMethod1', true))663 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()664 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()665 ->sizeOf($test)->isEqualTo(1)666 ->if($test->ignoreMethod('testMethod2', true))667 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()668 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()669 ->sizeOf($test)->isEqualTo(0)670 ;671 }672 public function testGetTestMethods()673 {674 $this675 ->if($test = new emptyTest())676 ->then677 ->boolean($test->ignore(false)->isIgnored())->isTrue()678 ->sizeOf($test)->isZero()679 ->array($test->getTestMethods())->isEmpty()680 ->if($test = new notEmptyTest())681 ->then682 ->boolean($test->isIgnored())->isTrue()683 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()684 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()685 ->sizeOf($test)->isEqualTo(0)686 ->array($test->getTestMethods())->isEmpty()687 ->boolean($test->ignore(false)->isIgnored())->isFalse()688 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()689 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()690 ->sizeOf($test)->isEqualTo(2)691 ->array($test->getTestMethods())->isEqualTo(['testMethod1', 'testMethod2'])692 ->array($test->getTestMethods(['method']))->isEqualTo(['testMethod1', 'testMethod2'])693 ->array($test->getTestMethods(['test']))->isEqualTo(['testMethod1', 'testMethod2'])694 ->array($test->getTestMethods(['two']))->isEqualTo(['testMethod2'])695 ->array($test->getTestMethods([uniqid()]))->isEmpty()696 ->array($test->getTestMethods(['test', 'method']))->isEqualTo(['testMethod1', 'testMethod2'])697 ->array($test->getTestMethods(['test', 'method', uniqid()]))->isEqualTo(['testMethod1', 'testMethod2'])698 ->array($test->getTestMethods(['test', 'method', 'two', uniqid()]))->isEqualTo(['testMethod1', 'testMethod2'])699 ;700 }701 public function testGetPhpPath()702 {703 $this704 ->if($test = new emptyTest())705 ->then706 ->variable($test->getPhpPath())->isNull()707 ->if($test->setPhpPath($phpPath = uniqid()))708 ->then709 ->string($test->getPhpPath())->isEqualTo($phpPath)710 ;711 }712 public function testSetPhpPath()713 {714 $this715 ->if($test = new emptyTest())716 ->then717 ->object($test->setPhpPath($phpPath = uniqid()))->isIdenticalTo($test)718 ->string($test->getPhpPath())->isIdenticalTo($phpPath)719 ->object($test->setPhpPath($phpPath = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)720 ->string($test->getPhpPath())->isIdenticalTo((string) $phpPath)721 ;722 }723 public function testMethodIsIgnored()724 {725 $this726 ->if($test = new emptyTest())727 ->then728 ->exception(function () use ($test, & $method) {729 $test->methodIsIgnored($method = uniqid());730 })731 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)732 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')733 ;734 }735 public function testSetTags()736 {737 $this738 ->if($test = new emptyTest())739 ->then740 ->object($test->setTags($tags = [uniqid(), uniqid()]))->isIdenticalTo($test)741 ->array($test->getTags())->isEqualTo($tags)742 ;743 }744 public function testSetMethodTags()745 {746 $this747 ->if($test = new notEmptyTest())748 ->then749 ->object($test->setMethodTags('testMethod1', $tags = [uniqid(), uniqid()]))->isIdenticalTo($test)750 ->array($test->getMethodTags('testMethod1'))->isEqualTo($tags)751 ->exception(function () use ($test, & $method) {752 $test->setMethodTags($method = uniqid(), []);753 })754 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)755 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')756 ;757 }758 public function testGetMethodTags()759 {760 $this761 ->if($test = new notEmptyTest())762 ->then763 ->array($test->getMethodTags('testMethod1'))->isEqualTo(['test', 'method', 'one'])764 ->exception(function () use ($test, & $method) {765 $test->getMethodTags($method = uniqid());766 })767 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)768 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')769 ->if($test = new inheritedTagsTest())770 ->then771 ->array($test->getMethodTags())->isEqualTo(['testMethod1' => ['first', 'second', 'third'], 'testMethod2' => ['first', 'second', 'third']])772 ->array($test->getMethodTags('testMethod1'))->isEqualTo(['first', 'second', 'third'])773 ->array($test->getMethodTags('testMethod2'))->isEqualTo(['first', 'second', 'third'])774 ->if($test = new dataProviderTest())775 ->then776 ->array($test->getMethodTags())->isEqualTo(['testMethod1' => [], 'testMethod2' => [], 'testMethod3' => []])777 ->array($test->getMethodTags('testMethod1'))->isEqualTo([])778 ->array($test->getMethodTags('testMethod2'))->isEqualTo([])779 ->array($test->getMethodTags('testMethod3'))->isEqualTo([])780 ;781 }782 public function testAddMandatoryClassExtension()783 {784 $this785 ->if($test = new notEmptyTest())786 ->then787 ->object($test->addMandatoryClassExtension($extension = uniqid()))->isIdenticalTo($test)788 ->array($test->getMandatoryClassExtensions())->isEqualTo([$extension])789 ->object($test->addMandatoryClassExtension($otherExtension = uniqid()))->isIdenticalTo($test)790 ->array($test->getMandatoryClassExtensions())->isEqualTo([$extension, $otherExtension])791 ;792 }793 public function testGetMandatoryMethodExtensions()794 {795 $this796 ->if($test = new notEmptyTest())797 ->then798 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEmpty()799 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(['mbstring', 'socket'])800 ;801 }802 public function testAddMandatoryMethodExtension()803 {804 $this805 ->if($test = new notEmptyTest())806 ->then807 ->exception(function () use ($test, & $method) {808 $test->addMandatoryMethodExtension($method = uniqid(), uniqid());809 })810 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)811 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')812 ->object($test->addMandatoryMethodExtension('testMethod1', $extension = uniqid()))->isIdenticalTo($test)813 ->array($test->getMandatoryMethodExtensions())->isEqualTo(['testMethod1' => [$extension], 'testMethod2' => ['mbstring', 'socket']])814 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo([$extension])815 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(['mbstring', 'socket'])816 ->object($test->addMandatoryMethodExtension('testMethod1', $otherExtension = uniqid()))->isIdenticalTo($test)817 ->array($test->getMandatoryMethodExtensions())->isEqualTo(['testMethod1' => [$extension, $otherExtension], 'testMethod2' => ['mbstring', 'socket']])818 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo([$extension, $otherExtension])819 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(['mbstring', 'socket'])820 ->object($test->addMandatoryMethodExtension('testMethod2', $anOtherExtension = uniqid()))->isIdenticalTo($test)821 ->array($test->getMandatoryMethodExtensions())->isEqualTo(['testMethod1' => [$extension, $otherExtension], 'testMethod2' => ['mbstring', 'socket', $anOtherExtension]])822 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo([$extension, $otherExtension])823 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(['mbstring', 'socket', $anOtherExtension])824 ->if($test->addMandatoryClassExtension($classExtension = uniqid()))825 ->then826 ->array($test->getMandatoryMethodExtensions())->isEqualTo(['testMethod1' => [$classExtension, $extension, $otherExtension], 'testMethod2' => [$classExtension, 'mbstring', 'socket', $anOtherExtension]])827 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo([$classExtension, $extension, $otherExtension])828 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo([$classExtension, 'mbstring', 'socket', $anOtherExtension])829 ;830 }831 public function testAddClassPhpVersion()832 {833 $this834 ->if($test = new notEmptyTest())835 ->then836 ->object($test->addClassPhpVersion('5.3'))->isIdenticalTo($test)837 ->array($test->getClassPhpVersions())->isEqualTo(['5.3' => '>='])838 ->object($test->addClassPhpVersion('5.4', '<='))->isIdenticalTo($test)839 ->array($test->getClassPhpVersions())->isEqualTo(['5.3' => '>=', '5.4' => '<='])840 ;841 }842 public function testAddMethodPhpVersion()843 {844 $this845 ->if($test = new notEmptyTest())846 ->then847 ->exception(function () use ($test, & $method) {848 $test->addMethodPhpVersion($method, '6.0');849 })850 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)851 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')852 ->object($test->addMethodPhpVersion('testMethod1', '5.3'))->isIdenticalTo($test)853 ->array($test->getMethodPhpVersions())->isEqualTo(['testMethod1' => ['5.3' => '>='], 'testMethod2' => []])854 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(['5.3' => '>='])855 ->array($test->getMethodPhpVersions('testMethod2'))->isEmpty()856 ->object($test->addMethodPhpVersion('testMethod1', '5.4', '<='))->isIdenticalTo($test)857 ->array($test->getMethodPhpVersions())->isEqualTo(['testMethod1' => ['5.3' => '>=', '5.4' => '<='], 'testMethod2' => []])858 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(['5.3' => '>=', '5.4' => '<='])859 ->array($test->getMethodPhpVersions('testMethod2'))->isEmpty()860 ->object($test->addMethodPhpVersion('testMethod2', '5.4', '>='))->isIdenticalTo($test)861 ->array($test->getMethodPhpVersions())->isEqualTo(['testMethod1' => ['5.3' => '>=', '5.4' => '<='], 'testMethod2' => ['5.4' => '>=']])862 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(['5.3' => '>=', '5.4' => '<='])863 ->array($test->getMethodPhpVersions('testMethod2'))->isEqualTo(['5.4' => '>='])864 ->if($test->addClassPhpVersion('5.5'))865 ->then866 ->array($test->getMethodPhpVersions())->isEqualTo(['testMethod1' => ['5.5' => '>=', '5.3' => '>=', '5.4' => '<='], 'testMethod2' => ['5.5' => '>=', '5.4' => '>=']])867 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(['5.5' => '>=', '5.3' => '>=', '5.4' => '<='])868 ->array($test->getMethodPhpVersions('testMethod2'))->isEqualTo(['5.5' => '>=', '5.4' => '>='])869 ;870 }871 public function testRun()872 {873 $this874 ->mockTestedClass('mock\tests\units')875 ->if($test = new \mock\tests\units\test())876 ->then877 ->object($test->run())->isIdenticalTo($test)878 ->mock($test)879 ->call('callObservers')880 ->withArguments(\atoum\atoum\test::runStart)->never()881 ->withArguments(\atoum\atoum\test::runStop)->never()882 ->withArguments(\atoum\atoum\test::beforeSetUp)->never()883 ->withArguments(\atoum\atoum\test::afterSetUp)->never()884 ->withArguments(\atoum\atoum\test::beforeTestMethod)->never()885 ->withArguments(\atoum\atoum\test::afterTestMethod)->never()...

Full Screen

Full Screen

testRun

Using AI Code Generation

copy

Full Screen

1withStatic::testRun();2withStatic::testRun();3withStatic::testRun();4withStatic::testRun();5withStatic::testRun();6withStatic::testRun();

Full Screen

Full Screen

testRun

Using AI Code Generation

copy

Full Screen

1$obj = new withStatic;2$obj->testRun();3$obj = new withStatic;4$obj->testRun();5$obj = new withStatic;6$obj->testRun();7$obj = new withStatic;8$obj->testRun();9$obj = new withStatic;10$obj->testRun();11$obj = new withStatic;12$obj->testRun();13$obj = new withStatic;14$obj->testRun();15$obj = new withStatic;16$obj->testRun();17$obj = new withStatic;18$obj->testRun();19$obj = new withStatic;20$obj->testRun();21$obj = new withStatic;22$obj->testRun();23$obj = new withStatic;24$obj->testRun();25$obj = new withStatic;26$obj->testRun();27$obj = new withStatic;28$obj->testRun();29$obj = new withStatic;30$obj->testRun();31$obj = new withStatic;32$obj->testRun();33$obj = new withStatic;34$obj->testRun();

Full Screen

Full Screen

testRun

Using AI Code Generation

copy

Full Screen

1$test = new withStatic();2$test->testRun();3$test = new withStatic();4$test->testRun();5$test = new withStatic();6$test->testRun();7{8 public static $test = 0;9 public static function testRun()10 {11 self::$test++;12 echo self::$test;13 }14}15$test = new withStatic();16$test->testRun();17$test->testRun();18$test->testRun();19{20 public static $test = 0;21 public static function testRun()22 {23 self::$test++;24 echo self::$test;25 }26}27withStatic::testRun();28withStatic::testRun();29withStatic::testRun();30{31 public static $test = 0;

Full Screen

Full Screen

testRun

Using AI Code Generation

copy

Full Screen

1require_once('withStatic.php');2withStatic::testRun();3require_once('withStatic.php');4withStatic::testRun();5require_once('withStatic.php');6withStatic::testRun();7require_once('withStatic.php');8withStatic::testRun();9require_once('withStatic.php');10withStatic::testRun();11require_once('withStatic.php');12withStatic::testRun();13require_once('withStatic.php');14withStatic::testRun();15require_once('withStatic.php');16withStatic::testRun();17require_once('withStatic.php');18withStatic::testRun();19require_once('withStatic.php');20withStatic::testRun();21require_once('withStatic.php');22withStatic::testRun();23require_once('withStatic.php');24withStatic::testRun();25require_once('withStatic.php');26withStatic::testRun();27require_once('withStatic.php');28withStatic::testRun();29require_once('withStatic.php');30withStatic::testRun();31require_once('withStatic.php');32withStatic::testRun();

Full Screen

Full Screen

testRun

Using AI Code Generation

copy

Full Screen

1require_once 'withStatic.php';2withStatic::testRun();3require_once 'withStatic.php';4withStatic::testRun();5require_once 'withStatic.php';6withStatic::testRun();7require_once 'withStatic.php';8withStatic::testRun();9{10 public static $count = 0;11 public static function testRun()12 {13 self::$count++;14 echo self::$count . PHP_EOL;15 }16}17self::methodName()18{19 public static $count = 0;20 public static function testRun()21 {22 self::$count++;23 echo self::$count . PHP_EOL;24 }25}26self::methodName()27{28 public static $count = 0;29 public static function testRun()30 {31 self::$count++;32 echo self::$count . PHP_EOL;33 }34}35self::methodName()36{37 public static $count = 0;38 public static function testRun()39 {40 self::$count++;41 echo self::$count . PHP_EOL;42 }

Full Screen

Full Screen

testRun

Using AI Code Generation

copy

Full Screen

1withStatic::testRun();2withStatic::testRun();3withStatic::testRun();4withStatic::testRun();5withStatic::testRun();6withStatic::testRun();7withStatic::testRun();8withStatic::testRun();9withStatic::testRun();10withStatic::testRun();11withStatic::testRun();12withStatic::testRun();13withStatic::testRun();

Full Screen

Full Screen

testRun

Using AI Code Generation

copy

Full Screen

1$test=new withStatic();2echo $test->testRun();3echo $test->testRun();4echo $test->testRun();5$test=new withStatic();6echo $test->testRun();7echo $test->testRun();8echo $test->testRun();9$test=new withStatic();10echo $test->testRun();11echo $test->testRun();12echo $test->testRun();

Full Screen

Full Screen

testRun

Using AI Code Generation

copy

Full Screen

1require_once 'withStatic.php';2withStatic::testRun();3require_once 'withStatic.php';4withStatic::testRun();5require_once 'withStatic.php';6withStatic::testRun();7require_once 'withStatic.php';8withStatic::testRun();9require_once 'withStatic.php';10withStatic::testRun();11require_once 'withStatic.php';12withStatic::testRun();13require_once 'withStatic.php';14withStatic::testRun();15require_once 'withStatic.php';16withStatic::testRun();17require_once 'withStatic.php';18withStatic::testRun();19require_once 'withStatic.php';20withStatic::testRun();

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger testRun code on LambdaTest Cloud Grid

Execute automation tests with testRun on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful