How to use emptyTest class

Best Atoum code snippet using emptyTest

test.php

Source:test.php Github

copy

Full Screen

1<?php2namespace mageekguy\atoum3{4 class emptyTest {}5 class notEmptyTest {}6}7namespace mageekguy\atoum\mock\mageekguy\atoum8{9 class test {}10}11namespace mageekguy\atoum\tests\units12{13 use14 mageekguy\atoum,15 mageekguy\atoum\mock16 ;17 require_once __DIR__ . '/../runner.php';18 /**19 @ignore on20 @tags empty fake dummy21 @maxChildrenNumber 66622 */23 class emptyTest extends atoum\test {}24 /**25 @ignore on26 */27 class notEmptyTest extends atoum\test28 {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 ;729 }730 public function testResetMock()731 {732 $this733 ->if($test = new emptyTest())734 ->and($mock = new \mock\foo())735 ->then736 ->object($test->resetMock($mock))->isIdenticalTo($mock->getMockController())737 ->array($mock->getMockController()->getCalls())->isEmpty()738 ->if($mock->bar())739 ->then740 ->object($test->resetMock($mock))->isIdenticalTo($mock->getMockController())741 ->array($mock->getMockController()->getCalls())->isEmpty()742 ;743 }744 public function testResetAdapter()745 {746 $this747 ->if($test = new emptyTest())748 ->and($adapter = new atoum\test\adapter())749 ->then750 ->object($test->resetAdapter($adapter))->isIdenticalTo($adapter)751 ->array($adapter->getCalls())->isEmpty()752 ->if($adapter->md5(uniqid()))753 ->then754 ->object($test->resetAdapter($adapter))->isIdenticalTo($adapter)755 ->array($adapter->getCalls())->isEmpty()756 ;757 }758 }759}...

Full Screen

Full Screen

test-class-without-test-methods.phpt

Source:test-class-without-test-methods.phpt Github

copy

Full Screen

1--TEST--2The right events are emitted in the right order for a test class that has no test methods3--SKIPIF--4<?php declare(strict_types=1);5if (DIRECTORY_SEPARATOR === '\\') {6 print "skip: this test does not work on Windows / GitHub Actions\n";7}8--FILE--9<?php declare(strict_types=1);10$traceFile = tempnam(sys_get_temp_dir(), __FILE__);11$_SERVER['argv'][] = '--do-not-cache-result';12$_SERVER['argv'][] = '--no-configuration';13$_SERVER['argv'][] = '--no-output';14$_SERVER['argv'][] = '--log-events-text';15$_SERVER['argv'][] = $traceFile;16$_SERVER['argv'][] = __DIR__ . '/_files/EmptyTest.php';17require __DIR__ . '/../../bootstrap.php';18PHPUnit\TextUI\Application::main(false);19print file_get_contents($traceFile);20unlink($traceFile);21--EXPECTF--22Test Runner Started (PHPUnit %s using %s)23Test Runner Configured24Test Runner Triggered Warning (No tests found in class "PHPUnit\TestFixture\Event\EmptyTest".)25Test Suite Loaded (1 test)26Test Suite Sorted27Event Facade Sealed28Test Runner Execution Started (1 test)29Test Suite Started (PHPUnit\TestFixture\Event\EmptyTest, 1 test)30Test Preparation Started (PHPUnit\TestFixture\Event\EmptyTest::)31Test Prepared (PHPUnit\TestFixture\Event\EmptyTest::)32Test Passed With Warning (PHPUnit\TestFixture\Event\EmptyTest::)33No tests found in class "PHPUnit\TestFixture\Event\EmptyTest".34Test Finished (PHPUnit\TestFixture\Event\EmptyTest::)35Test Suite Finished (PHPUnit\TestFixture\Event\EmptyTest, 1 test)36Test Runner Execution Finished37Test Runner Finished...

Full Screen

Full Screen

html.class.php

Source:html.class.php Github

copy

Full Screen

...23 }24 protected function processValue($value)25 {26 if (stripos($value, 'img') === false) {27 $emptyTest = strip_tags($value);28 $emptyTest = html_entity_decode($emptyTest, ENT_QUOTES, 'UTF-8');29 $emptyTest = trim($emptyTest, chr(0xC2) . chr(0xA0));30 $emptyTest = preg_replace("#\s#is", "", $emptyTest);31 if ($emptyTest == '') {32 $value = '';33 }34 }35 $value = str_ireplace("&nbsp;", "&#160;", $value);36 $value = str_ireplace("\n", "", $value);37 $value = str_ireplace("\r", "", $value);38 return $value;39 }40}...

Full Screen

Full Screen

emptyTest

Using AI Code Generation

copy

Full Screen

1use emptyTest;2use emptyTest;3use emptyTest;4use emptyTest;5use emptyTest;6use emptyTest;7use emptyTest;8use emptyTest;9use emptyTest;10use emptyTest;11use emptyTest;12use emptyTest;13use emptyTest;14use emptyTest;15use emptyTest;16use emptyTest;17use emptyTest;18use emptyTest;19use emptyTest;20use emptyTest;21use emptyTest;22use emptyTest;23use emptyTest;24use emptyTest;25use emptyTest;26use emptyTest;

Full Screen

Full Screen

emptyTest

Using AI Code Generation

copy

Full Screen

