How to use testMethod2 method of notEmptyTest class

Best Atoum code snippet using notEmptyTest.testMethod2

test.php

Source:test.php Github

copy

Full Screen

...34 @extensions mbstring socket35 @ignore off36 @tags test method two37 */38 public function testMethod2() {}39 public function aDataProvider()40 {41 }42 }43 class foo extends atoum\test44 {45 public function __construct()46 {47 $this->setTestedClassName('mageekguy\atoum\test');48 parent::__construct();49 }50 }51 class test extends atoum\test52 {53 public function testClassConstants()54 {55 $this56 ->string(atoum\test::testMethodPrefix)->isEqualTo('test')57 ->string(atoum\test::runStart)->isEqualTo('testRunStart')58 ->string(atoum\test::beforeSetUp)->isEqualTo('beforeTestSetUp')59 ->string(atoum\test::afterSetUp)->isEqualTo('afterTestSetUp')60 ->string(atoum\test::beforeTestMethod)->isEqualTo('beforeTestMethod')61 ->string(atoum\test::fail)->isEqualTo('testAssertionFail')62 ->string(atoum\test::error)->isEqualTo('testError')63 ->string(atoum\test::uncompleted)->isEqualTo('testUncompleted')64 ->string(atoum\test::skipped)->isEqualTo('testSkipped')65 ->string(atoum\test::exception)->isEqualTo('testException')66 ->string(atoum\test::success)->isEqualTo('testAssertionSuccess')67 ->string(atoum\test::afterTestMethod)->isEqualTo('afterTestMethod')68 ->string(atoum\test::beforeTearDown)->isEqualTo('beforeTestTearDown')69 ->string(atoum\test::afterTearDown)->isEqualTo('afterTestTearDown')70 ->string(atoum\test::runStop)->isEqualTo('testRunStop')71 ->string(atoum\test::defaultNamespace)->isEqualTo('#(?:^|\\\\)tests?\\\\units?\\\\#i')72 ->string(atoum\test::defaultMethodPrefix)->isEqualTo('#^(?:test|_*[^_]+_should_)#i')73 ;74 }75 public function test__construct()76 {77 $this78 ->if($test = new emptyTest())79 ->then80 ->object($test->getScore())->isInstanceOf('mageekguy\atoum\score')81 ->object($test->getLocale())->isEqualTo(new atoum\locale())82 ->object($test->getAdapter())->isEqualTo(new atoum\adapter())83 ->object($test->getPhpMocker())->isInstanceOf('mageekguy\atoum\php\mocker')84 ->object($test->getFactoryBuilder())->isInstanceOf('mageekguy\atoum\factory\builder\closure')85 ->boolean($test->isIgnored())->isTrue()86 ->boolean($test->debugModeIsEnabled())->isFalse()87 ->array($test->getAllTags())->isEqualTo($tags = array('empty', 'fake', 'dummy'))88 ->array($test->getTags())->isEqualTo($tags)89 ->array($test->getMethodTags())->isEmpty()90 ->array($test->getDataProviders())->isEmpty()91 ->integer($test->getMaxChildrenNumber())->isEqualTo(666)92 ->boolean($test->codeCoverageIsEnabled())->isEqualTo(extension_loaded('xdebug'))93 ->string($test->getTestNamespace())->isEqualTo(atoum\test::defaultNamespace)94 ->integer($test->getMaxChildrenNumber())->isEqualTo(666)95 ->variable($test->getBootstrapFile())->isNull()96 ->array($test->getClassPhpVersions())->isEmpty()97 ->array($test->getMandatoryClassExtensions())->isEmpty()98 ->array($test->getMandatoryMethodExtensions())->isEmpty()99 ->variable($test->getXdebugConfig())->isNull()100 ;101 }102 public function test__toString()103 {104 $this->castToString($this)->isEqualTo(__CLASS__);105 }106 public function test__get()107 {108 $this109 ->if($test = new emptyTest())110 ->then111 ->object($test->assert)->isInstanceOf('mageekguy\atoum\test')112 ->object($test->define)->isInstanceOf('mageekguy\atoum\test\assertion\aliaser')113 ->object($test->mockGenerator)->isInstanceOf('mageekguy\atoum\mock\generator')114 ->if($test->setMockGenerator($mockGenerator = new atoum\test\mock\generator($this)))115 ->then116 ->object($test->mockGenerator)->isIdenticalTo($mockGenerator)117 ->if($test->setAsserterGenerator($asserterGenerator = new atoum\test\asserter\generator(new emptyTest())))118 ->then119 ->object($test->assert)->isIdenticalTo($test)120 ->variable($test->exception)->isNull()121 ->exception(function() use ($test, & $property) { $test->{$property = uniqid()}; })122 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')123 ->hasMessage('Asserter \'' . $property . '\' does not exist')124 ->exception($test->exception)125 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')126 ->hasMessage('Asserter \'' . $property . '\' does not exist')127 ;128 }129 public function test__set()130 {131 $this132 ->given(133 $test = new emptyTest(),134 $test->setAssertionManager($assertionManager = new \mock\mageekguy\atoum\test\assertion\manager())135 )136 ->if($test->{$event = uniqid()} = $handler = function() {})137 ->then138 ->mock($assertionManager)->call('setHandler')->withArguments($event, $handler)->once()139 ;140 }141 public function testEnableDebugMode()142 {143 $this144 ->if($test = new emptyTest())145 ->then146 ->object($test->enableDebugMode())->isIdenticalTo($test)147 ->boolean($test->debugModeIsEnabled())->isTrue()148 ->object($test->enableDebugMode())->isIdenticalTo($test)149 ->boolean($test->debugModeIsEnabled())->isTrue()150 ;151 }152 public function testDisableDebugMode()153 {154 $this155 ->if($test = new emptyTest())156 ->then157 ->object($test->disableDebugMode())->isIdenticalTo($test)158 ->boolean($test->debugModeIsEnabled())->isFalse()159 ->object($test->disableDebugMode())->isIdenticalTo($test)160 ->boolean($test->debugModeIsEnabled())->isFalse()161 ->if($test->enableDebugMode())162 ->then163 ->object($test->disableDebugMode())->isIdenticalTo($test)164 ->boolean($test->debugModeIsEnabled())->isFalse()165 ;166 }167 public function testEnableCodeCoverage()168 {169 $this170 ->assert('Code coverage must be enabled only if xdebug is available')171 ->if($adapter = new atoum\test\adapter())172 ->and($adapter->extension_loaded = function($extension) { return $extension == 'xdebug'; })173 ->and($test = new emptyTest($adapter))174 ->then175 ->boolean($test->codeCoverageIsEnabled())->isTrue()176 ->object($test->enableCodeCoverage())->isIdenticalTo($test)177 ->boolean($test->codeCoverageIsEnabled())->isTrue()178 ->if($test->disableCodeCoverage())179 ->then180 ->boolean($test->codeCoverageIsEnabled())->isFalse()181 ->object($test->enableCodeCoverage())->isIdenticalTo($test)182 ->boolean($test->codeCoverageIsEnabled())->isTrue()183 ->assert('Code coverage must not be enabled if xdebug is not available')184 ->if($adapter->extension_loaded = function($extension) { return $extension != 'xdebug'; })185 ->and($test = new emptyTest($adapter))186 ->then187 ->boolean($test->codeCoverageIsEnabled())->isFalse()188 ->object($test->enableCodeCoverage())->isIdenticalTo($test)189 ->boolean($test->codeCoverageIsEnabled())->isFalse()190 ;191 }192 public function testDisableCodeCoverage()193 {194 $this195 ->if($adapter = new atoum\test\adapter())196 ->and($adapter->extension_loaded = true)197 ->and($test = new emptyTest($adapter))198 ->then199 ->boolean($test->codeCoverageIsEnabled())->isTrue()200 ->object($test->disableCodeCoverage())->isIdenticalTo($test)201 ->boolean($test->codeCoverageIsEnabled())->isFalse()202 ->if($test->enableCodeCoverage())203 ->then204 ->boolean($test->codeCoverageIsEnabled())->isTrue()205 ->object($test->disableCodeCoverage())->isIdenticalTo($test)206 ->boolean($test->codeCoverageIsEnabled())->isFalse()207 ;208 }209 public function testGetMockGenerator()210 {211 $this212 ->if($test = new emptyTest())213 ->then214 ->object($test->getMockGenerator())->isInstanceOf('mageekguy\atoum\mock\generator')215 ->if($test->setMockGenerator($mockGenerator = new atoum\test\mock\generator($this)))216 ->then217 ->object($test->getMockGenerator())->isIdenticalTo($mockGenerator)218 ->object($mockGenerator->getTest())->isIdenticalTo($test)219 ;220 }221 public function testSetMockGenerator()222 {223 $this224 ->if($test = new emptyTest())225 ->then226 ->object($test->setMockGenerator($mockGenerator = new atoum\test\mock\generator($this)))->isIdenticalTo($test)227 ->object($test->getMockGenerator())->isIdenticalTo($mockGenerator)228 ->object($mockGenerator->getTest())->isIdenticalTo($test)229 ;230 }231 public function testSetMockAutoloader()232 {233 $this234 ->if($test = new emptyTest())235 ->then236 ->object($test->setMockAutoloader($mockAutoloader = new atoum\autoloader\mock()))->isIdenticalTo($test)237 ->object($test->getMockAutoloader())->isIdenticalTo($mockAutoloader)238 ;239 }240 public function testGetAsserterGenerator()241 {242 $this243 ->if($test = new emptyTest())244 ->then245 ->object($test->getAsserterGenerator())->isInstanceOf('mageekguy\atoum\test\asserter\generator')246 ->if($test->setAsserterGenerator($asserterGenerator = new atoum\test\asserter\generator($this)))247 ->then248 ->object($test->getAsserterGenerator())->isIdenticalTo($asserterGenerator)249 ->object($asserterGenerator->getTest())->isIdenticalTo($test)250 ;251 }252 public function testSetAsserterGenerator()253 {254 $this255 ->if($test = new emptyTest())256 ->then257 ->object($test->setAsserterGenerator($asserterGenerator = new atoum\test\asserter\generator($test)))->isIdenticalTo($test)258 ->object($test->getAsserterGenerator())->isIdenticalTo($asserterGenerator)259 ->object($asserterGenerator->getTest())->isIdenticalTo($test)260 ->object($asserterGenerator->getLocale())->isIdenticalTo($test->getLocale())261 ;262 }263 public function testGetFactoryBuilder()264 {265 $this266 ->if($test = new emptyTest())267 ->then268 ->object($test->getFactoryBuilder())->isInstanceOf('mageekguy\atoum\factory\builder\closure')269 ->if($test->setFactoryBuilder($factoryBuilder = new \mock\atoum\factory\builder()))270 ->then271 ->object($test->getFactoryBuilder())->isIdenticalTo($factoryBuilder)272 ;273 }274 public function testSetFactoryBuilder()275 {276 $this277 ->if($test = new emptyTest())278 ->then279 ->object($test->setFactoryBuilder($factoryBuilder = new \mock\atoum\factory\builder()))->isIdenticalTo($test)280 ->object($test->getFactoryBuilder())->isIdenticalTo($factoryBuilder)281 ->object($test->setFactoryBuilder())->isIdenticalTo($test)282 ->object($test->getFactoryBuilder())283 ->isEqualTo(new atoum\Factory\builder\closure())284 ->isNotIdenticalTo($factoryBuilder)285 ;286 }287 public function testSetPhpMocker()288 {289 $this290 ->if($test = new emptyTest())291 ->then292 ->object($test->setPhpMocker($phpMocker = new atoum\php\mocker()))->isIdenticalTo($test)293 ->object($test->getPhpMocker())->isIdenticalTo($phpMocker)294 ->object($test->setPhpMocker())->isIdenticalTo($test)295 ->object($test->getPhpMocker())296 ->isNotIdenticalTo($phpMocker)297 ->isInstanceOf('mageekguy\atoum\php\mocker')298 ;299 }300 public function testSetTestNamespace()301 {302 $this303 ->if($test = new self())304 ->then305 ->object($test->setTestNamespace($testNamespace = uniqid()))->isIdenticalTo($test)306 ->string($test->getTestNamespace())->isEqualTo($testNamespace)307 ->object($test->setTestNamespace('\\' . ($testNamespace = uniqid())))->isIdenticalTo($test)308 ->string($test->getTestNamespace())->isEqualTo($testNamespace)309 ->object($test->setTestNamespace('\\' . ($testNamespace = uniqid()) . '\\'))->isIdenticalTo($test)310 ->string($test->getTestNamespace())->isEqualTo($testNamespace)311 ->object($test->setTestNamespace(($testNamespace = uniqid()) . '\\'))->isIdenticalTo($test)312 ->string($test->getTestNamespace())->isEqualTo($testNamespace)313 ->object($test->setTestNamespace($testNamespace = rand(- PHP_INT_MAX, PHP_INT_MAX)))->isIdenticalTo($test)314 ->string($test->getTestNamespace())->isEqualTo((string) $testNamespace)315 ->exception(function() use ($test) {316 $test->setTestNamespace('');317 }318 )319 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')320 ->hasMessage('Test namespace must not be empty')321 ;322 }323 public function testGetTestNamespace()324 {325 $this326 ->if($test = new self())327 ->then328 ->string($test->getTestNamespace())->isEqualTo(atoum\test::defaultNamespace)329 ->if($test->setTestNamespace($testNamespace = uniqid()))330 ->then331 ->string($test->getTestNamespace())->isEqualTo($testNamespace)332 ;333 }334 public function testSetTestMethodPrefix()335 {336 $this337 ->if($test = new self())338 ->then339 ->object($test->setTestMethodPrefix($testMethodPrefix = uniqid()))->isIdenticalTo($test)340 ->string($test->getTestMethodPrefix())->isEqualTo($testMethodPrefix)341 ->object($test->setTestMethodPrefix($testMethodPrefix = rand(- PHP_INT_MAX, PHP_INT_MAX)))->isIdenticalTo($test)342 ->string($test->getTestMethodPrefix())->isEqualTo((string) $testMethodPrefix)343 ->exception(function() use ($test) {344 $test->setTestMethodPrefix('');345 }346 )347 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')348 ->hasMessage('Test method prefix must not be empty')349 ;350 }351 public function testGetTestMethodPrefix()352 {353 $this354 ->if($test = new self())355 ->then356 ->string($test->getTestMethodPrefix())->isEqualTo(atoum\test::defaultMethodPrefix)357 ->if($test->setTestMethodPrefix($testMethodPrefix = uniqid()))358 ->then359 ->string($test->getTestMethodPrefix())->isEqualTo($testMethodPrefix)360 ;361 }362 public function testGetTestedClassName()363 {364 $mockClass = '\mock\\' . __CLASS__;365 $this366 ->if($test = new $mockClass())367 ->and($test->getMockController()->getClass = $testClass = 'foo')368 ->then369 ->exception(function() use ($test) { $test->getTestedClassName(); })370 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')371 ->hasMessage('Test class \'' . $testClass . '\' is not in a namespace which match pattern \'' . $test->getTestNamespace() . '\'')372 ->if($test->getMockController()->getClass = 'tests\units\foo')373 ->then374 ->string($test->getTestedClassName())->isEqualTo('foo')375 ;376 }377 public function testGetTestedClassPath()378 {379 $this380 ->if($testedClass = new \reflectionClass($this->getTestedClassName()))381 ->then382 ->string($this->getTestedClassPath())->isEqualTo($testedClass->getFilename())383 ;384 }385 public function testGetAdapter()386 {387 $this388 ->if($test = new emptyTest())389 ->then390 ->object($test->getAdapter())->isInstanceOf('mageekguy\atoum\adapter')391 ;392 }393 public function testSetAdapter()394 {395 $this396 ->if($test = new emptyTest())397 ->then398 ->object($test->setAdapter($adapter = new atoum\test\adapter()))->isIdenticalTo($test)399 ->object($test->getAdapter())->isIdenticalTo($adapter)400 ;401 }402 public function testSetLocale()403 {404 $this405 ->if($test = new emptyTest())406 ->then407 ->object($test->setLocale($locale = new atoum\locale()))->isIdenticalTo($test)408 ->object($test->getLocale())->isIdenticalTo($locale)409 ;410 }411 public function testSetScore()412 {413 $this414 ->if($test = new emptyTest())415 ->then416 ->object($test->setScore($score = new atoum\test\score()))->isIdenticalTo($test)417 ->object($test->getScore())->isIdenticalTo($score)418 ;419 }420 public function testSetBootstrapFile()421 {422 $this423 ->if($test = new emptyTest())424 ->then425 ->object($test->setBootstrapFile($path = uniqid()))->isIdenticalTo($test)426 ->string($test->getBootstrapFile())->isEqualTo($path)427 ;428 }429 public function testSetMaxChildrenNumber()430 {431 $this432 ->if($test = new emptyTest())433 ->then434 ->exception(function() use ($test) { $test->setMaxChildrenNumber(- rand(1, PHP_INT_MAX)); })435 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')436 ->hasMessage('Maximum number of children must be greater or equal to 1')437 ->exception(function() use ($test) { $test->setMaxChildrenNumber(0); })438 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')439 ->hasMessage('Maximum number of children must be greater or equal to 1')440 ->object($test->setMaxChildrenNumber($maxChildrenNumber = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)441 ->integer($test->getMaxChildrenNumber())->isEqualTo($maxChildrenNumber)442 ->object($test->setMaxChildrenNumber((string) $maxChildrenNumber = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)443 ->integer($test->getMaxChildrenNumber())->isEqualTo($maxChildrenNumber)444 ;445 }446 public function testGetClass()447 {448 $this449 ->if($test = new emptyTest())450 ->then451 ->string($test->getClass())->isEqualTo(__NAMESPACE__ . '\emptyTest')452 ;453 }454 public function testGetPath()455 {456 $this457 ->if($test = new emptyTest())458 ->then459 ->string($test->getPath())->isEqualTo(__FILE__)460 ;461 }462 public function testGetCoverage()463 {464 $this465 ->if($test = new emptyTest())466 ->then467 ->object($test->getCoverage())->isIdenticalTo($test->getScore()->getCoverage())468 ;469 }470 public function testIsIgnored()471 {472 $this473 ->if($test = new emptyTest())474 ->then475 ->boolean($test->isIgnored())->isTrue()476 ->object($test->ignore(false))->isIdenticalTo($test)477 ->boolean($test->isIgnored())->isTrue()478 ->object($test->ignore(true))->isIdenticalTo($test)479 ->boolean($test->isIgnored())->isTrue()480 ->if($test = new notEmptyTest())481 ->then482 ->boolean($test->isIgnored())->isTrue()483 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()484 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()485 ->object($test->ignore(false))->isIdenticalTo($test)486 ->boolean($test->isIgnored())->isFalse()487 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()488 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()489 ->object($test->ignore(true))->isIdenticalTo($test)490 ->boolean($test->isIgnored())->isTrue()491 ->boolean($test->methodIsIgnored('testMethod1'))->istrue()492 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()493 ;494 }495 public function testGetCurrentMethod()496 {497 $this498 ->if($test = new emptyTest())499 ->then500 ->variable($test->getCurrentMethod())->isNull()501 ;502 }503 public function testCount()504 {505 $this506 ->sizeOf(new emptyTest())->isEqualTo(0)507 ->if($test = new notEmptyTest())508 ->then509 ->sizeOf($test)->isEqualTo(0)510 ->if($test->ignore(false))511 ->then512 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()513 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()514 ->sizeOf($test)->isEqualTo(2)515 ->if($test->ignoreMethod('testMethod1', true))516 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()517 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()518 ->sizeOf($test)->isEqualTo(1)519 ->if($test->ignoreMethod('testMethod2', true))520 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()521 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()522 ->sizeOf($test)->isEqualTo(0)523 ;524 }525 public function testGetTestMethods()526 {527 $this528 ->if($test = new emptyTest())529 ->then530 ->boolean($test->ignore(false)->isIgnored())->isTrue()531 ->sizeOf($test)->isZero()532 ->array($test->getTestMethods())->isEmpty()533 ->if($test = new notEmptyTest())534 ->then535 ->boolean($test->isIgnored())->isTrue()536 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()537 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()538 ->sizeOf($test)->isEqualTo(0)539 ->array($test->getTestMethods())->isEmpty()540 ->boolean($test->ignore(false)->isIgnored())->isFalse()541 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()542 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()543 ->sizeOf($test)->isEqualTo(2)544 ->array($test->getTestMethods())->isEqualTo(array('testMethod1', 'testMethod2'))545 ->array($test->getTestMethods(array('method')))->isEqualTo(array('testMethod1', 'testMethod2'))546 ->array($test->getTestMethods(array('test')))->isEqualTo(array('testMethod1', 'testMethod2'))547 ->array($test->getTestMethods(array('two')))->isEqualTo(array('testMethod2'))548 ->array($test->getTestMethods(array(uniqid())))->isEmpty()549 ->array($test->getTestMethods(array('test', 'method')))->isEqualTo(array('testMethod1', 'testMethod2'))550 ->array($test->getTestMethods(array('test', 'method', uniqid())))->isEqualTo(array('testMethod1', 'testMethod2'))551 ->array($test->getTestMethods(array('test', 'method', 'two', uniqid())))->isEqualTo(array('testMethod1', 'testMethod2'))552 ;553 }554 public function testGetPhpPath()555 {556 $this557 ->if($test = new emptyTest())558 ->then559 ->variable($test->getPhpPath())->isNull()560 ->if($test->setPhpPath($phpPath = uniqid()))561 ->then562 ->string($test->getPhpPath())->isEqualTo($phpPath)563 ;564 }565 public function testSetPhpPath()566 {567 $this568 ->if($test = new emptyTest())569 ->then570 ->object($test->setPhpPath($phpPath = uniqid()))->isIdenticalTo($test)571 ->string($test->getPhpPath())->isIdenticalTo($phpPath)572 ->object($test->setPhpPath($phpPath = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)573 ->string($test->getPhpPath())->isIdenticalTo((string) $phpPath)574 ;575 }576 public function testMethodIsIgnored()577 {578 $this579 ->if($test = new emptyTest())580 ->then581 ->exception(function() use ($test, & $method) { $test->methodIsIgnored($method = uniqid()); })582 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')583 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')584 ;585 }586 public function testSetTags()587 {588 $this589 ->if($test = new emptyTest())590 ->then591 ->object($test->setTags($tags = array(uniqid(), uniqid())))->isIdenticalTo($test)592 ->array($test->getTags())->isEqualTo($tags)593 ;594 }595 public function testSetMethodTags()596 {597 $this598 ->if($test = new notEmptyTest())599 ->then600 ->object($test->setMethodTags('testMethod1', $tags = array(uniqid(), uniqid())))->isIdenticalTo($test)601 ->array($test->getMethodTags('testMethod1'))->isEqualTo($tags)602 ->exception(function() use ($test, & $method) { $test->setMethodTags($method = uniqid(), array()); })603 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')604 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')605 ;606 }607 public function testGetMethodTags()608 {609 $this610 ->if($test = new notemptyTest())611 ->then612 ->array($test->getMethodTags('testMethod1'))->isEqualTo(array('test', 'method', 'one'))613 ->exception(function() use ($test, & $method) { $test->getMethodTags($method = uniqid()); })614 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')615 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')616 ;617 }618 public function testAddMandatoryClassExtension()619 {620 $this621 ->if($test = new notEmptyTest())622 ->then623 ->object($test->addMandatoryClassExtension($extension = uniqid()))->isIdenticalTo($test)624 ->array($test->getMandatoryClassExtensions())->isEqualTo(array($extension))625 ->object($test->addMandatoryClassExtension($otherExtension = uniqid()))->isIdenticalTo($test)626 ->array($test->getMandatoryClassExtensions())->isEqualTo(array($extension, $otherExtension))627 ;628 }629 public function testGetMandatoryMethodExtensions()630 {631 $this632 ->if($test = new notEmptyTest())633 ->then634 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEmpty()635 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(array('mbstring', 'socket'))636 ;637 }638 public function testAddMandatoryMethodExtension()639 {640 $this641 ->if($test = new notEmptyTest())642 ->then643 ->exception(function() use ($test, & $method) { $test->addMandatoryMethodExtension($method = uniqid(), uniqid()); })644 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')645 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')646 ->object($test->addMandatoryMethodExtension('testMethod1', $extension = uniqid()))->isIdenticalTo($test)647 ->array($test->getMandatoryMethodExtensions())->isEqualTo(array('testMethod1' => array($extension), 'testMethod2' => array('mbstring', 'socket')))648 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo(array($extension))649 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(array('mbstring', 'socket'))650 ->object($test->addMandatoryMethodExtension('testMethod1', $otherExtension = uniqid()))->isIdenticalTo($test)651 ->array($test->getMandatoryMethodExtensions())->isEqualTo(array('testMethod1' => array($extension, $otherExtension), 'testMethod2' => array('mbstring', 'socket')))652 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo(array($extension, $otherExtension))653 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(array('mbstring', 'socket'))654 ->object($test->addMandatoryMethodExtension('testMethod2', $anOtherExtension = uniqid()))->isIdenticalTo($test)655 ->array($test->getMandatoryMethodExtensions())->isEqualTo(array('testMethod1' => array($extension, $otherExtension), 'testMethod2' => array('mbstring', 'socket', $anOtherExtension)))656 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo(array($extension, $otherExtension))657 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(array('mbstring', 'socket', $anOtherExtension))658 ->if($test->addMandatoryClassExtension($classExtension = uniqid()))659 ->then660 ->array($test->getMandatoryMethodExtensions())->isEqualTo(array('testMethod1' => array($classExtension, $extension, $otherExtension), 'testMethod2' => array($classExtension, 'mbstring', 'socket', $anOtherExtension)))661 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo(array($classExtension, $extension, $otherExtension))662 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(array($classExtension, 'mbstring', 'socket', $anOtherExtension))663 ;664 }665 public function testAddClassPhpVersion()666 {667 $this668 ->if($test = new notEmptyTest())669 ->then670 ->object($test->addClassPhpVersion('5.3'))->isIdenticalTo($test)671 ->array($test->getClassPhpVersions())->isEqualTo(array('5.3' => '>='))672 ->object($test->addClassPhpVersion('5.4', '<='))->isIdenticalTo($test)673 ->array($test->getClassPhpVersions())->isEqualTo(array('5.3' => '>=', '5.4' => '<='))674 ;675 }676 public function testAddMethodPhpVersion()677 {678 $this679 ->if($test = new notEmptyTest())680 ->then681 ->exception(function() use ($test, & $method) { $test->addMethodPhpVersion($method, '6.0'); })682 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')683 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')684 ->object($test->addMethodPhpVersion('testMethod1', '5.3'))->isIdenticalTo($test)685 ->array($test->getMethodPhpVersions())->isEqualTo(array('testMethod1' => array('5.3' => '>='), 'testMethod2' => array()))686 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(array('5.3' => '>='))687 ->array($test->getMethodPhpVersions('testMethod2'))->isEmpty()688 ->object($test->addMethodPhpVersion('testMethod1', '5.4', '<='))->isIdenticalTo($test)689 ->array($test->getMethodPhpVersions())->isEqualTo(array('testMethod1' => array('5.3' => '>=', '5.4' => '<='), 'testMethod2' => array()))690 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(array('5.3' => '>=', '5.4' => '<='))691 ->array($test->getMethodPhpVersions('testMethod2'))->isEmpty()692 ->object($test->addMethodPhpVersion('testMethod2', '5.4', '>='))->isIdenticalTo($test)693 ->array($test->getMethodPhpVersions())->isEqualTo(array('testMethod1' => array('5.3' => '>=', '5.4' => '<='), 'testMethod2' => array('5.4' => '>=')))694 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(array('5.3' => '>=', '5.4' => '<='))695 ->array($test->getMethodPhpVersions('testMethod2'))->isEqualTo(array('5.4' => '>='))696 ->if($test->addClassPhpVersion('5.5'))697 ->then698 ->array($test->getMethodPhpVersions())->isEqualTo(array('testMethod1' => array('5.5' => '>=', '5.3' => '>=', '5.4' => '<='), 'testMethod2' => array('5.5' => '>=', '5.4' => '>=')))699 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(array('5.5' => '>=', '5.3' => '>=', '5.4' => '<='))700 ->array($test->getMethodPhpVersions('testMethod2'))->isEqualTo(array('5.5' => '>=', '5.4' => '>='))701 ;702 }703 public function testRun()704 {705 $this706 ->mockTestedClass('mock\tests\units')707 ->if($test = new \mock\tests\units\test())708 ->then709 ->object($test->run())->isIdenticalTo($test)710 ->mock($test)711 ->call('callObservers')712 ->withArguments(\mageekguy\atoum\test::runStart)->never()713 ->withArguments(\mageekguy\atoum\test::runStop)->never()714 ->withArguments(\mageekguy\atoum\test::beforeSetUp)->never()715 ->withArguments(\mageekguy\atoum\test::afterSetUp)->never()716 ->withArguments(\mageekguy\atoum\test::beforeTestMethod)->never()717 ->withArguments(\mageekguy\atoum\test::afterTestMethod)->never()718 ;719 }720 public function testSetTestedClassName()721 {722 $this723 ->if($test = new foo())724 ->then725 ->string($test->getTestedClassName())->isEqualTo('mageekguy\atoum\test')726 ->exception(function() use ($test) { $test->setTestedClassName(uniqid()); })727 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')728 ->hasMessage('Tested class name is already defined')729 ->if($test = new self())730 ->then731 ->object($test->setTestedClassName($class = uniqid()))->isIdenticalTo($test)732 ->string($test->getTestedClassName())->isEqualTo($class)733 ->exception(function() use ($test) { $test->setTestedClassName(uniqid()); })734 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')735 ->hasMessage('Tested class name is already defined')736 ;737 }738 public function testMockClass()739 {740 $this741 ->if($test = new emptyTest())742 ->then743 ->object($test->mockClass(__CLASS__))->isIdenticalTo($test)744 ->class('mock\\' . __CLASS__)->isSubClassOf(__CLASS__)745 ->object($test->mockClass(__CLASS__, 'foo'))->isIdenticalTo($test)746 ->class('foo\test')->isSubClassOf(__CLASS__)747 ->object($test->mockClass(__CLASS__, 'foo\bar'))->isIdenticalTo($test)748 ->class('foo\bar\test')->isSubClassOf(__CLASS__)749 ->object($test->mockClass(__CLASS__, 'foo', 'bar'))->isIdenticalTo($test)750 ->class('foo\bar')->isSubClassOf(__CLASS__)751 ;752 }753 public function testMockTestedClass()754 {755 $this756 ->if($test = new emptyTest())757 ->and($testedClassName = $test->getTestedClassName())758 ->then759 ->object($test->mockTestedClass())->isIdenticalTo($test)760 ->class('mock\\' . $testedClassName)->isSubClassOf($testedClassName)761 ->object($test->mockTestedClass('foo'))->isIdenticalTo($test)762 ->class('foo\emptyTest')->isSubClassOf($testedClassName)763 ->object($test->mockTestedClass('foo\bar'))->isIdenticalTo($test)764 ->class('foo\bar\emptyTest')->isSubClassOf($testedClassName)765 ->object($test->mockTestedClass('foo', 'bar'))->isIdenticalTo($test)766 ->class('foo\bar')->isSubClassOf($testedClassName)767 ;768 }769 public function testGetTaggedTestMethods()770 {771 $this772 ->if($test = new emptyTest())773 ->then774 ->array($test->getTaggedTestMethods(array()))->isEmpty()775 ->array($test->getTaggedTestMethods(array(uniqid())))->isEmpty()776 ->array($test->getTaggedTestMethods(array(uniqid(), uniqid())))->isEmpty()777 ->if($test = new notEmptyTest())778 ->then779 ->array($test->getTaggedTestMethods(array()))->isEmpty()780 ->array($test->getTaggedTestMethods(array(uniqid())))->isEmpty()781 ->array($test->getTaggedTestMethods(array(uniqid(), uniqid())))->isEmpty()782 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod1', uniqid())))->isEmpty()783 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod1', uniqid(), 'testMethod2')))->isEmpty()784 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2')))->isEmpty()785 ->if($test->ignore(false))786 ->then787 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod1', uniqid())))->isEqualTo(array('testMethod1'))788 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod2', uniqid())))->isEqualTo(array('testMethod2'))789 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2')))->isEqualTo(array('Testmethod1', 'Testmethod2'))790 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2'), array('one')))->isEqualTo(array('Testmethod1'))791 ->if($test->ignoreMethod('testMethod1', true))792 ->then793 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod1', uniqid())))->isEmpty()794 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod2', uniqid())))->isEqualTo(array('testMethod2'))795 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2')))->isEqualTo(array('Testmethod2'))796 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2'), array('one')))->isEmpty()797 ;798 }799 public function testSetDataProvider()800 {801 $this802 ->if($test = new emptyTest())803 ->then804 ->exception(function() use ($test, & $method) { $test->setDataProvider($method = uniqid(), uniqid()); })805 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')806 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')807 ->if($test = new notEmptyTest())808 ->then...

