Best Atoum code snippet using emptyTest.testMethod1
test.php
Source:test.php
...28 {29 /**30 @tags test method one method31 */32 public function testMethod1() {}33 /**34 @ignore off35 @tags test method two36 */37 public function testMethod2() {}38 public function aDataProvider()39 {40 }41 }42 class foo extends atoum\test43 {44 public function __construct()45 {46 $this->setTestedClassName('mageekguy\atoum\test');47 parent::__construct();48 }49 }50 class test extends atoum\test51 {52 public function testClassConstants()53 {54 $this55 ->string(atoum\test::testMethodPrefix)->isEqualTo('test')56 ->string(atoum\test::runStart)->isEqualTo('testRunStart')57 ->string(atoum\test::beforeSetUp)->isEqualTo('beforeTestSetUp')58 ->string(atoum\test::afterSetUp)->isEqualTo('afterTestSetUp')59 ->string(atoum\test::beforeTestMethod)->isEqualTo('beforeTestMethod')60 ->string(atoum\test::fail)->isEqualTo('testAssertionFail')61 ->string(atoum\test::error)->isEqualTo('testError')62 ->string(atoum\test::uncompleted)->isEqualTo('testUncompleted')63 ->string(atoum\test::skipped)->isEqualTo('testSkipped')64 ->string(atoum\test::exception)->isEqualTo('testException')65 ->string(atoum\test::success)->isEqualTo('testAssertionSuccess')66 ->string(atoum\test::afterTestMethod)->isEqualTo('afterTestMethod')67 ->string(atoum\test::beforeTearDown)->isEqualTo('beforeTestTearDown')68 ->string(atoum\test::afterTearDown)->isEqualTo('afterTestTearDown')69 ->string(atoum\test::runStop)->isEqualTo('testRunStop')70 ->string(atoum\test::defaultNamespace)->isEqualTo('#(?:^|\\\\)tests?\\\\units?\\\\#i')71 ;72 }73 public function test__construct()74 {75 $this76 ->if($test = new emptyTest())77 ->then78 ->object($test->getScore())->isInstanceOf('mageekguy\atoum\score')79 ->object($test->getLocale())->isEqualTo(new atoum\locale())80 ->object($test->getAdapter())->isEqualTo(new atoum\adapter())81 ->boolean($test->isIgnored())->isTrue()82 ->boolean($test->debugModeIsEnabled())->isFalse()83 ->array($test->getAllTags())->isEqualTo($tags = array('empty', 'fake', 'dummy'))84 ->array($test->getTags())->isEqualTo($tags)85 ->array($test->getMethodTags())->isEmpty()86 ->array($test->getDataProviders())->isEmpty()87 ->integer($test->getMaxChildrenNumber())->isEqualTo(666)88 ->boolean($test->codeCoverageIsEnabled())->isEqualTo(extension_loaded('xdebug'))89 ->string($test->getTestNamespace())->isEqualTo(atoum\test::defaultNamespace)90 ->integer($test->getMaxChildrenNumber())->isEqualTo(666)91 ->variable($test->getBootstrapFile())->isNull()92 ->array($test->getClassPhpVersions())->isEmpty()93 ->array($test->getMandatoryClassExtensions())->isEmpty()94 ->array($test->getMandatoryMethodExtensions())->isEmpty()95 ;96 }97 public function test__toString()98 {99 $this->castToString($this)->isEqualTo(__CLASS__);100 }101 public function test__get()102 {103 $this104 ->if($test = new emptyTest())105 ->then106 ->object($test->assert)->isInstanceOf('mageekguy\atoum\test')107 ->object($test->define)->isInstanceOf('mageekguy\atoum\test\asserter\generator')108 ->object($test->mockGenerator)->isInstanceOf('mageekguy\atoum\mock\generator')109 ->if($test->setMockGenerator($mockGenerator = new atoum\test\mock\generator($this)))110 ->then111 ->object($test->mockGenerator)->isIdenticalTo($mockGenerator)112 ->if($test->setAsserterGenerator($asserterGenerator = new atoum\test\asserter\generator(new emptyTest())))113 ->then114 ->object($test->assert)->isIdenticalTo($test)115 ->exception(function() use ($test, & $property) { $test->{$property = uniqid()}; })116 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')117 ->hasMessage('Asserter \'' . $property . '\' does not exist')118 ;119 }120 public function testCreateFunctionFromAssertion()121 {122 $this123 ->if($test = new emptyTest())124 ->then125 ->object($test->createFunctionFromAssertion($assertion = uniqid()))->isIdenticalTo($test)126 ;127 }128 public function testEnableDebugMode()129 {130 $this131 ->if($test = new emptyTest())132 ->then133 ->object($test->enableDebugMode())->isIdenticalTo($test)134 ->boolean($test->debugModeIsEnabled())->isTrue()135 ->object($test->enableDebugMode())->isIdenticalTo($test)136 ->boolean($test->debugModeIsEnabled())->isTrue()137 ;138 }139 public function testDisableDebugMode()140 {141 $this142 ->if($test = new emptyTest())143 ->then144 ->object($test->disableDebugMode())->isIdenticalTo($test)145 ->boolean($test->debugModeIsEnabled())->isFalse()146 ->object($test->disableDebugMode())->isIdenticalTo($test)147 ->boolean($test->debugModeIsEnabled())->isFalse()148 ->if($test->enableDebugMode())149 ->then150 ->object($test->disableDebugMode())->isIdenticalTo($test)151 ->boolean($test->debugModeIsEnabled())->isFalse()152 ;153 }154 public function testEnableCodeCoverage()155 {156 $this157 ->assert('Code coverage must be enabled only if xdebug is available')158 ->if($adapter = new atoum\test\adapter())159 ->and($adapter->extension_loaded = function($extension) { return $extension == 'xdebug'; })160 ->and($test = new emptyTest($adapter))161 ->then162 ->boolean($test->codeCoverageIsEnabled())->isTrue()163 ->object($test->enableCodeCoverage())->isIdenticalTo($test)164 ->boolean($test->codeCoverageIsEnabled())->isTrue()165 ->if($test->disableCodeCoverage())166 ->then167 ->boolean($test->codeCoverageIsEnabled())->isFalse()168 ->object($test->enableCodeCoverage())->isIdenticalTo($test)169 ->boolean($test->codeCoverageIsEnabled())->isTrue()170 ->assert('Code coverage must not be enabled if xdebug is not available')171 ->if($adapter->extension_loaded = function($extension) { return $extension != 'xdebug'; })172 ->and($test = new emptyTest($adapter))173 ->then174 ->boolean($test->codeCoverageIsEnabled())->isFalse()175 ->object($test->enableCodeCoverage())->isIdenticalTo($test)176 ->boolean($test->codeCoverageIsEnabled())->isFalse()177 ;178 }179 public function testDisableCodeCoverage()180 {181 $this182 ->if($adapter = new atoum\test\adapter())183 ->and($adapter->extension_loaded = true)184 ->and($test = new emptyTest($adapter))185 ->then186 ->boolean($test->codeCoverageIsEnabled())->isTrue()187 ->object($test->disableCodeCoverage())->isIdenticalTo($test)188 ->boolean($test->codeCoverageIsEnabled())->isFalse()189 ->if($test->enableCodeCoverage())190 ->then191 ->boolean($test->codeCoverageIsEnabled())->isTrue()192 ->object($test->disableCodeCoverage())->isIdenticalTo($test)193 ->boolean($test->codeCoverageIsEnabled())->isFalse()194 ;195 }196 public function testGetMockGenerator()197 {198 $this199 ->if($test = new emptyTest())200 ->then201 ->object($test->getMockGenerator())->isInstanceOf('mageekguy\atoum\mock\generator')202 ->if($test->setMockGenerator($mockGenerator = new atoum\test\mock\generator($this)))203 ->then204 ->object($test->getMockGenerator())->isIdenticalTo($mockGenerator)205 ->object($mockGenerator->getTest())->isIdenticalTo($test)206 ;207 }208 public function testSetMockGenerator()209 {210 $this211 ->if($test = new emptyTest())212 ->then213 ->object($test->setMockGenerator($mockGenerator = new atoum\test\mock\generator($this)))->isIdenticalTo($test)214 ->object($test->getMockGenerator())->isIdenticalTo($mockGenerator)215 ->object($mockGenerator->getTest())->isIdenticalTo($test)216 ;217 }218 public function testGetAsserterGenerator()219 {220 $this221 ->if($test = new emptyTest())222 ->then223 ->object($test->getAsserterGenerator())->isInstanceOf('mageekguy\atoum\test\asserter\generator')224 ->if($test->setAsserterGenerator($asserterGenerator = new atoum\test\asserter\generator($this)))225 ->then226 ->object($test->getAsserterGenerator())->isIdenticalTo($asserterGenerator)227 ->object($asserterGenerator->getTest())->isIdenticalTo($test)228 ;229 }230 public function testSetAsserterGenerator()231 {232 $this233 ->if($test = new emptyTest())234 ->then235 ->object($test->setAsserterGenerator($asserterGenerator = new atoum\test\asserter\generator($test)))->isIdenticalTo($test)236 ->object($test->getAsserterGenerator())->isIdenticalTo($asserterGenerator)237 ->object($asserterGenerator->getTest())->isIdenticalTo($test)238 ->object($asserterGenerator->getLocale())->isIdenticalTo($test->getLocale())239 ;240 }241 public function testGetTestsSubNamespace()242 {243 $this244 ->if($test = new self())245 ->then246 ->string($test->getTestNamespace())->isEqualTo(atoum\test::defaultNamespace)247 ->if($test->setTestNamespace($testsSubNamespace = uniqid()))248 ->then249 ->string($test->getTestNamespace())->isEqualTo($testsSubNamespace)250 ;251 }252 public function testGetTestedClassName()253 {254 $mockClass = '\mock\\' . __CLASS__;255 $this256 ->if($test = new $mockClass())257 ->and($test->getMockController()->getClass = $testClass = 'foo')258 ->then259 ->exception(function() use ($test) { $test->getTestedClassName(); })260 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')261 ->hasMessage('Test class \'' . $testClass . '\' is not in a namespace which match pattern \'' . $test->getTestNamespace() . '\'')262 ->if($test->getMockController()->getClass = 'tests\units\foo')263 ->then264 ->string($test->getTestedClassName())->isEqualTo('foo')265 ;266 }267 public function testSetTestsSubNamespace()268 {269 $this270 ->if($test = new self())271 ->then272 ->object($test->setTestNamespace($testsSubNamespace = uniqid()))->isIdenticalTo($test)273 ->string($test->getTestNamespace())->isEqualTo($testsSubNamespace)274 ->object($test->setTestNamespace('\\' . ($testsSubNamespace = uniqid())))->isIdenticalTo($test)275 ->string($test->getTestNamespace())->isEqualTo($testsSubNamespace)276 ->object($test->setTestNamespace('\\' . ($testsSubNamespace = uniqid()) . '\\'))->isIdenticalTo($test)277 ->string($test->getTestNamespace())->isEqualTo($testsSubNamespace)278 ->object($test->setTestNamespace(($testsSubNamespace = uniqid()) . '\\'))->isIdenticalTo($test)279 ->string($test->getTestNamespace())->isEqualTo($testsSubNamespace)280 ->object($test->setTestNamespace($testsSubNamespace = rand(- PHP_INT_MAX, PHP_INT_MAX)))->isIdenticalTo($test)281 ->string($test->getTestNamespace())->isEqualTo((string) $testsSubNamespace)282 ->exception(function() use ($test) {283 $test->setTestNamespace('');284 }285 )286 ->isInstanceOf('invalidArgumentException')287 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')288 ->hasMessage('Test namespace must not be empty')289 ;290 }291 public function testGetAdapter()292 {293 $this294 ->if($test = new emptyTest())295 ->then296 ->object($test->getAdapter())->isInstanceOf('mageekguy\atoum\adapter')297 ;298 }299 public function testSetAdapter()300 {301 $this302 ->if($test = new emptyTest())303 ->then304 ->object($test->setAdapter($adapter = new atoum\test\adapter()))->isIdenticalTo($test)305 ->object($test->getAdapter())->isIdenticalTo($adapter)306 ;307 }308 public function testSetLocale()309 {310 $this311 ->if($test = new emptyTest())312 ->then313 ->object($test->setLocale($locale = new atoum\locale()))->isIdenticalTo($test)314 ->object($test->getLocale())->isIdenticalTo($locale)315 ;316 }317 public function testSetScore()318 {319 $this320 ->if($test = new emptyTest())321 ->then322 ->object($test->setScore($score = new atoum\test\score()))->isIdenticalTo($test)323 ->object($test->getScore())->isIdenticalTo($score)324 ;325 }326 public function testSetBootstrapFile()327 {328 $this329 ->if($test = new emptyTest())330 ->then331 ->object($test->setBootstrapFile($path = uniqid()))->isIdenticalTo($test)332 ->string($test->getBootstrapFile())->isEqualTo($path)333 ;334 }335 public function testSetMaxChildrenNumber()336 {337 $this338 ->if($test = new emptyTest())339 ->then340 ->exception(function() use ($test) { $test->setMaxChildrenNumber(- rand(1, PHP_INT_MAX)); })341 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')342 ->hasMessage('Maximum number of children must be greater or equal to 1')343 ->exception(function() use ($test) { $test->setMaxChildrenNumber(0); })344 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')345 ->hasMessage('Maximum number of children must be greater or equal to 1')346 ->object($test->setMaxChildrenNumber($maxChildrenNumber = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)347 ->integer($test->getMaxChildrenNumber())->isEqualTo($maxChildrenNumber)348 ->object($test->setMaxChildrenNumber((string) $maxChildrenNumber = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)349 ->integer($test->getMaxChildrenNumber())->isEqualTo($maxChildrenNumber)350 ;351 }352 public function testGetClass()353 {354 $this355 ->if($test = new emptyTest())356 ->then357 ->string($test->getClass())->isEqualTo(__NAMESPACE__ . '\emptyTest')358 ;359 }360 public function testGetPath()361 {362 $this363 ->if($test = new emptyTest())364 ->then365 ->string($test->getPath())->isEqualTo(__FILE__)366 ;367 }368 public function testGetCoverage()369 {370 $this371 ->if($test = new emptyTest())372 ->then373 ->object($test->getCoverage())->isIdenticalTo($test->getScore()->getCoverage())374 ;375 }376 public function testIgnore()377 {378 $this379 ->if($test = new emptyTest())380 ->then381 ->boolean($test->isIgnored())->isTrue()382 ->object($test->ignore(false))->isIdenticalTo($test)383 ->boolean($test->isIgnored())->isTrue()384 ->object($test->ignore(true))->isIdenticalTo($test)385 ->boolean($test->isIgnored())->isTrue()386 ->if($test = new notEmptyTest())387 ->then388 ->boolean($test->isIgnored())->isTrue()389 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()390 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()391 ->object($test->ignore(false))->isIdenticalTo($test)392 ->boolean($test->isIgnored())->isFalse()393 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()394 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()395 ->object($test->ignore(true))->isIdenticalTo($test)396 ->boolean($test->isIgnored())->isTrue()397 ->boolean($test->methodIsIgnored('testMethod1'))->istrue()398 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()399 ;400 }401 public function testGetCurrentMethod()402 {403 $this404 ->if($test = new emptyTest())405 ->then406 ->variable($test->getCurrentMethod())->isNull()407 ;408 }409 public function testCount()410 {411 $this412 ->sizeOf(new emptyTest())->isEqualTo(0)413 ->if($test = new notEmptyTest())414 ->then415 ->sizeOf($test)->isEqualTo(0)416 ->if($test->ignore(false))417 ->then418 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()419 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()420 ->sizeOf($test)->isEqualTo(2)421 ->if($test->ignoreMethod('testMethod1', true))422 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()423 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()424 ->sizeOf($test)->isEqualTo(1)425 ->if($test->ignoreMethod('testMethod2', true))426 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()427 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()428 ->sizeOf($test)->isEqualTo(0)429 ;430 }431 public function testGetTestMethods()432 {433 $this434 ->if($test = new emptyTest())435 ->then436 ->boolean($test->ignore(false)->isIgnored())->isTrue()437 ->sizeOf($test)->isZero()438 ->array($test->getTestMethods())->isEmpty()439 ->if($test = new notEmptyTest())440 ->then441 ->boolean($test->isIgnored())->isTrue()442 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()443 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()444 ->sizeOf($test)->isEqualTo(0)445 ->array($test->getTestMethods())->isEmpty()446 ->boolean($test->ignore(false)->isIgnored())->isFalse()447 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()448 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()449 ->sizeOf($test)->isEqualTo(2)450 ->array($test->getTestMethods())->isEqualTo(array('testMethod1', 'testMethod2'))451 ->array($test->getTestMethods(array('method')))->isEqualTo(array('testMethod1', 'testMethod2'))452 ->array($test->getTestMethods(array('test')))->isEqualTo(array('testMethod1', 'testMethod2'))453 ->array($test->getTestMethods(array('two')))->isEqualTo(array('testMethod2'))454 ->array($test->getTestMethods(array(uniqid())))->isEmpty()455 ->array($test->getTestMethods(array('test', 'method')))->isEqualTo(array('testMethod1', 'testMethod2'))456 ->array($test->getTestMethods(array('test', 'method', uniqid())))->isEqualTo(array('testMethod1', 'testMethod2'))457 ->array($test->getTestMethods(array('test', 'method', 'two', uniqid())))->isEqualTo(array('testMethod1', 'testMethod2'))458 ;459 }460 public function testGetPhpPath()461 {462 $this463 ->if($test = new emptyTest())464 ->then465 ->variable($test->getPhpPath())->isNull()466 ->if($test->setPhpPath($phpPath = uniqid()))467 ->then468 ->string($test->getPhpPath())->isEqualTo($phpPath)469 ;470 }471 public function testSetPhpPath()472 {473 $this474 ->if($test = new emptyTest())475 ->then476 ->object($test->setPhpPath($phpPath = uniqid()))->isIdenticalTo($test)477 ->string($test->getPhpPath())->isIdenticalTo($phpPath)478 ->object($test->setPhpPath($phpPath = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)479 ->string($test->getPhpPath())->isIdenticalTo((string) $phpPath)480 ;481 }482 public function testMethodIsIgnored()483 {484 $this485 ->if($test = new emptyTest())486 ->then487 ->exception(function() use ($test, & $method) { $test->methodIsIgnored($method = uniqid()); })488 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')489 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')490 ;491 }492 public function testSetTags()493 {494 $this495 ->if($test = new emptyTest())496 ->then497 ->object($test->setTags($tags = array(uniqid(), uniqid())))->isIdenticalTo($test)498 ->array($test->getTags())->isEqualTo($tags)499 ;500 }501 public function testSetMethodTags()502 {503 $this504 ->if($test = new notEmptyTest())505 ->then506 ->object($test->setMethodTags('testMethod1', $tags = array(uniqid(), uniqid())))->isIdenticalTo($test)507 ->array($test->getMethodTags('testMethod1'))->isEqualTo($tags)508 ->exception(function() use ($test, & $method) { $test->setMethodTags($method = uniqid(), array()); })509 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')510 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')511 ;512 }513 public function testGetMethodTags()514 {515 $this516 ->if($test = new notemptyTest())517 ->then518 ->array($test->getMethodTags('testMethod1'))->isEqualTo(array('test', 'method', 'one'))519 ->exception(function() use ($test, & $method) { $test->getMethodTags($method = uniqid()); })520 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')521 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')522 ;523 }524 public function testAddMandatoryClassExtension()525 {526 $this527 ->if($test = new notEmptyTest())528 ->then529 ->object($test->addMandatoryClassExtension($extension = uniqid()))->isIdenticalTo($test)530 ->array($test->getMandatoryClassExtensions())->isEqualTo(array($extension))531 ->object($test->addMandatoryClassExtension($otherExtension = uniqid()))->isIdenticalTo($test)532 ->array($test->getMandatoryClassExtensions())->isEqualTo(array($extension, $otherExtension))533 ;534 }535 public function testAddMandatoryMethodExtension()536 {537 $this538 ->if($test = new notEmptyTest())539 ->then540 ->exception(function() use ($test, & $method) { $test->addMandatoryMethodExtension($method = uniqid(), uniqid()); })541 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')542 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')543 ->object($test->addMandatoryMethodExtension('testMethod1', $extension = uniqid()))->isIdenticalTo($test)544 ->array($test->getMandatoryMethodExtensions())->isEqualTo(array('testMethod1' => array($extension), 'testMethod2' => array()))545 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo(array($extension))546 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEmpty()547 ->object($test->addMandatoryMethodExtension('testMethod1', $otherExtension = uniqid()))->isIdenticalTo($test)548 ->array($test->getMandatoryMethodExtensions())->isEqualTo(array('testMethod1' => array($extension, $otherExtension), 'testMethod2' => array()))549 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo(array($extension, $otherExtension))550 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEmpty()551 ->object($test->addMandatoryMethodExtension('testMethod2', $anOtherExtension = uniqid()))->isIdenticalTo($test)552 ->array($test->getMandatoryMethodExtensions())->isEqualTo(array('testMethod1' => array($extension, $otherExtension), 'testMethod2' => array($anOtherExtension)))553 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo(array($extension, $otherExtension))554 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(array($anOtherExtension))555 ->if($test->addMandatoryClassExtension($classExtension = uniqid()))556 ->then557 ->array($test->getMandatoryMethodExtensions())->isEqualTo(array('testMethod1' => array($classExtension, $extension, $otherExtension), 'testMethod2' => array($classExtension, $anOtherExtension)))558 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo(array($classExtension, $extension, $otherExtension))559 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(array($classExtension, $anOtherExtension))560 ;561 }562 public function testAddClassPhpVersion()563 {564 $this565 ->if($test = new notEmptyTest())566 ->then567 ->object($test->addClassPhpVersion('5.3'))->isIdenticalTo($test)568 ->array($test->getClassPhpVersions())->isEqualTo(array('5.3' => '>='))569 ->object($test->addClassPhpVersion('5.4', '<='))->isIdenticalTo($test)570 ->array($test->getClassPhpVersions())->isEqualTo(array('5.3' => '>=', '5.4' => '<='))571 ;572 }573 public function testAddMethodPhpVersion()574 {575 $this576 ->if($test = new notEmptyTest())577 ->then578 ->exception(function() use ($test, & $method) { $test->addMethodPhpVersion($method, '6.0'); })579 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')580 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')581 ->object($test->addMethodPhpVersion('testMethod1', '5.3'))->isIdenticalTo($test)582 ->array($test->getMethodPhpVersions())->isEqualTo(array('testMethod1' => array('5.3' => '>='), 'testMethod2' => array()))583 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(array('5.3' => '>='))584 ->array($test->getMethodPhpVersions('testMethod2'))->isEmpty()585 ->object($test->addMethodPhpVersion('testMethod1', '5.4', '<='))->isIdenticalTo($test)586 ->array($test->getMethodPhpVersions())->isEqualTo(array('testMethod1' => array('5.3' => '>=', '5.4' => '<='), 'testMethod2' => array()))587 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(array('5.3' => '>=', '5.4' => '<='))588 ->array($test->getMethodPhpVersions('testMethod2'))->isEmpty()589 ->object($test->addMethodPhpVersion('testMethod2', '5.4', '>='))->isIdenticalTo($test)590 ->array($test->getMethodPhpVersions())->isEqualTo(array('testMethod1' => array('5.3' => '>=', '5.4' => '<='), 'testMethod2' => array('5.4' => '>=')))591 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(array('5.3' => '>=', '5.4' => '<='))592 ->array($test->getMethodPhpVersions('testMethod2'))->isEqualTo(array('5.4' => '>='))593 ->if($test->addClassPhpVersion('5.5'))594 ->then595 ->array($test->getMethodPhpVersions())->isEqualTo(array('testMethod1' => array('5.5' => '>=', '5.3' => '>=', '5.4' => '<='), 'testMethod2' => array('5.5' => '>=', '5.4' => '>=')))596 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(array('5.5' => '>=', '5.3' => '>=', '5.4' => '<='))597 ->array($test->getMethodPhpVersions('testMethod2'))->isEqualTo(array('5.5' => '>=', '5.4' => '>='))598 ;599 }600 public function testRun()601 {602 $this603 ->mockTestedClass('mock\tests\units')604 ->if($test = new \mock\tests\units\test())605 ->then606 ->object($test->run())->isIdenticalTo($test)607 ->boolean(function_exists(__NAMESPACE__ . '\given'))->isTrue('Function ' . __NAMESPACE__ . '\given() does not exist')608 ->boolean(function_exists(__NAMESPACE__ . '\calling'))->isTrue('Function ' . __NAMESPACE__ . '\calling() does not exist')609 ->boolean(function_exists(__NAMESPACE__ . '\resetMock'))->isTrue('Function ' . __NAMESPACE__ . '\resetMock() does not exist')610 ->boolean(function_exists(__NAMESPACE__ . '\resetAdapter'))->isTrue('Function ' . __NAMESPACE__ . '\resetAdapter() does not exist')611 ->mock($test)612 ->call('callObservers')613 ->withArguments(\mageekguy\atoum\test::runStart)->never()614 ->withArguments(\mageekguy\atoum\test::runStop)->never()615 ->withArguments(\mageekguy\atoum\test::beforeSetUp)->never()616 ->withArguments(\mageekguy\atoum\test::afterSetUp)->never()617 ->withArguments(\mageekguy\atoum\test::beforeTestMethod)->never()618 ->withArguments(\mageekguy\atoum\test::afterTestMethod)->never()619 ;620 }621 public function testSetTestedClassName()622 {623 $this624 ->if($test = new foo())625 ->then626 ->string($test->getTestedClassName())->isEqualTo('mageekguy\atoum\test')627 ->exception(function() use ($test) { $test->setTestedClassName(uniqid()); })628 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')629 ->hasMessage('Tested class name is already defined')630 ->if($test = new self())631 ->then632 ->object($test->setTestedClassName($class = uniqid()))->isIdenticalTo($test)633 ->string($test->getTestedClassName())->isEqualTo($class)634 ->exception(function() use ($test) { $test->setTestedClassName(uniqid()); })635 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')636 ->hasMessage('Tested class name is already defined')637 ;638 }639 public function testMockClass()640 {641 $this642 ->if($test = new emptyTest())643 ->then644 ->object($test->mockClass(__CLASS__))->isIdenticalTo($test)645 ->class('mock\\' . __CLASS__)->isSubClassOf(__CLASS__)646 ->object($test->mockClass(__CLASS__, 'foo'))->isIdenticalTo($test)647 ->class('foo\test')->isSubClassOf(__CLASS__)648 ->object($test->mockClass(__CLASS__, 'foo\bar'))->isIdenticalTo($test)649 ->class('foo\bar\test')->isSubClassOf(__CLASS__)650 ->object($test->mockClass(__CLASS__, 'foo', 'bar'))->isIdenticalTo($test)651 ->class('foo\bar')->isSubClassOf(__CLASS__)652 ;653 }654 public function testMockTestedClass()655 {656 $this657 ->if($test = new emptyTest())658 ->and($testedClassName = $test->getTestedClassName())659 ->then660 ->object($test->mockTestedClass())->isIdenticalTo($test)661 ->class('mock\\' . $testedClassName)->isSubClassOf($testedClassName)662 ->object($test->mockTestedClass('foo'))->isIdenticalTo($test)663 ->class('foo\emptyTest')->isSubClassOf($testedClassName)664 ->object($test->mockTestedClass('foo\bar'))->isIdenticalTo($test)665 ->class('foo\bar\emptyTest')->isSubClassOf($testedClassName)666 ->object($test->mockTestedClass('foo', 'bar'))->isIdenticalTo($test)667 ->class('foo\bar')->isSubClassOf($testedClassName)668 ;669 }670 public function testGetTaggedTestMethods()671 {672 $this673 ->if($test = new emptyTest())674 ->then675 ->array($test->getTaggedTestMethods(array()))->isEmpty()676 ->array($test->getTaggedTestMethods(array(uniqid())))->isEmpty()677 ->array($test->getTaggedTestMethods(array(uniqid(), uniqid())))->isEmpty()678 ->if($test = new notEmptyTest())679 ->then680 ->array($test->getTaggedTestMethods(array()))->isEmpty()681 ->array($test->getTaggedTestMethods(array(uniqid())))->isEmpty()682 ->array($test->getTaggedTestMethods(array(uniqid(), uniqid())))->isEmpty()683 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod1', uniqid())))->isEmpty()684 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod1', uniqid(), 'testMethod2')))->isEmpty()685 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2')))->isEmpty()686 ->if($test->ignore(false))687 ->then688 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod1', uniqid())))->isEqualTo(array('testMethod1'))689 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod2', uniqid())))->isEqualTo(array('testMethod2'))690 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2')))->isEqualTo(array('Testmethod1', 'Testmethod2'))691 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2'), array('one')))->isEqualTo(array('Testmethod1'))692 ->if($test->ignoreMethod('testMethod1', true))693 ->then694 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod1', uniqid())))->isEmpty()695 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod2', uniqid())))->isEqualTo(array('testMethod2'))696 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2')))->isEqualTo(array('Testmethod2'))697 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2'), array('one')))->isEmpty()698 ;699 }700 public function testSetDataProvider()701 {702 $this703 ->if($test = new emptyTest())704 ->then705 ->exception(function() use ($test, & $method) { $test->setDataProvider($method = uniqid(), uniqid()); })706 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')707 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')708 ->if($test = new notEmptyTest())709 ->then710 ->exception(function() use ($test, & $dataProvider) { $test->setDataProvider('testMethod1', $dataProvider = uniqid()); })711 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')712 ->hasMessage('Data provider ' . get_class($test) . '::' . $dataProvider . '() is unknown')713 ->object($test->setDataProvider('testMethod1', 'aDataProvider'))->isIdenticalTo($test)714 ->array($test->getDataProviders())->isEqualTo(array('testMethod1' => 'aDataProvider'))715 ;716 }717 public function testCalling()718 {719 $this720 ->if($test = new emptyTest())721 ->and($mock = new \mock\foo())722 ->and($test->calling($mock)->bar = $value = uniqid())723 ->then724 ->string($mock->bar())->isEqualTo($value)725 ->and($test->Æ($mock)->bar = $otherValue = uniqid())726 ->then727 ->string($mock->bar())->isEqualTo($otherValue)728 ;...
testMethod1
Using AI Code Generation
1$test = new emptyTest();2$test->testMethod1();3$test = new emptyTest();4$test->testMethod2();5$test = new emptyTest();6$test->testMethod3();7$test = new emptyTest();8$test->testMethod4();9$test = new emptyTest();10$test->testMethod5();11$test = new emptyTest();12$test->testMethod6();13$test = new emptyTest();14$test->testMethod7();15$test = new emptyTest();16$test->testMethod8();17$test = new emptyTest();18$test->testMethod9();19$test = new emptyTest();20$test->testMethod10();21$test = new emptyTest();22$test->testMethod11();23$test = new emptyTest();24$test->testMethod12();25$test = new emptyTest();26$test->testMethod13();27$test = new emptyTest();28$test->testMethod14();29$test = new emptyTest();30$test->testMethod15();
testMethod1
Using AI Code Generation
1$emptyTest = new emptyTest();2$emptyTest->testMethod1();3$emptyTest = new emptyTest();4$emptyTest->testMethod2();5$emptyTest = new emptyTest();6$emptyTest->testMethod1();7include_once '1.php';8$emptyTest = new emptyTest();9$emptyTest->testMethod2();
testMethod1
Using AI Code Generation
1$testObj = new emptyTest();2$testObj->testMethod1();3$testObj = new emptyTest();4$testObj->testMethod2();5Related Posts: PHP __autoload() Function6PHP __clone() Function7PHP __get() Function8PHP __set() Function9PHP __isset() Function10PHP __unset() Function11PHP __call() Function12PHP __callStatic() Function13PHP __get() Function14PHP __set() Function15PHP __isset() Function16PHP __unset() Function17PHP __toString() Function18PHP __invoke() Function19PHP __set_state() Function20PHP __clone() Function21PHP __wakeup() Function22PHP __sleep() Function23PHP __debugInfo() Function24PHP __destruct() Function25PHP __autoload() Function26PHP __call() Function27PHP __callStatic() Function28PHP __invoke() Function29PHP __set_state() Function30PHP __wakeup() Function31PHP __sleep() Function32PHP __debugInfo() Function33PHP __destruct() Function34PHP __toString() Function35PHP __autoload() Function36PHP __call() Function37PHP __callStatic() Function38PHP __invoke() Function39PHP __set_state() Function40PHP __wakeup() Function41PHP __sleep() Function42PHP __debugInfo() Function43PHP __destruct() Function44PHP __toString() Function45PHP __autoload() Function46PHP __call() Function47PHP __callStatic() Function48PHP __invoke() Function49PHP __set_state() Function50PHP __wakeup() Function51PHP __sleep() Function52PHP __debugInfo() Function53PHP __destruct() Function54PHP __toString() Function55PHP __autoload() Function56PHP __call() Function57PHP __callStatic() Function58PHP __invoke() Function59PHP __set_state() Function60PHP __wakeup() Function61PHP __sleep() Function62PHP __debugInfo() Function63PHP __destruct() Function64PHP __toString() Function65PHP __autoload() Function66PHP __call() Function67PHP __callStatic() Function68PHP __invoke() Function69PHP __set_state() Function70PHP __wakeup() Function71PHP __sleep() Function
testMethod1
Using AI Code Generation
1require_once("emptyTest.php");2$test = new emptyTest();3$test->testMethod1();4require_once("emptyTest.php");5$test = new emptyTest();6$test->testMethod2();7require_once("emptyTest.php");8$test = new emptyTest();9$test->testMethod3();10require_once("emptyTest.php");11$test = new emptyTest();12$test->testMethod4();13require_once("emptyTest.php");14$test = new emptyTest();15$test->testMethod5();16require_once("emptyTest.php");17$test = new emptyTest();18$test->testMethod6();19require_once("emptyTest.php");20$test = new emptyTest();21$test->testMethod7();22require_once("emptyTest.php");23$test = new emptyTest();24$test->testMethod8();25require_once("emptyTest.php");26$test = new emptyTest();27$test->testMethod9();28require_once("emptyTest.php");29$test = new emptyTest();30$test->testMethod10();31require_once("emptyTest.php");32$test = new emptyTest();33$test->testMethod11();34require_once("emptyTest.php");35$test = new emptyTest();36$test->testMethod12();37require_once("emptyTest.php
testMethod1
Using AI Code Generation
1require_once("emptyTest.php");2$obj = new emptyTest();3$obj->testMethod1();4require_once("emptyTest.php");5$obj = new emptyTest();6$obj->testMethod2();7require_once("emptyTest.php");8$obj = new emptyTest();9$obj->testMethod1();
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with testMethod1 on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!