1$test = new \mageekguy\atoum\tests\units\emptyTest();2$test->test1();3$test->test2();4$test->test3();5$test = new \mageekguy\atoum\tests\units\emptyTest();6$test->test1();7$test->test2();8$test->test3();9$test = new \mageekguy\atoum\tests\units\emptyTest();10$test->test1();11$test->test2();12$test->test3();13$test = new \mageekguy\atoum\tests\units\emptyTest();14$test->test1();15$test->test2();16$test->test3();17$test = new \mageekguy\atoum\tests\units\emptyTest();18$test->test1();19$test->test2();20$test->test3();21$test = new \mageekguy\atoum\tests\units\emptyTest();22$test->test1();23$test->test2();24$test->test3();25$test = new \mageekguy\atoum\tests\units\emptyTest();26$test->test1();27$test->test2();28$test->test3();29$test = new \mageekguy\atoum\tests\units\emptyTest();30$test->test1();31$test->test2();32$test->test3();33$test = new \mageekguy\atoum\tests\units\emptyTest();34$test->test1();35$test->test2();

Full Screen

Full Screen

emptyTest

Using AI Code Generation

copy

Full Screen

1require_once __DIR__.'/vendor/autoload.php';2use \mageekguy\atoum;3{4 public function testEmpty()5 {6 ->if($test = '')7 ->string($test)->isEmpty();8 }9}10require_once __DIR__.'/vendor/autoload.php';11use \mageekguy\atoum;12{13 public function testEmpty()14 {15 ->if($test = 'a')16 ->string($test)->isEmpty();17 }18}19mageekguy\atoum\exceptions\runtime\logic(0) : eval()'d code:420mageekguy\atoum\exceptions\runtime\logic(0) : eval()'d code:421require_once __DIR__.'/vendor/autoload.php';22use \mageekguy\atoum;23{24 public function testEmpty()25 {26 ->if($test = '')27 ->string($test)->isEmpty();28 }29}30mageekguy\atoum\exceptions\runtime\logic(0) : eval()'d code:4

Full Screen

Full Screen

emptyTest

Using AI Code Generation

copy

Full Screen

1$test = new \mageekguy\atoum\tests\units\emptyTest();2$test->testIsTrue();3$test->testIsFalse();4$test = new \mageekguy\atoum\tests\units\emptyTest();5$test->testIsTrue();6$test->testIsFalse();7$test = new \mageekguy\atoum\tests\units\emptyTest();8$test->testIsTrue();9$test->testIsFalse();10$test = new \mageekguy\atoum\tests\units\emptyTest();11$test->testIsTrue();12$test->testIsFalse();13$test = new \mageekguy\atoum\tests\units\emptyTest();14$test->testIsTrue();15$test->testIsFalse();16$test = new \mageekguy\atoum\tests\units\emptyTest();17$test->testIsTrue();18$test->testIsFalse();19$test = new \mageekguy\atoum\tests\units\emptyTest();20$test->testIsTrue();21$test->testIsFalse();22$test = new \mageekguy\atoum\tests\units\emptyTest();23$test->testIsTrue();24$test->testIsFalse();25$test = new \mageekguy\atoum\tests\units\emptyTest();26$test->testIsTrue();27$test->testIsFalse();

Full Screen

Full Screen

emptyTest

Using AI Code Generation

copy

Full Screen

1$test = new emptyTest();2$test->testIt();3$test = new emptyTest();4$test->testIt();5$test = new emptyTest();6$test->testIt();7$test = new emptyTest();8$test->testIt();9$test = new emptyTest();10$test->testIt();11$test = new emptyTest();12$test->testIt();13$test = new emptyTest();14$test->testIt();15$test = new emptyTest();16$test->testIt();17$test = new emptyTest();18$test->testIt();19$test = new emptyTest();20$test->testIt();21$test = new emptyTest();22$test->testIt();23$test = new emptyTest();24$test->testIt();25$test = new emptyTest();26$test->testIt();27$test = new emptyTest();28$test->testIt();29$test = new emptyTest();30$test->testIt();31$test = new emptyTest();32$test->testIt();33$test = new emptyTest();34$test->testIt();35$test = new emptyTest();36$test->testIt();37$test = new emptyTest();38$test->testIt();39$test = new emptyTest();40$test->testIt();41$test = new emptyTest();42$test->testIt();

Full Screen

Full Screen

emptyTest

Using AI Code Generation

copy

Full Screen

1require_once 'emptyTest.php';2use \mageekguy\atoum;3use \mageekguy\atoum\report\fields\runner;4use \mageekguy\atoum\report\fields\test;5use \mageekguy\atoum\report\fields\runner\failures;6use \mageekguy\atoum\report\fields\runner\outputs;7use \mageekguy\atoum\report\fields\runner\errors;8use \mageekguy\atoum\report\fields\runner\exceptions;9use \mageekguy\atoum\report\fields\runner\tests\void;10use \mageekguy\atoum\report\fields\runner\tests\uncompleted;11use \mageekguy\atoum\report\fields\runner\tests\skipped;12use \mageekguy\atoum\report\fields\runner\tests\outputs;13use \mageekguy\atoum\report\fields\runner\tests\errors;14use \mageekguy\atoum\report\fields\runner\tests\exceptions;15use \mageekguy\atoum\report\fields\runner\tests\failures;16use \mageekguy\atoum\report\fields\runner\tests\run\duration;17use \mageekguy\atoum\report\fields\runner\tests\run\memory;18use \mageekguy\atoum\report\fields\runner\tests\coverage;19use \mageekguy\atoum\report\fields\runner\tests\coverage\html;20use \mageekguy\atoum\report\fields\runner\tests\coverage\clover;21use \mageekguy\atoum\report\fields\runner\tests\coverage\php;22use \mageekguy\atoum\report\fields\runner\tests\coverage\text;23use \mageekguy\atoum\report\fields\runner\tests\coverage\xml;

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.

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

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