Full Screen

Full Screen

testMethod2

Using AI Code Generation

copy

Full Screen

1$notEmptyTest = new notEmptyTest();2$notEmptyTest->testMethod2();3$notEmptyTest = new notEmptyTest();4$notEmptyTest->testMethod1();5$notEmptyTest = new notEmptyTest();6$notEmptyTest->testMethod2();7$notEmptyTest = new notEmptyTest();8$notEmptyTest->testMethod1();9$notEmptyTest = new notEmptyTest();10$notEmptyTest->testMethod2();11$notEmptyTest = new notEmptyTest();12$notEmptyTest->testMethod1();13$notEmptyTest = new notEmptyTest();14$notEmptyTest->testMethod2();15$notEmptyTest = new notEmptyTest();16$notEmptyTest->testMethod1();17$notEmptyTest = new notEmptyTest();18$notEmptyTest->testMethod2();19$notEmptyTest = new notEmptyTest();20$notEmptyTest->testMethod1();21$notEmptyTest = new notEmptyTest();22$notEmptyTest->testMethod2();23$notEmptyTest = new notEmptyTest();24$notEmptyTest->testMethod1();25$notEmptyTest = new notEmptyTest();26$notEmptyTest->testMethod2();

Full Screen

Full Screen

testMethod2

Using AI Code Generation

