Best Atoum code snippet using osRestricted
test.php
Source:test.php
...23 public function __construct($firstArgument, $secondArgument)24 {25 }26 }27 class osRestricted28 {29 }30}31namespace atoum\atoum\mock\atoum\atoum32{33 class test34 {35 }36}37namespace atoum\atoum\tests\units38{39 use atoum\atoum;40 use atoum\atoum\mock;41 require_once __DIR__ . '/../runner.php';42 /**43 * @ignore on44 * @tags empty fake dummy45 * @maxChildrenNumber 66646 */47 class emptyTest extends atoum\test48 {49 }50 /**51 * @ignore on52 */53 class notEmptyTest extends atoum\test54 {55 /**56 @tags test method one method57 */58 public function testMethod1()59 {60 }61 /**62 * @extensions mbstring socket63 * @ignore off64 * @tags test method two65 */66 public function testMethod2()67 {68 }69 public function aDataProvider()70 {71 }72 }73 /**74 * @ignore on75 * @tags first76 */77 class inheritedTagsTest extends atoum\test78 {79 /**80 * @tags second third81 */82 public function testMethod1()83 {84 }85 /**86 * @tags first second third87 */88 public function testMethod2()89 {90 }91 }92 /**93 * @ignore on94 */95 class dataProviderTest extends atoum\test96 {97 public function testMethod1(\stdClass $a)98 {99 }100 public function testMethod2(\SplFileInfo $a)101 {102 }103 public function testMethod3($a)104 {105 }106 }107 class foo extends atoum\test108 {109 public function __construct()110 {111 $this->setTestedClassName('atoum\atoum\test');112 parent::__construct();113 }114 }115 /**116 * @ignore on117 */118 class withStatic extends atoum\test119 {120 public function __construct()121 {122 $this->setTestedClassName('atoum\atoum\withStatic');123 parent::__construct();124 }125 }126 /**127 * @ignore on128 * @os Foo129 */130 class osRestricted extends atoum\test131 {132 public function testMethod1()133 {134 }135 /**136 * @os bar137 */138 public function testMethod2()139 {140 }141 /**142 * @os !foo143 */144 public function testMethod3()145 {146 }147 }148 class test extends atoum\test149 {150 public function testClassConstants()151 {152 $this153 ->string(atoum\test::testMethodPrefix)->isEqualTo('test')154 ->string(atoum\test::runStart)->isEqualTo('testRunStart')155 ->string(atoum\test::beforeSetUp)->isEqualTo('beforeTestSetUp')156 ->string(atoum\test::afterSetUp)->isEqualTo('afterTestSetUp')157 ->string(atoum\test::beforeTestMethod)->isEqualTo('beforeTestMethod')158 ->string(atoum\test::fail)->isEqualTo('testAssertionFail')159 ->string(atoum\test::error)->isEqualTo('testError')160 ->string(atoum\test::uncompleted)->isEqualTo('testUncompleted')161 ->string(atoum\test::skipped)->isEqualTo('testSkipped')162 ->string(atoum\test::exception)->isEqualTo('testException')163 ->string(atoum\test::success)->isEqualTo('testAssertionSuccess')164 ->string(atoum\test::afterTestMethod)->isEqualTo('afterTestMethod')165 ->string(atoum\test::beforeTearDown)->isEqualTo('beforeTestTearDown')166 ->string(atoum\test::afterTearDown)->isEqualTo('afterTestTearDown')167 ->string(atoum\test::runStop)->isEqualTo('testRunStop')168 ->string(atoum\test::defaultNamespace)->isEqualTo('#(?:^|\\\\)tests?\\\\units?\\\\#i')169 ->string(atoum\test::defaultMethodPrefix)->isEqualTo('#^(?:test|_*[^_]+_should_)#i')170 ;171 }172 public function test__construct()173 {174 $this175 ->if($test = new emptyTest())176 ->then177 ->object($test->getScore())->isInstanceOf(atoum\score::class)178 ->object($test->getLocale())->isEqualTo(new atoum\locale())179 ->object($test->getAdapter())->isEqualTo(new atoum\adapter())180 ->object($test->getPhpFunctionMocker())->isInstanceOf(atoum\php\mocker\funktion::class)181 ->object($test->getPhpConstantMocker())->isInstanceOf(atoum\php\mocker\constant::class)182 ->object($test->getFactoryBuilder())->isInstanceOf(atoum\factory\builder\closure::class)183 ->boolean($test->isIgnored())->isTrue()184 ->boolean($test->debugModeIsEnabled())->isFalse()185 ->array($test->getAllTags())->isEqualTo($tags = ['empty', 'fake', 'dummy'])186 ->array($test->getTags())->isEqualTo($tags)187 ->array($test->getMethodTags())->isEmpty()188 ->array($test->getDataProviders())->isEmpty()189 ->integer($test->getMaxChildrenNumber())->isEqualTo(666)190 ->boolean($test->codeCoverageIsEnabled())->isEqualTo(extension_loaded('xdebug'))191 ->string($test->getTestNamespace())->isEqualTo(atoum\test::defaultNamespace)192 ->integer($test->getMaxChildrenNumber())->isEqualTo(666)193 ->variable($test->getBootstrapFile())->isNull()194 ->array($test->getClassPhpVersions())->isEmpty()195 ->array($test->getMandatoryClassExtensions())->isEmpty()196 ->array($test->getMandatoryMethodExtensions())->isEmpty()197 ->variable($test->getXdebugConfig())->isNull()198 ;199 }200 public function test__toString()201 {202 $this->castToString($this)->isEqualTo(__CLASS__);203 }204 public function test__get()205 {206 $this207 ->if($test = new emptyTest())208 ->then209 ->object($test->assert)->isInstanceOf(atoum\test::class)210 ->object($test->define)->isInstanceOf(atoum\test\assertion\aliaser::class)211 ->object($test->mockGenerator)->isInstanceOf(atoum\mock\generator::class)212 ->if($test->setMockGenerator($mockGenerator = new atoum\test\mock\generator($this)))213 ->then214 ->object($test->mockGenerator)->isIdenticalTo($mockGenerator)215 ->if($test->setAsserterGenerator($asserterGenerator = new atoum\test\asserter\generator(new emptyTest())))216 ->then217 ->object($test->assert)->isIdenticalTo($test)218 ->variable($test->exception)->isNull()219 ->exception(function () use ($test, & $property) {220 $test->{$property = uniqid()};221 })222 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)223 ->hasMessage('Asserter \'' . $property . '\' does not exist')224 ->exception($test->exception)225 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)226 ->hasMessage('Asserter \'' . $property . '\' does not exist')227 ;228 }229 public function test__set()230 {231 $this232 ->given(233 $test = new emptyTest(),234 $test->setAssertionManager($assertionManager = new \mock\atoum\atoum\test\assertion\manager())235 )236 ->if($test->{$event = uniqid()} = $handler = function () {237 })238 ->then239 ->mock($assertionManager)->call('setHandler')->withArguments($event, $handler)->once()240 ;241 }242 public function testEnableDebugMode()243 {244 $this245 ->if($test = new emptyTest())246 ->then247 ->object($test->enableDebugMode())->isIdenticalTo($test)248 ->boolean($test->debugModeIsEnabled())->isTrue()249 ->object($test->enableDebugMode())->isIdenticalTo($test)250 ->boolean($test->debugModeIsEnabled())->isTrue()251 ;252 }253 public function testDisableDebugMode()254 {255 $this256 ->if($test = new emptyTest())257 ->then258 ->object($test->disableDebugMode())->isIdenticalTo($test)259 ->boolean($test->debugModeIsEnabled())->isFalse()260 ->object($test->disableDebugMode())->isIdenticalTo($test)261 ->boolean($test->debugModeIsEnabled())->isFalse()262 ->if($test->enableDebugMode())263 ->then264 ->object($test->disableDebugMode())->isIdenticalTo($test)265 ->boolean($test->debugModeIsEnabled())->isFalse()266 ;267 }268 public function testEnableCodeCoverage()269 {270 $this271 ->assert('Code coverage must be enabled only if xdebug is available')272 ->if($adapter = new atoum\test\adapter())273 ->and($adapter->extension_loaded = function ($extension) {274 return $extension == 'xdebug';275 })276 ->and($test = new emptyTest($adapter))277 ->then278 ->boolean($test->codeCoverageIsEnabled())->isTrue()279 ->object($test->enableCodeCoverage())->isIdenticalTo($test)280 ->boolean($test->codeCoverageIsEnabled())->isTrue()281 ->if($test->disableCodeCoverage())282 ->then283 ->boolean($test->codeCoverageIsEnabled())->isFalse()284 ->object($test->enableCodeCoverage())->isIdenticalTo($test)285 ->boolean($test->codeCoverageIsEnabled())->isTrue()286 ->assert('Code coverage must not be enabled if xdebug is not available')287 ->if($adapter->extension_loaded = function ($extension) {288 return $extension != 'xdebug';289 })290 ->and($test = new emptyTest($adapter))291 ->then292 ->boolean($test->codeCoverageIsEnabled())->isFalse()293 ->object($test->enableCodeCoverage())->isIdenticalTo($test)294 ->boolean($test->codeCoverageIsEnabled())->isFalse()295 ;296 }297 public function testDisableCodeCoverage()298 {299 $this300 ->if($adapter = new atoum\test\adapter())301 ->and($adapter->extension_loaded = true)302 ->and($test = new emptyTest($adapter))303 ->then304 ->boolean($test->codeCoverageIsEnabled())->isTrue()305 ->object($test->disableCodeCoverage())->isIdenticalTo($test)306 ->boolean($test->codeCoverageIsEnabled())->isFalse()307 ->if($test->enableCodeCoverage())308 ->then309 ->boolean($test->codeCoverageIsEnabled())->isTrue()310 ->object($test->disableCodeCoverage())->isIdenticalTo($test)311 ->boolean($test->codeCoverageIsEnabled())->isFalse()312 ;313 }314 public function testGetMockGenerator()315 {316 $this317 ->if($test = new emptyTest())318 ->then319 ->object($test->getMockGenerator())->isInstanceOf(atoum\mock\generator::class)320 ->if($test->setMockGenerator($mockGenerator = new atoum\test\mock\generator($this)))321 ->then322 ->object($test->getMockGenerator())->isIdenticalTo($mockGenerator)323 ->object($mockGenerator->getTest())->isIdenticalTo($test)324 ;325 }326 public function testSetMockGenerator()327 {328 $this329 ->if($test = new emptyTest())330 ->then331 ->object($test->setMockGenerator($mockGenerator = new atoum\test\mock\generator($this)))->isIdenticalTo($test)332 ->object($test->getMockGenerator())->isIdenticalTo($mockGenerator)333 ->object($mockGenerator->getTest())->isIdenticalTo($test)334 ;335 }336 public function testSetMockAutoloader()337 {338 $this339 ->if($test = new emptyTest())340 ->then341 ->object($test->setMockAutoloader($mockAutoloader = new atoum\autoloader\mock()))->isIdenticalTo($test)342 ->object($test->getMockAutoloader())->isIdenticalTo($mockAutoloader)343 ;344 }345 public function testGetAsserterGenerator()346 {347 $this348 ->if($test = new emptyTest())349 ->then350 ->object($test->getAsserterGenerator())->isInstanceOf(atoum\test\asserter\generator::class)351 ->if($test->setAsserterGenerator($asserterGenerator = new atoum\test\asserter\generator($this)))352 ->then353 ->object($test->getAsserterGenerator())->isIdenticalTo($asserterGenerator)354 ->object($asserterGenerator->getTest())->isIdenticalTo($test)355 ;356 }357 public function testSetAsserterGenerator()358 {359 $this360 ->if($test = new emptyTest())361 ->then362 ->object($test->setAsserterGenerator($asserterGenerator = new atoum\test\asserter\generator($test)))->isIdenticalTo($test)363 ->object($test->getAsserterGenerator())->isIdenticalTo($asserterGenerator)364 ->object($asserterGenerator->getTest())->isIdenticalTo($test)365 ->object($asserterGenerator->getLocale())->isIdenticalTo($test->getLocale())366 ;367 }368 public function testGetFactoryBuilder()369 {370 $this371 ->if($test = new emptyTest())372 ->then373 ->object($test->getFactoryBuilder())->isInstanceOf(atoum\factory\builder\closure::class)374 ->if($test->setFactoryBuilder($factoryBuilder = new \mock\atoum\atoum\factory\builder()))375 ->then376 ->object($test->getFactoryBuilder())->isIdenticalTo($factoryBuilder)377 ;378 }379 public function testSetFactoryBuilder()380 {381 $this382 ->if($test = new emptyTest())383 ->then384 ->object($test->setFactoryBuilder($factoryBuilder = new \mock\atoum\atoum\factory\builder()))->isIdenticalTo($test)385 ->object($test->getFactoryBuilder())->isIdenticalTo($factoryBuilder)386 ->object($test->setFactoryBuilder())->isIdenticalTo($test)387 ->object($test->getFactoryBuilder())388 ->isEqualTo(new atoum\Factory\builder\closure())389 ->isNotIdenticalTo($factoryBuilder)390 ;391 }392 public function testSetPhpFunktionMocker()393 {394 $this395 ->if($test = new emptyTest())396 ->then397 ->object($test->setPhpFunctionMocker($phpFunctionMocker = new atoum\php\mocker\funktion()))->isIdenticalTo($test)398 ->object($test->getPhpFunctionMocker())->isIdenticalTo($phpFunctionMocker)399 ->object($test->setPhpFunctionMocker())->isIdenticalTo($test)400 ->object($test->getPhpFunctionMocker())401 ->isNotIdenticalTo($phpFunctionMocker)402 ->isInstanceOf(atoum\php\mocker\funktion::class)403 ;404 }405 public function testSetTestNamespace()406 {407 $this408 ->if($test = new self())409 ->then410 ->object($test->setTestNamespace($testNamespace = uniqid('_')))->isIdenticalTo($test)411 ->string($test->getTestNamespace())->isEqualTo($testNamespace)412 ->object($test->setTestNamespace('\\' . $testNamespace))->isIdenticalTo($test)413 ->string($test->getTestNamespace())->isEqualTo($testNamespace)414 ->object($test->setTestNamespace($testNamespace . '\\'))->isIdenticalTo($test)415 ->string($test->getTestNamespace())->isEqualTo($testNamespace)416 ->object($test->setTestNamespace('\\' . $testNamespace . '\\'))->isIdenticalTo($test)417 ->string($test->getTestNamespace())->isEqualTo($testNamespace)418 ->object($test->setTestNamespace($testNamespace = uniqid('_') . '\\' . $testNamespace))->isIdenticalTo($test)419 ->string($test->getTestNamespace())->isEqualTo($testNamespace)420 ->object($test->setTestNamespace('\\' . $testNamespace))->isIdenticalTo($test)421 ->string($test->getTestNamespace())->isEqualTo($testNamespace)422 ->object($test->setTestNamespace($testNamespace . '\\'))->isIdenticalTo($test)423 ->string($test->getTestNamespace())->isEqualTo($testNamespace)424 ->object($test->setTestNamespace('\\' . $testNamespace . '\\'))->isIdenticalTo($test)425 ->string($test->getTestNamespace())->isEqualTo($testNamespace)426 ->object($test->setTestNamespace($testNamespace = '_' . rand(0, PHP_INT_MAX)))->isIdenticalTo($test)427 ->string($test->getTestNamespace())->isEqualTo((string) $testNamespace)428 ->object($test->setTestNamespace('\\' . $testNamespace))->isIdenticalTo($test)429 ->string($test->getTestNamespace())->isEqualTo($testNamespace)430 ->object($test->setTestNamespace($testNamespace . '\\'))->isIdenticalTo($test)431 ->string($test->getTestNamespace())->isEqualTo($testNamespace)432 ->object($test->setTestNamespace('\\' . $testNamespace . '\\'))->isIdenticalTo($test)433 ->string($test->getTestNamespace())->isEqualTo($testNamespace)434 ->exception(function () use ($test) {435 $test->setTestNamespace('');436 })437 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)438 ->hasMessage('Test namespace must not be empty')439 ->exception(function () use ($test) {440 $test->setTestNamespace('0');441 })442 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)443 ->hasMessage('Test namespace must be a valid regex or identifier')444 ->exception(function () use ($test) {445 $test->setTestNamespace(uniqid('_') . '\\\\' . uniqid('_'));446 })447 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)448 ->hasMessage('Test namespace must be a valid regex or identifier')449 ;450 }451 public function testGetTestNamespace()452 {453 $this454 ->if($test = new self())455 ->then456 ->string($test->getTestNamespace())->isEqualTo(atoum\test::defaultNamespace)457 ->if($test->setTestNamespace($testNamespace = uniqid('_')))458 ->then459 ->string($test->getTestNamespace())->isEqualTo($testNamespace)460 ;461 }462 public function testSetTestMethodPrefix()463 {464 $this465 ->if($test = new self())466 ->then467 ->object($test->setTestMethodPrefix($testMethodPrefix = uniqid('_')))->isIdenticalTo($test)468 ->string($test->getTestMethodPrefix())->isEqualTo($testMethodPrefix)469 ->object($test->setTestMethodPrefix($testMethodPrefix = '/^test/i'))->isIdenticalTo($test)470 ->string($test->getTestMethodPrefix())->isEqualTo($testMethodPrefix)471 ->object($test->setTestMethodPrefix($testMethodPrefix = ('_' . rand(0, PHP_INT_MAX))))->isIdenticalTo($test)472 ->string($test->getTestMethodPrefix())->isEqualTo((string) $testMethodPrefix)473 ->object($test->setTestMethodPrefix($testMethodPrefix = "_0"))->isIdenticalTo($test)474 ->string($test->getTestMethodPrefix())->isEqualTo((string) $testMethodPrefix)475 ->exception(function () use ($test) {476 $test->setTestMethodPrefix('');477 })478 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)479 ->hasMessage('Test method prefix must not be empty')480 ->exception(function () use ($test) {481 $test->setTestMethodPrefix('0');482 })483 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)484 ->hasMessage('Test method prefix must a valid regex or identifier')485 ->exception(function () use ($test) {486 $test->setTestMethodPrefix('/:(/');487 })488 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)489 ->hasMessage('Test method prefix must a valid regex or identifier')490 ;491 }492 public function testGetTestMethodPrefix()493 {494 $this495 ->if($test = new self())496 ->then497 ->string($test->getTestMethodPrefix())->isEqualTo(atoum\test::defaultMethodPrefix)498 ->if($test->setTestMethodPrefix($testMethodPrefix = uniqid('_')))499 ->then500 ->string($test->getTestMethodPrefix())->isEqualTo($testMethodPrefix)501 ;502 }503 public function testGetTestedClassName()504 {505 $mockClass = '\mock\\' . __CLASS__;506 $this507 ->if($test = new $mockClass())508 ->and($test->getMockController()->getClass = $testClass = 'foo')509 ->then510 ->exception(function () use ($test) {511 $test->getTestedClassName();512 })513 ->isInstanceOf(atoum\exceptions\runtime::class)514 ->hasMessage('Test class \'' . $testClass . '\' is not in a namespace which matches pattern \'' . $test->getTestNamespace() . '\'')515 ->if($test->getMockController()->getClass = 'tests\units\foo')516 ->then517 ->string($test->getTestedClassName())->isEqualTo('foo')518 ;519 }520 public function testGetTestedClassPath()521 {522 $this523 ->if($testedClass = new \reflectionClass($this->getTestedClassName()))524 ->then525 ->string($this->getTestedClassPath())->isEqualTo($testedClass->getFilename())526 ;527 }528 public function testGetAdapter()529 {530 $this531 ->if($test = new emptyTest())532 ->then533 ->object($test->getAdapter())->isInstanceOf(atoum\adapter::class)534 ;535 }536 public function testSetAdapter()537 {538 $this539 ->if($test = new emptyTest())540 ->then541 ->object($test->setAdapter($adapter = new atoum\test\adapter()))->isIdenticalTo($test)542 ->object($test->getAdapter())->isIdenticalTo($adapter)543 ;544 }545 public function testSetLocale()546 {547 $this548 ->if($test = new emptyTest())549 ->then550 ->object($test->setLocale($locale = new atoum\locale()))->isIdenticalTo($test)551 ->object($test->getLocale())->isIdenticalTo($locale)552 ;553 }554 public function testSetScore()555 {556 $this557 ->if($test = new emptyTest())558 ->then559 ->object($test->setScore($score = new atoum\test\score()))->isIdenticalTo($test)560 ->object($test->getScore())->isIdenticalTo($score)561 ;562 }563 public function testSetBootstrapFile()564 {565 $this566 ->if($test = new emptyTest())567 ->then568 ->object($test->setBootstrapFile($path = uniqid()))->isIdenticalTo($test)569 ->string($test->getBootstrapFile())->isEqualTo($path)570 ;571 }572 public function testSetMaxChildrenNumber()573 {574 $this575 ->if($test = new emptyTest())576 ->then577 ->exception(function () use ($test) {578 $test->setMaxChildrenNumber(- rand(1, PHP_INT_MAX));579 })580 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)581 ->hasMessage('Maximum number of children must be greater or equal to 1')582 ->exception(function () use ($test) {583 $test->setMaxChildrenNumber(0);584 })585 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)586 ->hasMessage('Maximum number of children must be greater or equal to 1')587 ->object($test->setMaxChildrenNumber($maxChildrenNumber = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)588 ->integer($test->getMaxChildrenNumber())->isEqualTo($maxChildrenNumber)589 ->object($test->setMaxChildrenNumber((string) $maxChildrenNumber = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)590 ->integer($test->getMaxChildrenNumber())->isEqualTo($maxChildrenNumber)591 ;592 }593 public function testGetClass()594 {595 $this596 ->if($test = new emptyTest())597 ->then598 ->string($test->getClass())->isEqualTo(__NAMESPACE__ . '\emptyTest')599 ;600 }601 public function testGetPath()602 {603 $this604 ->if($test = new emptyTest())605 ->then606 ->string($test->getPath())->isEqualTo(__FILE__)607 ;608 }609 public function testGetCoverage()610 {611 $this612 ->if($test = new emptyTest())613 ->then614 ->object($test->getCoverage())->isIdenticalTo($test->getScore()->getCoverage())615 ;616 }617 public function testIsIgnored()618 {619 $this620 ->if($test = new emptyTest())621 ->then622 ->boolean($test->isIgnored())->isTrue()623 ->object($test->ignore(false))->isIdenticalTo($test)624 ->boolean($test->isIgnored())->isTrue()625 ->object($test->ignore(true))->isIdenticalTo($test)626 ->boolean($test->isIgnored())->isTrue()627 ->if($test = new notEmptyTest())628 ->then629 ->boolean($test->isIgnored())->isTrue()630 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()631 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()632 ->object($test->ignore(false))->isIdenticalTo($test)633 ->boolean($test->isIgnored())->isFalse()634 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()635 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()636 ->object($test->ignore(true))->isIdenticalTo($test)637 ->boolean($test->isIgnored())->isTrue()638 ->boolean($test->methodIsIgnored('testMethod1'))->istrue()639 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()640 ;641 }642 public function testGetCurrentMethod()643 {644 $this645 ->if($test = new emptyTest())646 ->then647 ->variable($test->getCurrentMethod())->isNull()648 ;649 }650 public function testCount()651 {652 $this653 ->sizeOf(new emptyTest())->isEqualTo(0)654 ->if($test = new notEmptyTest())655 ->then656 ->sizeOf($test)->isEqualTo(0)657 ->if($test->ignore(false))658 ->then659 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()660 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()661 ->sizeOf($test)->isEqualTo(2)662 ->if($test->ignoreMethod('testMethod1', true))663 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()664 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()665 ->sizeOf($test)->isEqualTo(1)666 ->if($test->ignoreMethod('testMethod2', true))667 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()668 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()669 ->sizeOf($test)->isEqualTo(0)670 ;671 }672 public function testGetTestMethods()673 {674 $this675 ->if($test = new emptyTest())676 ->then677 ->boolean($test->ignore(false)->isIgnored())->isTrue()678 ->sizeOf($test)->isZero()679 ->array($test->getTestMethods())->isEmpty()680 ->if($test = new notEmptyTest())681 ->then682 ->boolean($test->isIgnored())->isTrue()683 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()684 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()685 ->sizeOf($test)->isEqualTo(0)686 ->array($test->getTestMethods())->isEmpty()687 ->boolean($test->ignore(false)->isIgnored())->isFalse()688 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()689 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()690 ->sizeOf($test)->isEqualTo(2)691 ->array($test->getTestMethods())->isEqualTo(['testMethod1', 'testMethod2'])692 ->array($test->getTestMethods(['method']))->isEqualTo(['testMethod1', 'testMethod2'])693 ->array($test->getTestMethods(['test']))->isEqualTo(['testMethod1', 'testMethod2'])694 ->array($test->getTestMethods(['two']))->isEqualTo(['testMethod2'])695 ->array($test->getTestMethods([uniqid()]))->isEmpty()696 ->array($test->getTestMethods(['test', 'method']))->isEqualTo(['testMethod1', 'testMethod2'])697 ->array($test->getTestMethods(['test', 'method', uniqid()]))->isEqualTo(['testMethod1', 'testMethod2'])698 ->array($test->getTestMethods(['test', 'method', 'two', uniqid()]))->isEqualTo(['testMethod1', 'testMethod2'])699 ;700 }701 public function testGetPhpPath()702 {703 $this704 ->if($test = new emptyTest())705 ->then706 ->variable($test->getPhpPath())->isNull()707 ->if($test->setPhpPath($phpPath = uniqid()))708 ->then709 ->string($test->getPhpPath())->isEqualTo($phpPath)710 ;711 }712 public function testSetPhpPath()713 {714 $this715 ->if($test = new emptyTest())716 ->then717 ->object($test->setPhpPath($phpPath = uniqid()))->isIdenticalTo($test)718 ->string($test->getPhpPath())->isIdenticalTo($phpPath)719 ->object($test->setPhpPath($phpPath = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)720 ->string($test->getPhpPath())->isIdenticalTo((string) $phpPath)721 ;722 }723 public function testMethodIsIgnored()724 {725 $this726 ->if($test = new emptyTest())727 ->then728 ->exception(function () use ($test, & $method) {729 $test->methodIsIgnored($method = uniqid());730 })731 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)732 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')733 ;734 }735 public function testSetTags()736 {737 $this738 ->if($test = new emptyTest())739 ->then740 ->object($test->setTags($tags = [uniqid(), uniqid()]))->isIdenticalTo($test)741 ->array($test->getTags())->isEqualTo($tags)742 ;743 }744 public function testSetMethodTags()745 {746 $this747 ->if($test = new notEmptyTest())748 ->then749 ->object($test->setMethodTags('testMethod1', $tags = [uniqid(), uniqid()]))->isIdenticalTo($test)750 ->array($test->getMethodTags('testMethod1'))->isEqualTo($tags)751 ->exception(function () use ($test, & $method) {752 $test->setMethodTags($method = uniqid(), []);753 })754 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)755 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')756 ;757 }758 public function testGetMethodTags()759 {760 $this761 ->if($test = new notEmptyTest())762 ->then763 ->array($test->getMethodTags('testMethod1'))->isEqualTo(['test', 'method', 'one'])764 ->exception(function () use ($test, & $method) {765 $test->getMethodTags($method = uniqid());766 })767 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)768 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')769 ->if($test = new inheritedTagsTest())770 ->then771 ->array($test->getMethodTags())->isEqualTo(['testMethod1' => ['first', 'second', 'third'], 'testMethod2' => ['first', 'second', 'third']])772 ->array($test->getMethodTags('testMethod1'))->isEqualTo(['first', 'second', 'third'])773 ->array($test->getMethodTags('testMethod2'))->isEqualTo(['first', 'second', 'third'])774 ->if($test = new dataProviderTest())775 ->then776 ->array($test->getMethodTags())->isEqualTo(['testMethod1' => [], 'testMethod2' => [], 'testMethod3' => []])777 ->array($test->getMethodTags('testMethod1'))->isEqualTo([])778 ->array($test->getMethodTags('testMethod2'))->isEqualTo([])779 ->array($test->getMethodTags('testMethod3'))->isEqualTo([])780 ;781 }782 public function testAddMandatoryClassExtension()783 {784 $this785 ->if($test = new notEmptyTest())786 ->then787 ->object($test->addMandatoryClassExtension($extension = uniqid()))->isIdenticalTo($test)788 ->array($test->getMandatoryClassExtensions())->isEqualTo([$extension])789 ->object($test->addMandatoryClassExtension($otherExtension = uniqid()))->isIdenticalTo($test)790 ->array($test->getMandatoryClassExtensions())->isEqualTo([$extension, $otherExtension])791 ;792 }793 public function testGetMandatoryMethodExtensions()794 {795 $this796 ->if($test = new notEmptyTest())797 ->then798 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEmpty()799 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(['mbstring', 'socket'])800 ;801 }802 public function testAddMandatoryMethodExtension()803 {804 $this805 ->if($test = new notEmptyTest())806 ->then807 ->exception(function () use ($test, & $method) {808 $test->addMandatoryMethodExtension($method = uniqid(), uniqid());809 })810 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)811 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')812 ->object($test->addMandatoryMethodExtension('testMethod1', $extension = uniqid()))->isIdenticalTo($test)813 ->array($test->getMandatoryMethodExtensions())->isEqualTo(['testMethod1' => [$extension], 'testMethod2' => ['mbstring', 'socket']])814 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo([$extension])815 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(['mbstring', 'socket'])816 ->object($test->addMandatoryMethodExtension('testMethod1', $otherExtension = uniqid()))->isIdenticalTo($test)817 ->array($test->getMandatoryMethodExtensions())->isEqualTo(['testMethod1' => [$extension, $otherExtension], 'testMethod2' => ['mbstring', 'socket']])818 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo([$extension, $otherExtension])819 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(['mbstring', 'socket'])820 ->object($test->addMandatoryMethodExtension('testMethod2', $anOtherExtension = uniqid()))->isIdenticalTo($test)821 ->array($test->getMandatoryMethodExtensions())->isEqualTo(['testMethod1' => [$extension, $otherExtension], 'testMethod2' => ['mbstring', 'socket', $anOtherExtension]])822 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo([$extension, $otherExtension])823 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(['mbstring', 'socket', $anOtherExtension])824 ->if($test->addMandatoryClassExtension($classExtension = uniqid()))825 ->then826 ->array($test->getMandatoryMethodExtensions())->isEqualTo(['testMethod1' => [$classExtension, $extension, $otherExtension], 'testMethod2' => [$classExtension, 'mbstring', 'socket', $anOtherExtension]])827 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo([$classExtension, $extension, $otherExtension])828 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo([$classExtension, 'mbstring', 'socket', $anOtherExtension])829 ;830 }831 public function testAddClassPhpVersion()832 {833 $this834 ->if($test = new notEmptyTest())835 ->then836 ->object($test->addClassPhpVersion('5.3'))->isIdenticalTo($test)837 ->array($test->getClassPhpVersions())->isEqualTo(['5.3' => '>='])838 ->object($test->addClassPhpVersion('5.4', '<='))->isIdenticalTo($test)839 ->array($test->getClassPhpVersions())->isEqualTo(['5.3' => '>=', '5.4' => '<='])840 ;841 }842 public function testAddMethodPhpVersion()843 {844 $this845 ->if($test = new notEmptyTest())846 ->then847 ->exception(function () use ($test, & $method) {848 $test->addMethodPhpVersion($method, '6.0');849 })850 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)851 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')852 ->object($test->addMethodPhpVersion('testMethod1', '5.3'))->isIdenticalTo($test)853 ->array($test->getMethodPhpVersions())->isEqualTo(['testMethod1' => ['5.3' => '>='], 'testMethod2' => []])854 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(['5.3' => '>='])855 ->array($test->getMethodPhpVersions('testMethod2'))->isEmpty()856 ->object($test->addMethodPhpVersion('testMethod1', '5.4', '<='))->isIdenticalTo($test)857 ->array($test->getMethodPhpVersions())->isEqualTo(['testMethod1' => ['5.3' => '>=', '5.4' => '<='], 'testMethod2' => []])858 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(['5.3' => '>=', '5.4' => '<='])859 ->array($test->getMethodPhpVersions('testMethod2'))->isEmpty()860 ->object($test->addMethodPhpVersion('testMethod2', '5.4', '>='))->isIdenticalTo($test)861 ->array($test->getMethodPhpVersions())->isEqualTo(['testMethod1' => ['5.3' => '>=', '5.4' => '<='], 'testMethod2' => ['5.4' => '>=']])862 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(['5.3' => '>=', '5.4' => '<='])863 ->array($test->getMethodPhpVersions('testMethod2'))->isEqualTo(['5.4' => '>='])864 ->if($test->addClassPhpVersion('5.5'))865 ->then866 ->array($test->getMethodPhpVersions())->isEqualTo(['testMethod1' => ['5.5' => '>=', '5.3' => '>=', '5.4' => '<='], 'testMethod2' => ['5.5' => '>=', '5.4' => '>=']])867 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(['5.5' => '>=', '5.3' => '>=', '5.4' => '<='])868 ->array($test->getMethodPhpVersions('testMethod2'))->isEqualTo(['5.5' => '>=', '5.4' => '>='])869 ;870 }871 public function testRun()872 {873 $this874 ->mockTestedClass('mock\tests\units')875 ->if($test = new \mock\tests\units\test())876 ->then877 ->object($test->run())->isIdenticalTo($test)878 ->mock($test)879 ->call('callObservers')880 ->withArguments(\atoum\atoum\test::runStart)->never()881 ->withArguments(\atoum\atoum\test::runStop)->never()882 ->withArguments(\atoum\atoum\test::beforeSetUp)->never()883 ->withArguments(\atoum\atoum\test::afterSetUp)->never()884 ->withArguments(\atoum\atoum\test::beforeTestMethod)->never()885 ->withArguments(\atoum\atoum\test::afterTestMethod)->never()886 ;887 }888 public function testSetTestedClassName()889 {890 $this891 ->if($test = new foo())892 ->then893 ->string($test->getTestedClassName())->isEqualTo('atoum\atoum\test')894 ->exception(function () use ($test) {895 $test->setTestedClassName(uniqid());896 })897 ->isInstanceOf(atoum\exceptions\runtime::class)898 ->hasMessage('Tested class name is already defined')899 ->if($test = new self())900 ->then901 ->object($test->setTestedClassName($class = uniqid()))->isIdenticalTo($test)902 ->string($test->getTestedClassName())->isEqualTo($class)903 ->exception(function () use ($test) {904 $test->setTestedClassName(uniqid());905 })906 ->isInstanceOf(atoum\exceptions\runtime::class)907 ->hasMessage('Tested class name is already defined')908 ;909 }910 public function testMockClass()911 {912 $this913 ->if($test = new emptyTest())914 ->then915 ->object($test->mockClass(__CLASS__))->isIdenticalTo($test)916 ->class('mock\\' . __CLASS__)->isSubClassOf(__CLASS__)917 ->object($test->mockClass(__CLASS__, 'foo'))->isIdenticalTo($test)918 ->class('foo\test')->isSubClassOf(__CLASS__)919 ->object($test->mockClass(__CLASS__, 'foo\bar'))->isIdenticalTo($test)920 ->class('foo\bar\test')->isSubClassOf(__CLASS__)921 ->object($test->mockClass(__CLASS__, 'foo', 'bar'))->isIdenticalTo($test)922 ->class('foo\bar')->isSubClassOf(__CLASS__)923 ;924 }925 public function testMockTestedClass()926 {927 $this928 ->if($test = new emptyTest())929 ->and($testedClassName = $test->getTestedClassName())930 ->then931 ->object($test->mockTestedClass())->isIdenticalTo($test)932 ->class('mock\\' . $testedClassName)->isSubClassOf($testedClassName)933 ->object($test->mockTestedClass('foo'))->isIdenticalTo($test)934 ->class('foo\emptyTest')->isSubClassOf($testedClassName)935 ->object($test->mockTestedClass('foo\bar'))->isIdenticalTo($test)936 ->class('foo\bar\emptyTest')->isSubClassOf($testedClassName)937 ->object($test->mockTestedClass('foo', 'bar'))->isIdenticalTo($test)938 ->class('foo\bar')->isSubClassOf($testedClassName)939 ;940 }941 public function testGetTaggedTestMethods()942 {943 $this944 ->if($test = new emptyTest())945 ->then946 ->array($test->getTaggedTestMethods([]))->isEmpty()947 ->array($test->getTaggedTestMethods([uniqid()]))->isEmpty()948 ->array($test->getTaggedTestMethods([uniqid(), uniqid()]))->isEmpty()949 ->if($test = new notEmptyTest())950 ->then951 ->array($test->getTaggedTestMethods([]))->isEmpty()952 ->array($test->getTaggedTestMethods([uniqid()]))->isEmpty()953 ->array($test->getTaggedTestMethods([uniqid(), uniqid()]))->isEmpty()954 ->array($test->getTaggedTestMethods([uniqid(), 'testMethod1', uniqid()]))->isEmpty()955 ->array($test->getTaggedTestMethods([uniqid(), 'testMethod1', uniqid(), 'testMethod2']))->isEmpty()956 ->array($test->getTaggedTestMethods([uniqid(), 'Testmethod1', uniqid(), 'Testmethod2']))->isEmpty()957 ->if($test->ignore(false))958 ->then959 ->array($test->getTaggedTestMethods([uniqid(), 'testMethod1', uniqid()]))->isEqualTo(['testMethod1'])960 ->array($test->getTaggedTestMethods([uniqid(), 'testMethod2', uniqid()]))->isEqualTo(['testMethod2'])961 ->array($test->getTaggedTestMethods([uniqid(), 'Testmethod1', uniqid(), 'Testmethod2']))->isEqualTo(['Testmethod1', 'Testmethod2'])962 ->array($test->getTaggedTestMethods([uniqid(), 'Testmethod1', uniqid(), 'Testmethod2'], ['one']))->isEqualTo(['Testmethod1'])963 ->if($test->ignoreMethod('testMethod1', true))964 ->then965 ->array($test->getTaggedTestMethods([uniqid(), 'testMethod1', uniqid()]))->isEmpty()966 ->array($test->getTaggedTestMethods([uniqid(), 'testMethod2', uniqid()]))->isEqualTo(['testMethod2'])967 ->array($test->getTaggedTestMethods([uniqid(), 'Testmethod1', uniqid(), 'Testmethod2']))->isEqualTo(['Testmethod2'])968 ->array($test->getTaggedTestMethods([uniqid(), 'Testmethod1', uniqid(), 'Testmethod2'], ['one']))->isEmpty()969 ;970 }971 public function testSetDataProvider()972 {973 $this974 ->if($test = new emptyTest())975 ->then976 ->exception(function () use ($test, & $method) {977 $test->setDataProvider($method = uniqid(), uniqid());978 })979 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)980 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')981 ->if($test = new notEmptyTest())982 ->then983 ->exception(function () use ($test, & $dataProvider) {984 $test->setDataProvider('testMethod1', $dataProvider = uniqid());985 })986 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)987 ->hasMessage('Data provider ' . get_class($test) . '::' . $dataProvider . '() is unknown')988 ->object($test->setDataProvider('testMethod1', 'aDataProvider'))->isIdenticalTo($test)989 ->array($test->getDataProviders())->isEqualTo(['testMethod1' => 'aDataProvider'])990 ->if($test = new dataProviderTest())991 ->then992 ->object($test->setDataProvider('testMethod2'))->isIdenticalTo($test)993 ->array($providers = $test->getDataProviders())994 ->object['testMethod2']->isInstanceOf(atoum\test\data\provider\aggregator::class)995 ->exception(function () use ($providers) {996 $providers['testMethod2']();997 })998 ->isInstanceOf(atoum\exceptions\runtime::class)999 ->hasMessage('Could not instanciate a mock from ' . $test->getMockGenerator()->getDefaultNamespace() . '\\SplFileInfo because SplFileInfo::__construct() has at least one mandatory argument')1000 ->if($test->getMockGenerator()->allIsInterface())1001 ->then1002 ->exception(function () use ($providers) {1003 $providers['testMethod2']();1004 })1005 ->isInstanceOf(atoum\exceptions\runtime::class)1006 ->hasMessage('Could not instanciate a mock from ' . $test->getMockGenerator()->getDefaultNamespace() . '\\SplFileInfo because SplFileInfo::__construct() has at least one mandatory argument')1007 ->if($test->getMockGenerator()->setDefaultNamespace('testMocks'))1008 ->then1009 ->array($providers['testMethod2']())->isEqualTo([[new \testMocks\SplFileInfo()]])1010 ->if($test = new dataProviderTest())1011 ->then1012 ->exception(function () use ($test, & $dataProvider) {1013 $test->setDataProvider('testMethod3');1014 })1015 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)1016 ->hasMessage('Could not generate a data provider for ' . get_class($test) . '::testMethod3() because it has at least one argument which is not type-hinted with a class or interface name')1017 ->object($test->setDataProvider('testMethod1'))->isIdenticalTo($test)1018 ->array($test->getDataProviders())1019 ->object['testMethod1']->isInstanceOf(atoum\test\data\provider\aggregator::class)1020 ->if($test = new dataProviderTest())1021 ->then1022 ->exception(function () use ($test, & $dataProvider) {1023 $test->setDataProvider('testMethod3', function () {1024 });1025 })1026 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)1027 ->hasMessage('Cannot use a closure as a data provider for method ' . get_class($test) . '::testMethod3()')1028 ;1029 }1030 public function testCalling()1031 {1032 $this1033 ->if($test = new emptyTest())1034 ->and($mock = new \mock\foo())1035 ->and($test->calling($mock)->bar = $value = uniqid())1036 ->then1037 ->string($mock->bar())->isEqualTo($value)1038 ->and($test->Æ($mock)->bar = $otherValue = uniqid())1039 ->then1040 ->string($mock->bar())->isEqualTo($otherValue)1041 ;1042 }1043 public function testResetMock()1044 {1045 $this1046 ->if($test = new emptyTest())1047 ->and($mockController = new \mock\atoum\atoum\mock\controller())1048 ->and($mockController->control($mock = new \mock\phpObject()))1049 ->and($this->resetMock($mockController))1050 ->then1051 ->object($test->resetMock($mock))->isIdenticalTo($mock->getMockController())1052 ->mock($mockController)->call('resetCalls')->once()1053 ;1054 }1055 public function testResetFunction()1056 {1057 $this1058 ->if($test = new emptyTest())1059 ->and($this->function->md5 = uniqid())1060 ->then1061 ->object($test->resetFunction($this->function->md5))->isIdenticalTo($this->function->md5)1062 ;1063 }1064 public function testResetAdapter()1065 {1066 $this1067 ->if($test = new emptyTest())1068 ->and($adapter = new \mock\atoum\atoum\test\adapter())1069 ->and($this->resetMock($adapter))1070 ->then1071 ->object($test->resetAdapter($adapter))->isIdenticalTo($adapter)1072 ->mock($adapter)->call('resetCalls')->once()1073 ;1074 }1075 public function testErrorHandler()1076 {1077 $this1078 ->if($test = new emptyTest())1079 ->and($adapter = new atoum\test\adapter())1080 ->and($adapter->error_reporting = 0)1081 ->and($test->setAdapter($adapter))1082 ->then1083 ->boolean($test->errorHandler(rand(1, PHP_INT_MAX), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1084 ->array($test->getScore()->getErrors())->isEmpty()1085 ->if($adapter->error_reporting = E_ALL)1086 ->then1087 ->boolean($test->errorHandler(E_NOTICE, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1088 ->variable($test->getScore()->errorExists($errstr, E_NOTICE))->isNotNull()1089 ->boolean($test->errorHandler(E_WARNING, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1090 ->variable($test->getScore()->errorExists($errstr, E_WARNING))->isNotNull()1091 ->boolean($test->errorHandler(E_USER_NOTICE, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1092 ->variable($test->getScore()->errorExists($errstr, E_USER_NOTICE))->isNotNull()1093 ->boolean($test->errorHandler(E_USER_WARNING, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1094 ->variable($test->getScore()->errorExists($errstr, E_USER_WARNING))->isNotNull()1095 ->boolean($test->errorHandler(E_DEPRECATED, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1096 ->variable($test->getScore()->errorExists($errstr, E_DEPRECATED))->isNotNull()1097 ->boolean($test->errorHandler(E_RECOVERABLE_ERROR, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isFalse()1098 ->variable($test->getScore()->errorExists($errstr, E_RECOVERABLE_ERROR))->isNotNull()1099 ->if($adapter->error_reporting = E_ALL & ~E_DEPRECATED)1100 ->then1101 ->boolean($test->errorHandler(E_NOTICE, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1102 ->variable($test->getScore()->errorExists($errstr, E_NOTICE))->isNotNull()1103 ->boolean($test->errorHandler(E_WARNING, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1104 ->variable($test->getScore()->errorExists($errstr, E_WARNING))->isNotNull()1105 ->boolean($test->errorHandler(E_USER_NOTICE, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1106 ->variable($test->getScore()->errorExists($errstr, E_USER_NOTICE))->isNotNull()1107 ->boolean($test->errorHandler(E_USER_WARNING, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1108 ->variable($test->getScore()->errorExists($errstr, E_USER_WARNING))->isNotNull()1109 ->boolean($test->errorHandler(E_DEPRECATED, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1110 ->variable($test->getScore()->errorExists($errstr, E_DEPRECATED))->isNull()1111 ->if($adapter->error_reporting = E_ALL & ~E_RECOVERABLE_ERROR)1112 ->then1113 ->boolean($test->errorHandler(E_RECOVERABLE_ERROR, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1114 ->variable($test->getScore()->errorExists($errstr, E_RECOVERABLE_ERROR))->isNull()1115 ->if($adapter->error_reporting = 32767)1116 ->and($factory = function ($class) use (& $reflection, & $filename, & $classname) {1117 $reflection = new \mock\ReflectionClass($class);1118 $reflection->getMockController()->getFilename = $filename = 'filename';1119 $reflection->getMockController()->getName = $classname = 'classname';1120 return $reflection;1121 })1122 ->and($score = new \mock\atoum\atoum\test\score())1123 ->and($test = new emptyTest(null, null, null, null, $factory))1124 ->and($test->setAdapter($adapter))1125 ->and($test->setScore($score))1126 ->then1127 ->boolean($test->errorHandler($errno = E_NOTICE, $errstr = 'errstr', $errfile = 'errfile', $errline = rand(1, PHP_INT_MAX)))->isTrue()1128 ->mock($score)1129 ->call('addError')->withArguments($errfile, $classname, $test->getCurrentMethod(), $errline, $errno, $errstr, $errfile, $errline, null, null, null)->once()1130 ->boolean($test->errorHandler($errno, $errstr, null, $errline = rand(1, PHP_INT_MAX)))->isTrue()1131 ->mock($score)1132 ->call('addError')->withArguments($filename, $classname, $test->getCurrentMethod(), $errline, $errno, $errstr, null, $errline, null, null, null)->once()1133 ;1134 }1135 public function testGetTestedClassNameFromTestClass()1136 {1137 $this1138 ->string(atoum\test::getTestedClassNameFromTestClass(__CLASS__))->isEqualTo('atoum\atoum\test')1139 ->string(atoum\test::getTestedClassNameFromTestClass('foo\bar\tests\units\testedClass'))->isEqualTo('foo\bar\testedClass')1140 ->if(atoum\test::setNamespace('test\unit'))1141 ->then1142 ->string(atoum\test::getTestedClassNameFromTestClass('foo\bar\test\unit\testedClass'))->isEqualTo('foo\bar\testedClass')1143 ->if(atoum\test::setNamespace('\test\unit\\'))1144 ->then1145 ->string(atoum\test::getTestedClassNameFromTestClass('foo\bar\test\unit\testedClass'))->isEqualTo('foo\bar\testedClass')1146 ->if(atoum\test::setNamespace('test\unit\\'))1147 ->then1148 ->string(atoum\test::getTestedClassNameFromTestClass('foo\bar\test\unit\testedClass'))->isEqualTo('foo\bar\testedClass')1149 ->if(atoum\test::setNamespace('\test\unit'))1150 ->then1151 ->string(atoum\test::getTestedClassNameFromTestClass('foo\bar\test\unit\testedClass'))->isEqualTo('foo\bar\testedClass')1152 ->exception(function () {1153 atoum\test::getTestedClassNameFromTestClass('foo\bar\aaa\bbb\testedClass');1154 })1155 ->isInstanceOf(atoum\exceptions\runtime::class)1156 ->hasMessage('Test class \'foo\bar\aaa\bbb\testedClass\' is not in a namespace which contains \'' . atoum\test::getNamespace() . '\'')1157 ->if(atoum\test::setNamespace('#(?:^|\\\)xxxs?\\\yyys?\\\#i'))1158 ->then1159 ->string(atoum\test::getTestedClassNameFromTestClass('foo\bar\xxx\yyy\testedClass'))->isEqualTo('foo\bar\testedClass')1160 ->string(atoum\test::getTestedClassNameFromTestClass('foo\bar\xxxs\yyy\testedClass'))->isEqualTo('foo\bar\testedClass')1161 ->string(atoum\test::getTestedClassNameFromTestClass('foo\bar\xxxs\yyys\testedClass'))->isEqualTo('foo\bar\testedClass')1162 ->string(atoum\test::getTestedClassNameFromTestClass('foo\bar\xxx\yyys\testedClass'))->isEqualTo('foo\bar\testedClass')1163 ->exception(function () {1164 atoum\test::getTestedClassNameFromTestClass('foo\bar\aaa\bbb\testedClass');1165 })1166 ->isInstanceOf(atoum\exceptions\runtime::class)1167 ->hasMessage('Test class \'foo\bar\aaa\bbb\testedClass\' is not in a namespace which matches pattern \'' . atoum\test::getNamespace() . '\'')1168 ->string(atoum\test::getTestedClassNameFromTestClass('foo\bar\aaa\bbb\testedClass', '#(?:^|\\\)aaas?\\\bbbs?\\\#i'))->isEqualTo('foo\bar\testedClass')1169 ;1170 }1171 public function testAddExtension()1172 {1173 $this1174 ->if($test = new emptyTest())1175 ->then1176 ->object($test->addExtension($extension = new \mock\atoum\atoum\extension()))->isIdenticalTo($test)1177 ->array(iterator_to_array($test->getExtensions()))->isEqualTo([$extension])1178 ->array($test->getObservers())->isEqualTo([$extension])1179 ->mock($extension)1180 ->call('setTest')->withArguments($test)->once()1181 ->if($this->resetMock($extension))1182 ->then1183 ->object($test->addExtension($extension))->isIdenticalTo($test)1184 ->array(iterator_to_array($test->getExtensions()))->isEqualTo([$extension])1185 ->array($test->getObservers())->isEqualTo([$extension])1186 ->mock($extension)1187 ->call('setTest')->once();1188 ;1189 }1190 public function testRemoveExtension()1191 {1192 $this1193 ->if($test = new emptyTest())1194 ->then1195 ->object($test->getExtensions())->isEqualTo(new \splObjectStorage())1196 ->array($test->getObservers())->isEmpty()1197 ->object($test->removeExtension(new \mock\atoum\atoum\extension()))->isIdenticalTo($test)1198 ->object($test->getExtensions())->isEqualTo(new \splObjectStorage())1199 ->array($test->getObservers())->isEmpty()1200 ->if($extension = new \mock\atoum\atoum\extension())1201 ->and($otherExtension = new \mock\atoum\atoum\extension())1202 ->and($test->addExtension($extension)->addExtension($otherExtension))1203 ->then1204 ->array(iterator_to_array($test->getExtensions()))->isEqualTo([$extension, $otherExtension])1205 ->array($test->getObservers())->isEqualTo([$extension, $otherExtension])1206 ->object($test->removeExtension(new \mock\atoum\atoum\extension()))->isIdenticalTo($test)1207 ->array(iterator_to_array($test->getExtensions()))->isEqualTo([$extension, $otherExtension])1208 ->array($test->getObservers())->isEqualTo([$extension, $otherExtension])1209 ->object($test->removeExtension($extension))->isIdenticalTo($test)1210 ->array(iterator_to_array($test->getExtensions()))->isEqualTo([$otherExtension])1211 ->array($test->getObservers())->isEqualTo([$otherExtension])1212 ->object($test->removeExtension($otherExtension))->isIdenticalTo($test)1213 ->object($test->getExtensions())->isEqualTo(new \splObjectStorage())1214 ->array($test->getObservers())->isEmpty()1215 ;1216 }1217 public function testRemoveExtensions()1218 {1219 $this1220 ->if($test = new emptyTest())1221 ->then1222 ->object($test->getExtensions())->isEqualTo(new \splObjectStorage())1223 ->array($test->getObservers())->isEmpty()1224 ->object($test->removeExtensions())->isIdenticalTo($test)1225 ->object($test->getExtensions())->isEqualTo(new \splObjectStorage())1226 ->array($test->getObservers())->isEmpty()1227 ->if($extension = new \mock\atoum\atoum\extension())1228 ->and($otherExtension = new \mock\atoum\atoum\extension())1229 ->and($test->addExtension($extension)->addExtension($otherExtension))1230 ->then1231 ->array(iterator_to_array($test->getExtensions()))->isEqualTo([$extension, $otherExtension])1232 ->array($test->getObservers())->isEqualTo([$extension, $otherExtension])1233 ->object($test->removeExtensions())->isIdenticalTo($test)1234 ->object($test->getExtensions())->isEqualTo(new \splObjectStorage())1235 ->array($test->getObservers())->isEmpty()1236 ;1237 }1238 public function testGetExtensionConfiguration()1239 {1240 $this1241 ->if(1242 $test = new emptyTest(),1243 $extension = new \mock\atoum\atoum\extension()1244 )1245 ->then1246 ->variable($test->getExtensionConfiguration($extension))->isNull1247 ->if($test->addExtension($extension))1248 ->then1249 ->variable($test->getExtensionConfiguration($extension))->isNull1250 ->given($configuration = new \mock\atoum\atoum\extension\configuration())1251 ->if($test->addExtension($extension, $configuration))1252 ->then1253 ->object($test->getExtensionConfiguration($extension))->isIdenticalTo($configuration)1254 ;1255 }1256 public function testCallStaticOnTestedClass()1257 {1258 $this1259 ->if($test = new withStatic())1260 ->then1261 ->string($test->callStaticOnTestedClass('staticMethod', $return = uniqid()))1262 ->isEqualTo($return)1263 ->array($test->callStaticOnTestedClass(1264 'someOtherStaticMethod',1265 $return1 = uniqid(),1266 $return2 = uniqid(),1267 $return3 = uniqid()1268 ))1269 ->isEqualTo([$return1, $return2, $return3])1270 ;1271 }1272 public function testNewMockInstance()1273 {1274 $this1275 ->if($test = new emptyTest())1276 ->then1277 ->object($mock = $test->newMockInstance(\stdClass::class))1278 ->isInstanceOf(\mock\stdClass::class)1279 ->isInstanceOf(\stdClass::class)1280 ->object($test->newMockInstance(\stdClass::class))1281 ->isInstanceOf(\mock\stdClass::class)1282 ->isInstanceOf(\stdClass::class)1283 ->isNotIdenticalTo($mock)1284 ->object($test->newMockInstance(\stdClass::class, 'foobar'))1285 ->isInstanceOf(\foobar\stdClass::class)1286 ->isInstanceOf(\stdClass::class)1287 ->object($test->newMockInstance(\stdClass::class, 'foo', 'bar'))1288 ->isInstanceOf(\foo\bar::class)1289 ->isInstanceOf(\stdClass::class)1290 ->given($arguments = [$firstArgument = uniqid(), $secondArgument = rand(0, PHP_INT_MAX)])1291 ->then1292 ->object($mock = $test->newMockInstance(atoum\dummy::class, null, null, $arguments))1293 ->isInstanceOf(\mock\atoum\atoum\dummy::class)1294 ->isInstanceOf(atoum\dummy::class)1295 ->mock($mock)1296 ->call('__construct')->withArguments($firstArgument, $secondArgument)->once1297 ->given($arguments = [uniqid(), rand(0, PHP_INT_MAX), $controller = new mock\controller()])1298 ->then1299 ->object($mock = $test->newMockInstance(atoum\dummy::class, null, null, $arguments))1300 ->isInstanceOf(\mock\atoum\atoum\dummy::class)1301 ->isInstanceOf(atoum\dummy::class)1302 ->object($mock->getMockController())->isIdenticalTo($controller)1303 ->given(1304 $arguments = [uniqid(), rand(0, PHP_INT_MAX)],1305 $controller = new mock\controller()1306 )1307 ->then1308 ->object($mock = $test->newMockInstance(atoum\dummy::class, null, null, $arguments))1309 ->isInstanceOf(\mock\atoum\atoum\dummy::class)1310 ->isInstanceOf(atoum\dummy::class)1311 ->object($mock->getMockController())->isIdenticalTo($controller)1312 ;1313 }1314 public function testGetClassSupportedOs()1315 {1316 $this1317 ->if($test = new osRestricted())1318 ->then1319 ->array($test->getClassSupportedOs())1320 ->string[0]->isEqualTo('foo')1321 ->if($test = new emptyTest())1322 ->then1323 ->array($test->getClassSupportedOs())->isEmpty1324 ;1325 }1326 public function testGetMethodSupportedOs()1327 {1328 $this1329 ->if($test = new osRestricted())1330 ->then1331 ->array($test->getMethodSupportedOs())1332 ->array['testMethod1']->isEqualTo(['foo'])1333 ->array['testMethod2']->isEqualTo(['foo', 'bar'])1334 ->array['testMethod3']->isEqualTo(['!foo'])1335 ->array($test->getMethodSupportedOs('testMethod1'))->isEqualTo(['foo'])1336 ->array($test->getMethodSupportedOs('testMethod2'))->isEqualTo(['foo', 'bar'])1337 ->array($test->getMethodSupportedOs('testMethod3'))->isEqualTo(['!foo'])1338 ;1339 }1340 }1341}...
RequirementsService.php
Source:RequirementsService.php
1<?php2/**3 * This program is free software; you can redistribute it and/or4 * modify it under the terms of the GNU General Public License5 * as published by the Free Software Foundation; under version 26 * of the License (non-upgradable).7 *8 * This program is distributed in the hope that it will be useful,9 * but WITHOUT ANY WARRANTY; without even the implied warranty of10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11 * GNU General Public License for more details.12 *13 * You should have received a copy of the GNU General Public License14 * along with this program; if not, write to the Free Software15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.16 *17 * Copyright (c) 2016-2019 (original work) Open Assessment Technologies SA;18 *19 */20namespace oat\taoClientRestrict\model\requirements;21use oat\oatbox\service\ConfigurableService;22use oat\generis\model\OntologyAwareTrait;23use oat\taoClientRestrict\model\detection\BrowserClassService;24use oat\taoClientRestrict\model\detection\DetectorClassService;25use oat\taoClientRestrict\model\detection\OsClassService;26class RequirementsService extends ConfigurableService implements RequirementsServiceInterface27{28 use OntologyAwareTrait;29 const PROPERTY_DELIVERY_APPROVED_BROWSER = 'http://www.tao.lu/Ontologies/TAODelivery.rdf#ApprovedBrowser';30 const PROPERTY_DELIVERY_RESTRICT_BROWSER_USAGE = 'http://www.tao.lu/Ontologies/TAODelivery.rdf#RestrictBrowserUsage';31 const PROPERTY_DELIVERY_APPROVED_OS = 'http://www.tao.lu/Ontologies/TAODelivery.rdf#ApprovedOS';32 const PROPERTY_DELIVERY_RESTRICT_OS_USAGE = 'http://www.tao.lu/Ontologies/TAODelivery.rdf#RestrictOSUsage';33 const URI_DELIVERY_COMPLY_ENABLED = 'http://www.tao.lu/Ontologies/TAODelivery.rdf#ComplyEnabled';34 private $approvedOs = [];35 private $approvedBrowsers = [];36 /**37 * Whether client complies to the delivery execution38 * @param string $deliveryId39 * @return boolean40 */41 public function compliesToDelivery($deliveryId)42 {43 $delivery = $this->getResource($deliveryId);44 return $this->browserComplies($delivery) && $this->OSComplies($delivery);45 }46 /**47 * @param \core_kernel_classes_Resource $delivery48 * @return boolean49 */50 public function browserComplies(\core_kernel_classes_Resource $delivery = null)51 {52 $isBrowserApproved = true;53 if ($delivery !== null) {54 $isBrowserRestricted = $delivery->getOnePropertyValue($this->getProperty(self::PROPERTY_DELIVERY_RESTRICT_BROWSER_USAGE));55 if (!is_null($isBrowserRestricted) && self::URI_DELIVERY_COMPLY_ENABLED == $isBrowserRestricted->getUri()) {56 //@TODO property caching - anyway we are operating with complied57 $browsers = $this->getApprovedBrowsers();58 $isBrowserApproved = $this->complies($browsers, BrowserClassService::singleton());59 }60 }61 return $isBrowserApproved;62 }63 public function getApprovedBrowsers(\core_kernel_classes_Resource $delivery = null)64 {65 if ($delivery !== null) {66 $deliveryUri = $delivery->getUri();67 if (empty($this->approvedBrowsers[$deliveryUri])) {68 $this->approvedBrowsers[$deliveryUri] = $delivery69 ->getPropertyValuesCollection($this->getProperty(self::PROPERTY_DELIVERY_APPROVED_BROWSER))70 ->toArray();71 }72 return $this->approvedBrowsers[$deliveryUri];73 }74 return [];75 }76 /**77 * @param \core_kernel_classes_Resource $delivery78 * @return boolean79 */80 public function OSComplies(\core_kernel_classes_Resource $delivery = null)81 {82 $isOSApproved = true;83 if ($delivery !== null) {84 $isOSRestricted = $delivery->getOnePropertyValue($this->getProperty(self::PROPERTY_DELIVERY_RESTRICT_OS_USAGE));85 if (!is_null($isOSRestricted) && self::URI_DELIVERY_COMPLY_ENABLED == $isOSRestricted->getUri()) {86 //@TODO property caching - anyway we are operating with complied87 $approvedOs = $this->getApprovedOs($delivery);88 $isOSApproved = $this->complies($approvedOs, OsClassService::singleton());89 }90 }91 return $isOSApproved;92 }93 public function getApprovedOs(\core_kernel_classes_Resource $delivery = null)94 {95 if ($delivery !== null) {96 $deliveryUri = $delivery->getUri();97 if (empty($this->approvedOs[$deliveryUri])) {98 $this->approvedOs[$deliveryUri] = $delivery99 ->getPropertyValuesCollection($this->getProperty(self::PROPERTY_DELIVERY_APPROVED_OS))100 ->toArray();101 }102 return $this->approvedOs[$deliveryUri];103 }104 return [];105 }106 /**107 * @param array $conditions108 * @param DetectorClassService $conditionService109 * @return bool110 */111 protected function complies(array $conditions, DetectorClassService $conditionService)112 {113 $clientName = $conditionService->getDetector()->getName();114 $clientVersion = $conditionService->getDetector()->getVersion();115 $clientNameResource = $conditionService->getClientNameResource();116 $this->logDebug("Detected client: ${clientName} @ ${clientVersion}");117 $result = false;118 /** @var \core_kernel_classes_Property $browser */119 foreach ($conditions as $condition) {120 if ($condition->exists() === true) {121 /** @var \core_kernel_classes_Resource $requiredName */122 $requiredName = $condition->getOnePropertyValue($conditionService->getNameProperty());123 if ($clientNameResource && !($clientNameResource->equals($requiredName))) {124 $this->logInfo("Client rejected. Required name is ${requiredName} but current name is ${clientName}.");125 continue;126 } elseif ($clientNameResource === null) {127 $this->logInfo("Client rejected. Unknown client.");128 continue;129 }130 $requiredVersion = $condition->getOnePropertyValue($conditionService->getVersionProperty());131 if (-1 !== $this->versionCompare($conditionService->getDetector()->getVersion(), $requiredVersion)) {132 $result = true;133 break;134 }135 }136 }137 return $result;138 }139 /**140 * Standard version_compare threats that 5.2 < 5.2.0, 5.2 < 5.2.1, ...141 *142 * @param $ver1143 * @param $ver2144 * @param null|string @see http://php.net/manual/en/function.version-compare.php145 * @return mixed146 */147 protected function versionCompare($ver1, $ver2, $operator = null)148 {149 $ver1 = preg_replace('#(\.0+)+($|-)#', '', $ver1);150 $ver2 = preg_replace('#(\.0+)+($|-)#', '', $ver2);151 if ($operator === null) {152 $result = version_compare($ver1, $ver2);153 } else {154 $result = version_compare($ver1, $ver2, $operator);155 }156 return $result;157 }158}...
osRestricted
Using AI Code Generation
1use \mageekguy\atoum\os;2$os = new os();3if($os->isWindows() == true)4{5 echo "Windows";6}7{8 echo "Not Windows";9}10if($os->isLinux() == true)11{12 echo "Linux";13}14{15 echo "Not Linux";16}17if($os->isUnix() == true)18{19 echo "Unix";20}21{22 echo "Not Unix";23}24if($os->isMac() == true)25{26 echo "Mac";27}28{29 echo "Not Mac";30}31if($os->isBSD() == true)32{33 echo "BSD";34}35{36 echo "Not BSD";37}38if($os->isSolaris() == true)39{40 echo "Solaris";41}42{43 echo "Not Solaris";44}45if($os->isAix() == true)46{47 echo "Aix";48}49{50 echo "Not Aix";51}52if($os->isHPUX() == true)53{54 echo "HPUX";55}56{57 echo "Not HPUX";58}59if($os->isIrix() == true)60{61 echo "Irix";62}63{64 echo "Not Irix";65}66if($os->isOS2() == true)67{68 echo "OS2";69}70{71 echo "Not OS2";72}73if($os->isQnx() == true)74{75 echo "Qnx";76}77{78 echo "Not Qnx";79}80if($os->isBeOS() == true)81{82 echo "BeOS";83}84{85 echo "Not BeOS";86}
osRestricted
Using AI Code Generation
1$osRestricted = new Atoum\OsRestricted();2$osRestricted->setOs('windows');3$osRestricted->run($this);4$osRestricted = new Atoum\OsRestricted();5$osRestricted->setOs('linux');6$osRestricted->run($this);7$osRestricted = new Atoum\OsRestricted();8$osRestricted->setOs('mac');9$osRestricted->run($this);10$osRestricted = new Atoum\OsRestricted();11$osRestricted->setOs('unix');12$osRestricted->run($this);13$osRestricted = new Atoum\OsRestricted();14$osRestricted->setOs('all');15$osRestricted->run($this);16$osRestricted = new Atoum\OsRestricted();17$osRestricted->setOs('any');18$osRestricted->run($this);19$osRestricted = new Atoum\OsRestricted();20$osRestricted->setOs('none');21$osRestricted->run($this);22$osRestricted = new Atoum\OsRestricted();23$osRestricted->setOs('not windows');24$osRestricted->run($this);25$osRestricted = new Atoum\OsRestricted();26$osRestricted->setOs('not linux');27$osRestricted->run($this);28$osRestricted = new Atoum\OsRestricted();29$osRestricted->setOs('not mac');30$osRestricted->run($this);31$osRestricted = new Atoum\OsRestricted();32$osRestricted->setOs('not unix');33$osRestricted->run($this);34$osRestricted = new Atoum\OsRestricted();35$osRestricted->setOs('not all');36$osRestricted->run($this);
osRestricted
Using AI Code Generation
1use \mageekguy\atoum\os;2$os = new os();3if ($os->isWindows() === true) {4 echo "You are using windows";5} else {6 echo "You are using a non windows OS";7}8if ($os->isLinux() === true) {9 echo "You are using linux";10} else {11 echo "You are using a non linux OS";12}13if ($os->isUnix() === true) {14 echo "You are using unix";15} else {16 echo "You are using a non unix OS";17}18if ($os->isMac() === true) {19 echo "You are using mac";20} else {21 echo "You are using a non mac OS";22}23if ($os->isBsd() === true) {24 echo "You are using bsd";25} else {26 echo "You are using a non bsd OS";27}28if ($os->isSolaris() === true) {29 echo "You are using solaris";30} else {31 echo "You are using a non solaris OS";32}33if ($os->isAix() === true) {34 echo "You are using aix";35} else {36 echo "You are using a non aix OS";37}38if ($os->isHpux() === true) {39 echo "You are using hpux";40} else {41 echo "You are using a non hpux OS";42}43if ($os->isIrix() === true) {44 echo "You are using irix";45} else {46 echo "You are using a non irix OS";47}48if ($os->isOs2() === true) {49 echo "You are using os2";50} else {51 echo "You are using a non os2 OS";52}53if ($os->isBeos() === true
osRestricted
Using AI Code Generation
1require_once 'osRestricted.php';2$osRestricted = new osRestricted();3$osRestricted->restrict();4require_once 'osRestricted.php';5$osRestricted = new osRestricted();6$osRestricted->restrict();7require_once 'osRestricted.php';8$osRestricted = new osRestricted();9$osRestricted->restrict();10require_once 'osRestricted.php';11$osRestricted = new osRestricted();12$osRestricted->restrict();13require_once 'osRestricted.php';14$osRestricted = new osRestricted();15$osRestricted->restrict();16require_once 'osRestricted.php';17$osRestricted = new osRestricted();18$osRestricted->restrict();19require_once 'osRestricted.php';20$osRestricted = new osRestricted();21$osRestricted->restrict();22require_once 'osRestricted.php';23$osRestricted = new osRestricted();24$osRestricted->restrict();25require_once 'osRestricted.php';26$osRestricted = new osRestricted();
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.
Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.
Test now for FreeGet 100 minutes of automation test minutes FREE!!