Best Atoum code snippet using runner.setRunner
runner.php
Source:runner.php
...485 public function testSetPhpPath()486 {487 $this488 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))489 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))490 ->then491 ->object($script->setPhpPath($phpPath = uniqid()))->isIdenticalTo($script)492 ->mock($runner)->call('setPhpPath')->withArguments($phpPath)->once()493 ;494 }495 public function testSetDefaultReportTitle()496 {497 $this498 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))499 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))500 ->then501 ->object($script->setDefaultReportTitle($reportTitle = uniqid()))->isIdenticalTo($script)502 ->mock($runner)->call('setDefaultReportTitle')->withArguments($reportTitle)->once()503 ;504 }505 public function testSetMaxChildrenNumber()506 {507 $this508 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))509 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))510 ->then511 ->object($script->setMaxChildrenNumber($childrenNumber = rand(1, PHP_INT_MAX)))->isIdenticalTo($script)512 ->mock($runner)->call('setMaxChildrenNumber')->withArguments($childrenNumber)->once()513 ;514 }515 public function testDisableCodeCoverage()516 {517 $this518 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))519 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))520 ->then521 ->object($script->disableCodeCoverage($childrenNumber = rand(1, PHP_INT_MAX)))->isIdenticalTo($script)522 ->mock($runner)->call('disableCodeCoverage')->withoutAnyArgument()->once()523 ;524 }525 public function testExcludeNamespacesFromCoverage()526 {527 $this528 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))529 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))530 ->and($this->calling($runner)->getCoverage = $coverage = new \mock\atoum\atoum\score\coverage())531 ->then532 ->object($script->excludeNamespacesFromCoverage(['foo', 'bar']))->isIdenticalTo($script)533 ->mock($coverage)->call('excludeNamespace')534 ->withArguments('foo')->once()535 ->withArguments('bar')->once()536 ;537 }538 public function testExcludeDirectoriesFromCoverage()539 {540 $this541 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))542 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))543 ->and($this->calling($runner)->getCoverage = $coverage = new \mock\atoum\atoum\score\coverage())544 ->then545 ->object($script->excludeDirectoriesFromCoverage(['foo', 'bar']))->isIdenticalTo($script)546 ->mock($coverage)->call('excludeDirectory')547 ->withArguments('foo')->once()548 ->withArguments('bar')->once()549 ;550 }551 public function testExcludeClassesFromCoverage()552 {553 $this554 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))555 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))556 ->and($this->calling($runner)->getCoverage = $coverage = new \mock\atoum\atoum\score\coverage())557 ->then558 ->object($script->excludeClassesFromCoverage(['foo', 'bar']))->isIdenticalTo($script)559 ->mock($coverage)->call('excludeClass')560 ->withArguments('foo')->once()561 ->withArguments('bar')->once()562 ;563 }564 public function testAddTest()565 {566 $this567 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))568 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))569 ->then570 ->object($script->addTest($testPath = uniqid()))->isIdenticalTo($script)571 ->mock($runner)->call('addTest')->withArguments($testPath)->once()572 ;573 }574 public function testAddTests()575 {576 $this577 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))578 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))579 ->then580 ->object($script->addTests([$testPath1 = uniqid(), $testPath2 = uniqid()]))->isIdenticalTo($script)581 ->mock($runner)582 ->call('addTest')583 ->withArguments($testPath1)->once()584 ->withArguments($testPath2)->once()585 ;586 }587 public function testAddTestsFromDirectory()588 {589 $this590 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))591 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))592 ->and($this->calling($runner)->addTestsFromDirectory->doesNothing())593 ->then594 ->object($script->addTestsFromDirectory($directory = uniqid()))->isIdenticalTo($script)595 ->mock($runner)->call('addTestsFromDirectory')->withArguments($directory)->once()596 ;597 }598 public function testAddTestsFromDirectories()599 {600 $this601 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))602 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))603 ->and($this->calling($runner)->addTestsFromDirectory->doesNothing())604 ->then605 ->object($script->addTestsFromDirectories([$directory1 = uniqid(), $directory2 = uniqid()]))->isIdenticalTo($script)606 ->mock($runner)607 ->call('addTestsFromDirectory')608 ->withArguments($directory1)->once()609 ->withArguments($directory2)->once()610 ;611 }612 public function testAddTestsFromPattern()613 {614 $this615 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))616 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))617 ->and($this->calling($runner)->addTestsFromPattern->doesNothing())618 ->then619 ->object($script->addTestsFromPattern($pattern = uniqid()))->isIdenticalTo($script)620 ->mock($runner)->call('addTestsFromPattern')->withArguments($pattern)->once()621 ;622 }623 public function testAddTestsFromPatterns()624 {625 $this626 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))627 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))628 ->and($this->calling($runner)->addTestsFromPattern->doesNothing())629 ->then630 ->object($script->addTestsFromPatterns([$pattern1 = uniqid(), $pattern2 = uniqid()]))->isIdenticalTo($script)631 ->mock($runner)632 ->call('addTestsFromPattern')633 ->withArguments($pattern1)->once()634 ->withArguments($pattern2)->once()635 ;636 }637 public function testAcceptTestFileExtensions()638 {639 $this640 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))641 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))642 ->and($this->calling($runner)->acceptTestFileExtensions->doesNothing())643 ->then644 ->object($script->acceptTestFileExtensions($testFileExtensions = [uniqid(), uniqid()]))->isIdenticalTo($script)645 ->mock($runner)->call('acceptTestFileExtensions')->withArguments($testFileExtensions)->once()646 ;647 }648 public function testSetBootstrapFile()649 {650 $this651 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))652 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))653 ->and($this->calling($runner)->setBootstrapFile->doesNothing())654 ->then655 ->object($script->setBootstrapFile($bootstrapFile = uniqid()))->isIdenticalTo($script)656 ->mock($runner)->call('setBootstrapFile')->withArguments($bootstrapFile)->once()657 ;658 }659 public function testSetXdebugConfig()660 {661 $this662 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))663 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))664 ->and($this->calling($runner)->setXdebugConfig->doesNothing())665 ->then666 ->object($script->setXdebugConfig($xdebugConfig = uniqid()))->isIdenticalTo($script)667 ->mock($runner)->call('setXdebugConfig')->withArguments($xdebugConfig)->once()668 ;669 }670 public function testFailIfVoidMethods()671 {672 $this673 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))674 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))675 ->then676 ->object($script->failIfVoidMethods())->isIdenticalTo($script)677 ->mock($runner)->call('failIfVoidMethods')->once()678 ;679 }680 public function testDoNotFailIfVoidMethods()681 {682 $this683 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))684 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))685 ->then686 ->object($script->doNotFailIfVoidMethods())->isIdenticalTo($script)687 ->mock($runner)->call('doNotFailIfVoidMethods')->once()688 ;689 }690 public function testShouldFailIfVoidMethods()691 {692 $this693 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))694 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))695 ->then696 ->boolean($script->shouldFailIfVoidMethods())->isFalse()697 ->mock($runner)->call('shouldFailIfVoidMethods')->once()698 ->if($this->calling($runner)->shouldFailIfVoidMethods = true)699 ->then700 ->boolean($script->shouldFailIfVoidMethods())->isTrue()701 ->if($this->calling($runner)->shouldFailIfVoidMethods = false)702 ->then703 ->boolean($script->shouldFailIfVoidMethods())->isFalse()704 ;705 }706 public function testFailIfSkippedMethods()707 {708 $this709 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))710 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))711 ->then712 ->object($script->failIfSkippedMethods())->isIdenticalTo($script)713 ->mock($runner)->call('failIfSkippedMethods')->once()714 ;715 }716 public function testDoNotFailIfSkippedMethods()717 {718 $this719 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))720 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))721 ->then722 ->object($script->doNotFailIfSkippedMethods())->isIdenticalTo($script)723 ->mock($runner)->call('doNotFailIfSkippedMethods')->once()724 ;725 }726 public function testShouldFailIfSkippedMethods()727 {728 $this729 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))730 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))731 ->then732 ->boolean($script->shouldFailIfSkippedMethods())->isFalse()733 ->mock($runner)->call('shouldFailIfSkippedMethods')->once()734 ->if($this->calling($runner)->shouldFailIfSkippedMethods = true)735 ->then736 ->boolean($script->shouldFailIfSkippedMethods())->isTrue()737 ->if($this->calling($runner)->shouldFailIfSkippedMethods = false)738 ->then739 ->boolean($script->shouldFailIfSkippedMethods())->isFalse()740 ;741 }742 public function testEnableDebugMode()743 {744 $this745 ->if($script = new \mock\atoum\atoum\scripts\runner(uniqid()))746 ->and($script->setRunner($runner = new \mock\atoum\atoum\runner()))747 ->and($this->calling($runner)->enableDebugMode->doesNothing())748 ->then749 ->object($script->enableDebugMode())->isIdenticalTo($script)750 ->mock($runner)->call('enableDebugMode')->withoutAnyArgument()->once()751 ;752 }753 public function testAddDefaultArguments()754 {755 $this756 ->if($runner = new \mock\atoum\atoum\scripts\runner(uniqid()))757 ->then758 ->object($runner->addDefaultArguments($arg1 = uniqid()))->isInstanceOf($runner)759 ->boolean($runner->hasDefaultArguments())->isTrue()760 ->array($runner->getDefaultArguments())->isEqualTo([$arg1])761 ->object($runner->addDefaultArguments($arg2 = uniqid(), $arg3 = uniqid()))->isInstanceOf($runner)762 ->boolean($runner->hasDefaultArguments())->isTrue()763 ->array($runner->getDefaultArguments())->isEqualTo([$arg1, $arg2, $arg3])764 ;765 }766 public function testInit()767 {768 $this769 ->given($runner = new testedClass(__FILE__))770 ->and($runner->setAdapter($adapter = new atoum\test\adapter()))771 ->and($runner->setInfoWriter($outputWriter = new \mock\atoum\atoum\writers\std\out()))772 ->and($runner->setPrompt($prompt = new \mock\atoum\atoum\script\prompt()))773 ->and($adapter->copy = true)774 ->and($adapter->file_exists = false)775 ->and($this->calling($outputWriter)->write = function () {776 })777 ->then778 ->object($runner->init())->isIdenticalTo($runner)779 ->mock($prompt)780 ->call('ask')781 ->withArguments('Default configuration file \'' . testedClass::defaultConfigFile . '\' already exists in ' . $runner->getDirectory() . ', type \'Y\' to overwrite it...')->never()782 ->mock($outputWriter)783 ->call('write')784 ->withArguments('Default configuration file \'' . testedClass::defaultConfigFile . '\' was successfully created in ' . $runner->getDirectory())->once()785 ->withArguments('Default bootstrap file \'' . testedClass::defaultBootstrapFile . '\' was successfully created in ' . $runner->getDirectory())->once()786 ->adapter($adapter)787 ->call('copy')788 ->withArguments(atoum\directory . '/resources/configurations/runner/atoum.php.dist', getcwd() . DIRECTORY_SEPARATOR . testedClass::defaultConfigFile)->once()789 ->withArguments(atoum\directory . '/resources/configurations/runner/bootstrap.php.dist', getcwd() . DIRECTORY_SEPARATOR . testedClass::defaultBootstrapFile)->once()790 ->if($this->resetAdapter($adapter))791 ->and($this->resetMock($outputWriter))792 ->then793 ->object($runner->init($directory = uniqid()))->isIdenticalTo($runner)794 ->mock($prompt)795 ->call('ask')796 ->withArguments('Default configuration file \'' . testedClass::defaultConfigFile . '\' already exists in ' . $directory . ', type \'Y\' to overwrite it...')->never()797 ->mock($outputWriter)798 ->call('write')799 ->withArguments('Default configuration file \'' . testedClass::defaultConfigFile . '\' was successfully created in ' . $directory . DIRECTORY_SEPARATOR)->once()800 ->withArguments('Default bootstrap file \'' . testedClass::defaultBootstrapFile . '\' was successfully created in ' . $directory . DIRECTORY_SEPARATOR)->once()801 ->adapter($adapter)802 ->call('copy')803 ->withArguments(atoum\directory . '/resources/configurations/runner/atoum.php.dist', $directory . DIRECTORY_SEPARATOR . testedClass::defaultConfigFile)->once()804 ->withArguments(atoum\directory . '/resources/configurations/runner/bootstrap.php.dist', $directory . DIRECTORY_SEPARATOR . testedClass::defaultBootstrapFile)->once()805 ->if($this->resetAdapter($adapter))806 ->and($this->resetMock($outputWriter))807 ->and($adapter->file_exists = true)808 ->and($this->calling($prompt)->ask = 'Y')809 ->then810 ->object($runner->init())->isIdenticalTo($runner)811 ->mock($prompt)812 ->call('ask')813 ->withArguments('Default configuration file \'' . testedClass::defaultConfigFile . '\' already exists in ' . $runner->getDirectory() . ', type \'Y\' to overwrite it...')->once()814 ->withArguments('Default bootstrap file \'' . testedClass::defaultBootstrapFile . '\' already exists in ' . $runner->getDirectory() . ', type \'Y\' to overwrite it...')->once()815 ->mock($outputWriter)816 ->call('write')817 ->withArguments('Default configuration file \'' . testedClass::defaultConfigFile . '\' was successfully created in ' . $runner->getDirectory())->once()818 ->withArguments('Default bootstrap file \'' . testedClass::defaultBootstrapFile . '\' was successfully created in ' . $runner->getDirectory())->once()819 ->adapter($adapter)820 ->call('copy')821 ->withArguments(atoum\directory . '/resources/configurations/runner/atoum.php.dist', getcwd() . DIRECTORY_SEPARATOR . testedClass::defaultConfigFile)->once()822 ->withArguments(atoum\directory . '/resources/configurations/runner/bootstrap.php.dist', getcwd() . DIRECTORY_SEPARATOR . testedClass::defaultBootstrapFile)->once()823 ->if($this->resetAdapter($adapter))824 ->and($this->resetMock($outputWriter))825 ->and($this->resetMock($prompt))826 ->and($adapter->file_exists = true)827 ->and($this->calling($prompt)->ask = 'y')828 ->then829 ->object($runner->init())->isIdenticalTo($runner)830 ->mock($prompt)831 ->call('ask')832 ->withArguments('Default configuration file \'' . testedClass::defaultConfigFile . '\' already exists in ' . $runner->getDirectory() . ', type \'Y\' to overwrite it...')->once()833 ->withArguments('Default bootstrap file \'' . testedClass::defaultBootstrapFile . '\' already exists in ' . $runner->getDirectory() . ', type \'Y\' to overwrite it...')->once()834 ->mock($outputWriter)835 ->call('write')836 ->withArguments('Default configuration file \'' . testedClass::defaultConfigFile . '\' was successfully created in ' . $runner->getDirectory())->never()837 ->withArguments('Default bootstrap file \'' . testedClass::defaultBootstrapFile . '\' was successfully created in ' . $runner->getDirectory())->never()838 ->adapter($adapter)839 ->call('copy')840 ->withArguments(atoum\directory . '/resources/configurations/runner/atoum.php.dist', getcwd() . DIRECTORY_SEPARATOR . testedClass::defaultConfigFile)->never()841 ->withArguments(atoum\directory . '/resources/configurations/runner/bootstrap.php.dist', getcwd() . DIRECTORY_SEPARATOR . testedClass::defaultBootstrapFile)->never()842 ->if($this->resetAdapter($adapter))843 ->and($this->resetMock($outputWriter))844 ->and($this->resetMock($prompt))845 ->and($adapter->file_exists = true)846 ->and($this->calling($prompt)->ask = uniqid())847 ->then848 ->object($runner->init())->isIdenticalTo($runner)849 ->mock($prompt)850 ->call('ask')851 ->withArguments('Default configuration file \'' . testedClass::defaultConfigFile . '\' already exists in ' . $runner->getDirectory() . ', type \'Y\' to overwrite it...')->once()852 ->withArguments('Default bootstrap file \'' . testedClass::defaultBootstrapFile . '\' already exists in ' . $runner->getDirectory() . ', type \'Y\' to overwrite it...')->once()853 ->mock($outputWriter)854 ->call('write')855 ->withArguments('Default configuration file \'' . testedClass::defaultConfigFile . '\' was successfully created in ' . $runner->getDirectory() . PHP_EOL)->never()856 ->withArguments('Default bootstrap file \'' . testedClass::defaultBootstrapFile . '\' was successfully created in ' . $runner->getDirectory() . PHP_EOL)->never()857 ->adapter($adapter)858 ->call('copy')859 ->withArguments(atoum\directory . '/resources/configurations/runner/atoum.php.dist', __DIR__ . DIRECTORY_SEPARATOR . testedClass::defaultConfigFile)->never()860 ->withArguments(atoum\directory . '/resources/configurations/runner/bootstrap.php.dist', __DIR__ . DIRECTORY_SEPARATOR . testedClass::defaultBootstrapFile)->never()861 ->if($this->calling($prompt)->ask = 'Y')862 ->and($adapter->copy = false)863 ->then864 ->exception(function () use ($runner) {865 $runner->init();866 })867 ->isInstanceOf(atoum\exceptions\runtime::class)868 ->hasMessage('Unable to write \'' . atoum\directory . '/resources/configurations/runner/atoum.php.dist\' to \'' . getcwd() . DIRECTORY_SEPARATOR . testedClass::defaultConfigFile . '\'')869 ;870 }871 public function testSetInfoWriter()872 {873 $this874 ->given($runner = new testedClass(uniqid()))875 ->then876 ->object($runner->setInfoWriter($errorWriter = new atoum\writers\std\err()))->isIdenticalTo($runner)877 ->object($runner->getInfoWriter())->isIdenticalTo($errorWriter)878 ->given(879 $defaultInfoWriter = new atoum\writers\std\out(),880 $defaultInfoWriter881 ->addDecorator(new writer\decorators\rtrim())882 ->addDecorator(new writer\decorators\eol())883 ->addDecorator(new atoum\cli\clear())884 ->addDecorator(new cli\colorizer('0;32'))885 )886 ->then887 ->object($runner->setInfoWriter())->isIdenticalTo($runner)888 ->object($runner->getInfoWriter())->isEqualTo($defaultInfoWriter)889 ;890 }891 public function testSetWarningWriter()892 {893 $this894 ->given($runner = new testedClass(uniqid()))895 ->then896 ->object($runner->setWarningWriter($warningWriter = new atoum\writers\std\err()))->isIdenticalTo($runner)897 ->object($runner->getWarningWriter())->isIdenticalTo($warningWriter)898 ->given($colorizer = new cli\colorizer('0;33'))899 ->and($colorizer->setPattern('/^([^:]+:)/'))900 ->and($defaultWarningWriter = new atoum\writers\std\err())901 ->and($defaultWarningWriter->addDecorator($colorizer))902 ->then903 ->object($runner->setWarningWriter())->isIdenticalTo($runner)904 ->object($runner->getWarningWriter())->isEqualTo($defaultWarningWriter)905 ;906 }907 public function testSetErrorWriter()908 {909 $this910 ->given($runner = new testedClass(uniqid()))911 ->then912 ->object($runner->setErrorWriter($errorWriter = new atoum\writers\std\err()))->isIdenticalTo($runner)913 ->object($runner->getErrorWriter())->isIdenticalTo($errorWriter)914 ->given(915 $colorizer = new cli\colorizer('0;31'),916 $colorizer->setPattern('/^([^:]+:)/'),917 $defaultErrorWriter = new atoum\writers\std\err(),918 $defaultErrorWriter919 ->addDecorator(new writer\decorators\trim())920 ->addDecorator(new writer\decorators\prompt($runner->getLocale()->_('Error: ')))921 ->addDecorator(new writer\decorators\eol())922 ->addDecorator(new atoum\cli\clear())923 ->addDecorator($colorizer)924 )925 ->then926 ->object($runner->setErrorWriter())->isIdenticalTo($runner)927 ->object($runner->getErrorWriter())->isEqualTo($defaultErrorWriter)928 ;929 }930 public function testHelp()931 {932 $this933 ->if($argumentsParser = new mock\script\arguments\parser())934 ->and($this->calling($argumentsParser)->addHandler = function () {935 })936 ->and($locale = new mock\locale())937 ->and($this->calling($locale)->_ = function ($string) {938 return vsprintf($string, array_slice(func_get_args(), 1));939 })940 ->and($helpWriter = new mock\writers\std\out())941 ->and($this->calling($helpWriter)->write = function () {942 })943 ->and($runner = new testedClass($name = uniqid()))944 ->and($runner->setArgumentsParser($argumentsParser))945 ->and($runner->setLocale($locale))946 ->and($runner->setHelpWriter($helpWriter))947 ->then948 ->object($runner->help())->isIdenticalTo($runner)949 ->mock($helpWriter)->call('write')950 ->atLeastOnce()951 ->withArguments('Usage: ' . $name . ' [path/to/test/file] [options]' . PHP_EOL)->once()952 ;953 }954 public function testRun()955 {956 $this957 ->if($locale = new mock\locale())958 ->and($this->calling($locale)->_ = function ($string) {959 return $string;960 })961 ->and($helpWriter = new mock\writers\std\out())962 ->and($this->calling($helpWriter)->write = function () {963 })964 ->and($errorWriter = new mock\writers\std\err())965 ->and($this->calling($errorWriter)->clear = $errorWriter)966 ->and($this->calling($errorWriter)->write = $errorWriter)967 ->and($runner = new mock\runner())968 ->and($this->calling($runner)->getTestPaths = [])969 ->and($this->calling($runner)->getDeclaredTestClasses = [])970 ->and($this->calling($runner)->run = function () {971 })972 ->and($script = new testedClass($name = uniqid()))973 ->and($script->setLocale($locale))974 ->and($script->setHelpWriter($helpWriter))975 ->and($script->setErrorWriter($errorWriter))976 ->and($script->setRunner($runner))977 ->then978 ->object($script->run())->isIdenticalTo($script)979 ->mock($locale)980 ->call('_')981 ->withArguments('No test found')->once()982 ->mock($errorWriter)->call('write')->withArguments('No test found')->once()983 ;984 }985 public function testAutorun()986 {987 $this988 ->if($script = new testedClass(uniqid()))989 ->and($script->setAdapter($adapter = new atoum\test\adapter()))990 ->and($adapter->realpath = function ($path) {...
DoctrineMigrationQueryBuilder.php
Source:DoctrineMigrationQueryBuilder.php
...32 */33 public function update($relation, ?string $alias = null): UpdateQuery34 {35 $query = new UpdateQuery($relation, $alias);36 $query->setRunner($this->migrationRunner);37 return $query;38 }39 /**40 * {@inheritdoc}41 */42 public function insert($relation): InsertQuery43 {44 $query = new InsertQuery($relation);45 $query->setRunner($this->migrationRunner);46 return $query;47 }48 /**49 * {@inheritdoc}50 */51 public function insertValues($relation): InsertQuery52 {53 $query = new InsertQuery($relation);54 $query->setRunner($this->migrationRunner);55 return $query;56 }57 /**58 * {@inheritdoc}59 */60 public function insertQuery($relation): InsertQuery61 {62 $query = new InsertQuery($relation);63 $query->setRunner($this->migrationRunner);64 return $query;65 }66 /**67 * {@inheritdoc}68 */69 public function delete($relation, ?string $alias = null): DeleteQuery70 {71 $query = new DeleteQuery($relation, $alias);72 $query->setRunner($this->migrationRunner);73 return $query;74 }75 /**76 * {@inheritdoc}77 */78 public function merge($relation): MergeQuery79 {80 $query = new MergeQuery($relation);81 $query->setRunner($this->migrationRunner);82 return $query;83 }84 /**85 * {@inheritdoc}86 */87 public function upsertQuery($relation): MergeQuery88 {89 $query = new MergeQuery($relation);90 $query->setRunner($this->migrationRunner);91 return $query;92 }93 /**94 * {@inheritdoc}95 */96 public function upsertValues($relation): MergeQuery97 {98 $query = new MergeQuery($relation);99 $query->setRunner($this->migrationRunner);100 return $query;101 }102 /**103 * {@inheritdoc}104 */105 public function prepare(callable $callback, ?string $identifier = null): Query106 {107 throw new \BadMethodCallException("%s::prepare() is not supported during migrations", QueryBuilder::class);108 }109}...
CheckTest.php
Source:CheckTest.php
...40 public function testClassExists() {41 $check = new ClassExists( __CLASS__ );42 self::assertTrue( $check->check() );43 $check = new ClassExists( 'nonexistingname' );44 $check->setRunner( $this->runner );45 self::assertInstanceOf( WP_Error::class, $check->check() );46 $check = new ClassExists( [ __CLASS__, WP_Error::class ] );47 $check->setRunner( $this->runner );48 self::assertTrue( $check->check() );49 }50 public function testPHPVersion() {51 $check = new PHPVersion( PHP_VERSION );52 self::assertTrue( $check->check() );53 $check = new PHPVersion( PHP_VERSION, '=' );54 self::assertTrue( $check->check() );55 $check = new PHPVersion( PHP_VERSION, '<' );56 $check->setRunner( $this->runner );57 self::assertInstanceOf( WP_Error::class, $check->check() );58 }59 public function testCallback(): void {60 $check1 = new Callback(61 function() {62 return true;63 }64 );65 self::assertTrue( $check1->check() );66 $check2 = new Callback(67 function() {68 return new WP_Error( 'example', 'Failed' );69 }70 );71 $check2->setRunner( $this->runner );72 self::assertInstanceOf( WP_Error::class, $check2->check() );73 }74 public function testExtensionLoaded() {75 $allExtensions = get_loaded_extensions();76 $ext1 = $allExtensions[ array_rand( $allExtensions ) ];77 $check = new ExtensionLoaded( $ext1 );78 self::assertTrue( $check->check() );79 $check = new ExtensionLoaded( 'fakeextension' );80 $check->setRunner( $this->runner );81 self::assertInstanceOf( WP_Error::class, $check->check() );82 }83 public function testWPVersion() {84 $check = new WPVersion( '5.7' );85 self::assertTrue( $check->check() );86 $check = new WPVersion( '5.6', '<' );87 $check->setRunner( $this->runner );88 self::assertInstanceOf( WP_Error::class, $check->check() );89 }90}...
setRunner
Using AI Code Generation
1$runner = new Runner();2$runner->setRunner("Sachin Tendulkar");3$runner = new Runner();4echo $runner->getRunner();5$runner = new Runner();6$runner->setRunner("Sachin Tendulkar");7$runner = new Runner();8echo $runner->getRunner();
setRunner
Using AI Code Generation
1$runner = new Runner();2$runner->setRunner("Sachin");3echo $runner->getRunner();4$runner = new Runner();5$runner->setRunner("Sachin");6echo $runner->getRunner();7namespace Runner;8class Runner {9 private $runner;10 public function setRunner($runner) {11 $this->runner = $runner;12 }13 public function getRunner() {14 return $this->runner;15 }16}17$runner = new Runner\Runner();18$runner->setRunner("Sachin");19echo $runner->getRunner();20$runner = new Runner\Runner();21$runner->setRunner("Sachin");22echo $runner->getRunner();23namespace Runner;24class Runner {25 private $runner;26 public function setRunner($runner) {27 $this->runner = $runner;28 }29 public function getRunner() {30 return $this->runner;31 }32}33$runner = new Runner();34$runner->setRunner("Sachin");35echo $runner->getRunner();
setRunner
Using AI Code Generation
1$runner = new Runner();2$runner->setRunner("John");3$runner = new Runner();4$runner->setRunner("Mark");5$runner = new Runner();6$runner->setRunner("Peter");7$runner = new Runner();8$runner->setRunner("Sam");9$runner = new Runner();10$runner->setRunner("Tom");11$runner = new Runner();12$runner->setRunner("John");13$runner = new Runner();14$runner->setRunner("Mark");15$runner = new Runner();16$runner->setRunner("Peter");17$runner = new Runner();18$runner->setRunner("Sam");19$runner = new Runner();20$runner->setRunner("Tom");21$runner = new Runner();22$runner->setRunner("John");23$runner = new Runner();24$runner->setRunner("Mark");25$runner = new Runner();26$runner->setRunner("Peter");27$runner = new Runner();28$runner->setRunner("Sam");29$runner = new Runner();30$runner->setRunner("Tom");31$runner = new Runner();32$runner->setRunner("John");
setRunner
Using AI Code Generation
1$runner = new Runner("John");2$runner->setRunner("Mike");3$runner = new Runner("John");4$runner->setRunner("Mike");5$runner = new Runner("John");6$runner->setRunner("Mike");7$runner = new Runner("John");8$runner->setRunner("Mike");9$runner = new Runner("John");10$runner->setRunner("Mike");11$runner = new Runner("John");12$runner->setRunner("Mike");13$runner = new Runner("John");14$runner->setRunner("Mike");15$runner = new Runner("John");16$runner->setRunner("Mike");17$runner = new Runner("John");18$runner->setRunner("Mike");19$runner = new Runner("John");20$runner->setRunner("Mike");21$runner = new Runner("John");22$runner->setRunner("Mike");23$runner = new Runner("John");24$runner->setRunner("Mike");25$runner = new Runner("John");26$runner->setRunner("Mike");27$runner = new Runner("John");28$runner->setRunner("Mike");29$runner = new Runner("John");30$runner->setRunner("Mike");
setRunner
Using AI Code Generation
1require_once 'runner.php';2$runner = new runner();3$runner->setRunner('Runner 1');4echo $runner->getRunner();5require_once 'runner.php';6$runner = new runner();7$runner->setRunner('Runner 2');8echo $runner->getRunner();9echo $_SERVER['PHP_SELF'];10echo $_SERVER['REQUEST_URI'];11echo $_SERVER['PHP_SELF'];12$result = parse_url($url);13print_r($result);
setRunner
Using AI Code Generation
1$runner = new Runner();2$runner->setRunner("John", "Doe", 20);3echo $runner->getRunner();4$runner = new Runner();5echo $runner->getRunner();6class ChildClass extends ParentClass {7}8class Runner {9 public $firstname;10 public $lastname;11 public $age;12 public function setRunner($fname, $lname, $age) {13 $this->firstname = $fname;14 $this->lastname = $lname;15 $this->age = $age;16 }17}18class MarathonRunner extends Runner {19}20class Runner {21 public $firstname;22 public $lastname;23 public $age;24 public function setRunner($fname, $lname, $age) {25 $this->firstname = $fname;26 $this->lastname = $lname;27 $this->age = $age;28 }29}30class MarathonRunner extends Runner {31 public function getRunner() {
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with setRunner on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!