copy

Full Screen

1$test = new notEmptyTest();2$test->testMethod2();3$test = new notEmptyTest();4$test->testMethod1();5Fatal error: Call to undefined method notEmptyTest::testMethod1() in /var/www/html/2.php on line 56{7 public function testMethod1()8 {9 }10}

Full Screen

Full Screen

testMethod2

Using AI Code Generation

copy

Full Screen

1$test = new notEmptyTest();2$test->testMethod2();3$test = new notEmptyTest();4$test->testMethod1();5class TestClass {6 public function testMethod() {7 $result = 1;8 return $result;9 }10}11I want to use the testMethod() method in another class. Here's the code of the other class:12require_once("TestClass.php");13class TestClass2 {14 public function testMethod2() {15 $test = new TestClass();16 $test->testMethod();17 }18}19Fatal error: Call to undefined method TestClass::testMethod() in /var/www/html/TestClass2.php on line 820$test = new notEmptyTest();21$test->testMethod2();22$test = new notEmptyTest();23$test->testMethod1();24$test = new notEmptyTest();25$test->testMethod2();

Full Screen

Full Screen

testMethod2

Using AI Code Generation

copy

Full Screen

1$notEmptyTest = new notEmptyTest();2echo $notEmptyTest->testMethod2();3$notEmptyTest = new notEmptyTest();4echo $notEmptyTest->testMethod2();5$notEmptyTest = new notEmptyTest();6echo $notEmptyTest->testMethod2();7include(file_name);8include(file_name);9include(file_name);

Full Screen

Full Screen

testMethod2

Using AI Code Generation

copy

Full Screen

1$notEmptyTest = new notEmptyTest();2$notEmptyTest->testMethod2();3$notEmptyTest = new notEmptyTest();4$notEmptyTest->testMethod1();5{6 public function testMethod1()7 {8 echo "testMethod1 is called";9 }10 public function testMethod2()11 {12 echo "testMethod2 is called";13 }14}15$notEmptyTest = new notEmptyTest();16$notEmptyTest->testMethod1();17$notEmptyTest->testMethod2();18{19 public function testMethod1()20 {21 echo "testMethod1 is called";22 }23 public function testMethod2()24 {25 echo "testMethod2 is called";26 }27}28$notEmptyTest = new notEmptyTest();29$notEmptyTest->testMethod1();30$notEmptyTest->testMethod2();31$notEmptyTest->testMethod1();32$notEmptyTest->testMethod2();

Full Screen

Full Screen

testMethod2

Using AI Code Generation

copy

Full Screen

1require_once('notEmptyTest.php');2$test = new notEmptyTest();3$test->testMethod2();4require_once('notEmptyTest.php');5$test = new notEmptyTest();6$test->testMethod1();7require_once('notEmptyTest.php');8$test = new notEmptyTest();9$test->testMethod2();10require_once('notEmptyTest.php');11$test = new notEmptyTest();12$test->testMethod1();13require_once('notEmptyTest.php');14$test = new notEmptyTest();15$test->testMethod2();16require_once('notEmptyTest.php');17$test = new notEmptyTest();18$test->testMethod1();19require_once('notEmptyTest.php');20$test = new notEmptyTest();21$test->testMethod2();22require_once('notEmptyTest.php');23$test = new notEmptyTest();24$test->testMethod1();25require_once('notEmptyTest.php');26$test = new notEmptyTest();27$test->testMethod2();28require_once('notEmptyTest.php');29$test = new notEmptyTest();30$test->testMethod1();31require_once('notEmptyTest.php');32$test = new notEmptyTest();33$test->testMethod2();34require_once('notEmptyTest.php');35$test = new notEmptyTest();36$test->testMethod1();

Full Screen

Full Screen

testMethod2

Using AI Code Generation

copy

Full Screen

1require_once "notEmptyTest.php";2$test = new notEmptyTest();3$test->testMethod2();4require_once "notEmptyTest.php";5$test = new notEmptyTest();6$test->testMethod1();

Full Screen

Full Screen

testMethod2

Using AI Code Generation

copy

Full Screen

1$notEmptyTest = new notEmptyTest();2$notEmptyTest->testMethod2();3class ParentClass {4}5class ChildClass extends ParentClass {6}7class ParentClass1 {8}9class ParentClass2 {10}11class ChildClass extends ParentClass1, ParentClass2 {12}13class Animal {14 public $name;15 public $color;16 public function __construct($name, $color) {17 $this->name = $name;18 $this->color = $color;19 }20 public function intro() {21 echo "My name is {$this->name} and I am

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 testMethod2 code on LambdaTest Cloud Grid

Execute automation tests with testMethod2 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