Best Atoum code snippet using dataProviderTest.testGetTestedClassName
test.php
Source:test.php
...451 ->then452 ->string($test->getTestMethodPrefix())->isEqualTo($testMethodPrefix)453 ;454 }455 public function testGetTestedClassName()456 {457 $mockClass = '\mock\\' . __CLASS__;458 $this459 ->if($test = new $mockClass())460 ->and($test->getMockController()->getClass = $testClass = 'foo')461 ->then462 ->exception(function() use ($test) { $test->getTestedClassName(); })463 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')464 ->hasMessage('Test class \'' . $testClass . '\' is not in a namespace which match pattern \'' . $test->getTestNamespace() . '\'')465 ->if($test->getMockController()->getClass = 'tests\units\foo')466 ->then467 ->string($test->getTestedClassName())->isEqualTo('foo')468 ;469 }470 public function testGetTestedClassPath()471 {472 $this473 ->if($testedClass = new \reflectionClass($this->getTestedClassName()))474 ->then475 ->string($this->getTestedClassPath())->isEqualTo($testedClass->getFilename())476 ;477 }478 public function testGetAdapter()479 {480 $this481 ->if($test = new emptyTest())482 ->then483 ->object($test->getAdapter())->isInstanceOf('mageekguy\atoum\adapter')484 ;485 }486 public function testSetAdapter()487 {488 $this489 ->if($test = new emptyTest())490 ->then491 ->object($test->setAdapter($adapter = new atoum\test\adapter()))->isIdenticalTo($test)492 ->object($test->getAdapter())->isIdenticalTo($adapter)493 ;494 }495 public function testSetLocale()496 {497 $this498 ->if($test = new emptyTest())499 ->then500 ->object($test->setLocale($locale = new atoum\locale()))->isIdenticalTo($test)501 ->object($test->getLocale())->isIdenticalTo($locale)502 ;503 }504 public function testSetScore()505 {506 $this507 ->if($test = new emptyTest())508 ->then509 ->object($test->setScore($score = new atoum\test\score()))->isIdenticalTo($test)510 ->object($test->getScore())->isIdenticalTo($score)511 ;512 }513 public function testSetBootstrapFile()514 {515 $this516 ->if($test = new emptyTest())517 ->then518 ->object($test->setBootstrapFile($path = uniqid()))->isIdenticalTo($test)519 ->string($test->getBootstrapFile())->isEqualTo($path)520 ;521 }522 public function testSetMaxChildrenNumber()523 {524 $this525 ->if($test = new emptyTest())526 ->then527 ->exception(function() use ($test) { $test->setMaxChildrenNumber(- rand(1, PHP_INT_MAX)); })528 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')529 ->hasMessage('Maximum number of children must be greater or equal to 1')530 ->exception(function() use ($test) { $test->setMaxChildrenNumber(0); })531 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')532 ->hasMessage('Maximum number of children must be greater or equal to 1')533 ->object($test->setMaxChildrenNumber($maxChildrenNumber = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)534 ->integer($test->getMaxChildrenNumber())->isEqualTo($maxChildrenNumber)535 ->object($test->setMaxChildrenNumber((string) $maxChildrenNumber = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)536 ->integer($test->getMaxChildrenNumber())->isEqualTo($maxChildrenNumber)537 ;538 }539 public function testGetClass()540 {541 $this542 ->if($test = new emptyTest())543 ->then544 ->string($test->getClass())->isEqualTo(__NAMESPACE__ . '\emptyTest')545 ;546 }547 public function testGetPath()548 {549 $this550 ->if($test = new emptyTest())551 ->then552 ->string($test->getPath())->isEqualTo(__FILE__)553 ;554 }555 public function testGetCoverage()556 {557 $this558 ->if($test = new emptyTest())559 ->then560 ->object($test->getCoverage())->isIdenticalTo($test->getScore()->getCoverage())561 ;562 }563 public function testIsIgnored()564 {565 $this566 ->if($test = new emptyTest())567 ->then568 ->boolean($test->isIgnored())->isTrue()569 ->object($test->ignore(false))->isIdenticalTo($test)570 ->boolean($test->isIgnored())->isTrue()571 ->object($test->ignore(true))->isIdenticalTo($test)572 ->boolean($test->isIgnored())->isTrue()573 ->if($test = new notEmptyTest())574 ->then575 ->boolean($test->isIgnored())->isTrue()576 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()577 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()578 ->object($test->ignore(false))->isIdenticalTo($test)579 ->boolean($test->isIgnored())->isFalse()580 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()581 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()582 ->object($test->ignore(true))->isIdenticalTo($test)583 ->boolean($test->isIgnored())->isTrue()584 ->boolean($test->methodIsIgnored('testMethod1'))->istrue()585 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()586 ;587 }588 public function testGetCurrentMethod()589 {590 $this591 ->if($test = new emptyTest())592 ->then593 ->variable($test->getCurrentMethod())->isNull()594 ;595 }596 public function testCount()597 {598 $this599 ->sizeOf(new emptyTest())->isEqualTo(0)600 ->if($test = new notEmptyTest())601 ->then602 ->sizeOf($test)->isEqualTo(0)603 ->if($test->ignore(false))604 ->then605 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()606 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()607 ->sizeOf($test)->isEqualTo(2)608 ->if($test->ignoreMethod('testMethod1', true))609 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()610 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()611 ->sizeOf($test)->isEqualTo(1)612 ->if($test->ignoreMethod('testMethod2', true))613 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()614 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()615 ->sizeOf($test)->isEqualTo(0)616 ;617 }618 public function testGetTestMethods()619 {620 $this621 ->if($test = new emptyTest())622 ->then623 ->boolean($test->ignore(false)->isIgnored())->isTrue()624 ->sizeOf($test)->isZero()625 ->array($test->getTestMethods())->isEmpty()626 ->if($test = new notEmptyTest())627 ->then628 ->boolean($test->isIgnored())->isTrue()629 ->boolean($test->methodIsIgnored('testMethod1'))->isTrue()630 ->boolean($test->methodIsIgnored('testMethod2'))->isTrue()631 ->sizeOf($test)->isEqualTo(0)632 ->array($test->getTestMethods())->isEmpty()633 ->boolean($test->ignore(false)->isIgnored())->isFalse()634 ->boolean($test->methodIsIgnored('testMethod1'))->isFalse()635 ->boolean($test->methodIsIgnored('testMethod2'))->isFalse()636 ->sizeOf($test)->isEqualTo(2)637 ->array($test->getTestMethods())->isEqualTo(array('testMethod1', 'testMethod2'))638 ->array($test->getTestMethods(array('method')))->isEqualTo(array('testMethod1', 'testMethod2'))639 ->array($test->getTestMethods(array('test')))->isEqualTo(array('testMethod1', 'testMethod2'))640 ->array($test->getTestMethods(array('two')))->isEqualTo(array('testMethod2'))641 ->array($test->getTestMethods(array(uniqid())))->isEmpty()642 ->array($test->getTestMethods(array('test', 'method')))->isEqualTo(array('testMethod1', 'testMethod2'))643 ->array($test->getTestMethods(array('test', 'method', uniqid())))->isEqualTo(array('testMethod1', 'testMethod2'))644 ->array($test->getTestMethods(array('test', 'method', 'two', uniqid())))->isEqualTo(array('testMethod1', 'testMethod2'))645 ;646 }647 public function testGetPhpPath()648 {649 $this650 ->if($test = new emptyTest())651 ->then652 ->variable($test->getPhpPath())->isNull()653 ->if($test->setPhpPath($phpPath = uniqid()))654 ->then655 ->string($test->getPhpPath())->isEqualTo($phpPath)656 ;657 }658 public function testSetPhpPath()659 {660 $this661 ->if($test = new emptyTest())662 ->then663 ->object($test->setPhpPath($phpPath = uniqid()))->isIdenticalTo($test)664 ->string($test->getPhpPath())->isIdenticalTo($phpPath)665 ->object($test->setPhpPath($phpPath = rand(1, PHP_INT_MAX)))->isIdenticalTo($test)666 ->string($test->getPhpPath())->isIdenticalTo((string) $phpPath)667 ;668 }669 public function testMethodIsIgnored()670 {671 $this672 ->if($test = new emptyTest())673 ->then674 ->exception(function() use ($test, & $method) { $test->methodIsIgnored($method = uniqid()); })675 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')676 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')677 ;678 }679 public function testSetTags()680 {681 $this682 ->if($test = new emptyTest())683 ->then684 ->object($test->setTags($tags = array(uniqid(), uniqid())))->isIdenticalTo($test)685 ->array($test->getTags())->isEqualTo($tags)686 ;687 }688 public function testSetMethodTags()689 {690 $this691 ->if($test = new notEmptyTest())692 ->then693 ->object($test->setMethodTags('testMethod1', $tags = array(uniqid(), uniqid())))->isIdenticalTo($test)694 ->array($test->getMethodTags('testMethod1'))->isEqualTo($tags)695 ->exception(function() use ($test, & $method) { $test->setMethodTags($method = uniqid(), array()); })696 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')697 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')698 ;699 }700 public function testGetMethodTags()701 {702 $this703 ->if($test = new notEmptyTest())704 ->then705 ->array($test->getMethodTags('testMethod1'))->isEqualTo(array('test', 'method', 'one'))706 ->exception(function() use ($test, & $method) { $test->getMethodTags($method = uniqid()); })707 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')708 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')709 ->if($test = new inheritedTagsTest())710 ->then711 ->array($test->getMethodTags())->isEqualTo(array('testMethod1' => array('first', 'second', 'third'), 'testMethod2' => array('first', 'second', 'third')))712 ->array($test->getMethodTags('testMethod1'))->isEqualTo(array('first', 'second', 'third'))713 ->array($test->getMethodTags('testMethod2'))->isEqualTo(array('first', 'second', 'third'))714 ->if($test = new dataProviderTest())715 ->then716 ->array($test->getMethodTags())->isEqualTo(array('testMethod1' => array(), 'testMethod2' => array(), 'testMethod3' => array()))717 ->array($test->getMethodTags('testMethod1'))->isEqualTo(array())718 ->array($test->getMethodTags('testMethod2'))->isEqualTo(array())719 ->array($test->getMethodTags('testMethod3'))->isEqualTo(array())720 ;721 }722 public function testAddMandatoryClassExtension()723 {724 $this725 ->if($test = new notEmptyTest())726 ->then727 ->object($test->addMandatoryClassExtension($extension = uniqid()))->isIdenticalTo($test)728 ->array($test->getMandatoryClassExtensions())->isEqualTo(array($extension))729 ->object($test->addMandatoryClassExtension($otherExtension = uniqid()))->isIdenticalTo($test)730 ->array($test->getMandatoryClassExtensions())->isEqualTo(array($extension, $otherExtension))731 ;732 }733 public function testGetMandatoryMethodExtensions()734 {735 $this736 ->if($test = new notEmptyTest())737 ->then738 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEmpty()739 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(array('mbstring', 'socket'))740 ;741 }742 public function testAddMandatoryMethodExtension()743 {744 $this745 ->if($test = new notEmptyTest())746 ->then747 ->exception(function() use ($test, & $method) { $test->addMandatoryMethodExtension($method = uniqid(), uniqid()); })748 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')749 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')750 ->object($test->addMandatoryMethodExtension('testMethod1', $extension = uniqid()))->isIdenticalTo($test)751 ->array($test->getMandatoryMethodExtensions())->isEqualTo(array('testMethod1' => array($extension), 'testMethod2' => array('mbstring', 'socket')))752 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo(array($extension))753 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(array('mbstring', 'socket'))754 ->object($test->addMandatoryMethodExtension('testMethod1', $otherExtension = uniqid()))->isIdenticalTo($test)755 ->array($test->getMandatoryMethodExtensions())->isEqualTo(array('testMethod1' => array($extension, $otherExtension), 'testMethod2' => array('mbstring', 'socket')))756 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo(array($extension, $otherExtension))757 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(array('mbstring', 'socket'))758 ->object($test->addMandatoryMethodExtension('testMethod2', $anOtherExtension = uniqid()))->isIdenticalTo($test)759 ->array($test->getMandatoryMethodExtensions())->isEqualTo(array('testMethod1' => array($extension, $otherExtension), 'testMethod2' => array('mbstring', 'socket', $anOtherExtension)))760 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo(array($extension, $otherExtension))761 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(array('mbstring', 'socket', $anOtherExtension))762 ->if($test->addMandatoryClassExtension($classExtension = uniqid()))763 ->then764 ->array($test->getMandatoryMethodExtensions())->isEqualTo(array('testMethod1' => array($classExtension, $extension, $otherExtension), 'testMethod2' => array($classExtension, 'mbstring', 'socket', $anOtherExtension)))765 ->array($test->getMandatoryMethodExtensions('testMethod1'))->isEqualTo(array($classExtension, $extension, $otherExtension))766 ->array($test->getMandatoryMethodExtensions('testMethod2'))->isEqualTo(array($classExtension, 'mbstring', 'socket', $anOtherExtension))767 ;768 }769 public function testAddClassPhpVersion()770 {771 $this772 ->if($test = new notEmptyTest())773 ->then774 ->object($test->addClassPhpVersion('5.3'))->isIdenticalTo($test)775 ->array($test->getClassPhpVersions())->isEqualTo(array('5.3' => '>='))776 ->object($test->addClassPhpVersion('5.4', '<='))->isIdenticalTo($test)777 ->array($test->getClassPhpVersions())->isEqualTo(array('5.3' => '>=', '5.4' => '<='))778 ;779 }780 public function testAddMethodPhpVersion()781 {782 $this783 ->if($test = new notEmptyTest())784 ->then785 ->exception(function() use ($test, & $method) { $test->addMethodPhpVersion($method, '6.0'); })786 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')787 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')788 ->object($test->addMethodPhpVersion('testMethod1', '5.3'))->isIdenticalTo($test)789 ->array($test->getMethodPhpVersions())->isEqualTo(array('testMethod1' => array('5.3' => '>='), 'testMethod2' => array()))790 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(array('5.3' => '>='))791 ->array($test->getMethodPhpVersions('testMethod2'))->isEmpty()792 ->object($test->addMethodPhpVersion('testMethod1', '5.4', '<='))->isIdenticalTo($test)793 ->array($test->getMethodPhpVersions())->isEqualTo(array('testMethod1' => array('5.3' => '>=', '5.4' => '<='), 'testMethod2' => array()))794 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(array('5.3' => '>=', '5.4' => '<='))795 ->array($test->getMethodPhpVersions('testMethod2'))->isEmpty()796 ->object($test->addMethodPhpVersion('testMethod2', '5.4', '>='))->isIdenticalTo($test)797 ->array($test->getMethodPhpVersions())->isEqualTo(array('testMethod1' => array('5.3' => '>=', '5.4' => '<='), 'testMethod2' => array('5.4' => '>=')))798 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(array('5.3' => '>=', '5.4' => '<='))799 ->array($test->getMethodPhpVersions('testMethod2'))->isEqualTo(array('5.4' => '>='))800 ->if($test->addClassPhpVersion('5.5'))801 ->then802 ->array($test->getMethodPhpVersions())->isEqualTo(array('testMethod1' => array('5.5' => '>=', '5.3' => '>=', '5.4' => '<='), 'testMethod2' => array('5.5' => '>=', '5.4' => '>=')))803 ->array($test->getMethodPhpVersions('testMethod1'))->isEqualTo(array('5.5' => '>=', '5.3' => '>=', '5.4' => '<='))804 ->array($test->getMethodPhpVersions('testMethod2'))->isEqualTo(array('5.5' => '>=', '5.4' => '>='))805 ;806 }807 public function testRun()808 {809 $this810 ->mockTestedClass('mock\tests\units')811 ->if($test = new \mock\tests\units\test())812 ->then813 ->object($test->run())->isIdenticalTo($test)814 ->mock($test)815 ->call('callObservers')816 ->withArguments(\mageekguy\atoum\test::runStart)->never()817 ->withArguments(\mageekguy\atoum\test::runStop)->never()818 ->withArguments(\mageekguy\atoum\test::beforeSetUp)->never()819 ->withArguments(\mageekguy\atoum\test::afterSetUp)->never()820 ->withArguments(\mageekguy\atoum\test::beforeTestMethod)->never()821 ->withArguments(\mageekguy\atoum\test::afterTestMethod)->never()822 ;823 }824 public function testSetTestedClassName()825 {826 $this827 ->if($test = new foo())828 ->then829 ->string($test->getTestedClassName())->isEqualTo('mageekguy\atoum\test')830 ->exception(function() use ($test) { $test->setTestedClassName(uniqid()); })831 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')832 ->hasMessage('Tested class name is already defined')833 ->if($test = new self())834 ->then835 ->object($test->setTestedClassName($class = uniqid()))->isIdenticalTo($test)836 ->string($test->getTestedClassName())->isEqualTo($class)837 ->exception(function() use ($test) { $test->setTestedClassName(uniqid()); })838 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')839 ->hasMessage('Tested class name is already defined')840 ;841 }842 public function testMockClass()843 {844 $this845 ->if($test = new emptyTest())846 ->then847 ->object($test->mockClass(__CLASS__))->isIdenticalTo($test)848 ->class('mock\\' . __CLASS__)->isSubClassOf(__CLASS__)849 ->object($test->mockClass(__CLASS__, 'foo'))->isIdenticalTo($test)850 ->class('foo\test')->isSubClassOf(__CLASS__)851 ->object($test->mockClass(__CLASS__, 'foo\bar'))->isIdenticalTo($test)852 ->class('foo\bar\test')->isSubClassOf(__CLASS__)853 ->object($test->mockClass(__CLASS__, 'foo', 'bar'))->isIdenticalTo($test)854 ->class('foo\bar')->isSubClassOf(__CLASS__)855 ;856 }857 public function testMockTestedClass()858 {859 $this860 ->if($test = new emptyTest())861 ->and($testedClassName = $test->getTestedClassName())862 ->then863 ->object($test->mockTestedClass())->isIdenticalTo($test)864 ->class('mock\\' . $testedClassName)->isSubClassOf($testedClassName)865 ->object($test->mockTestedClass('foo'))->isIdenticalTo($test)866 ->class('foo\emptyTest')->isSubClassOf($testedClassName)867 ->object($test->mockTestedClass('foo\bar'))->isIdenticalTo($test)868 ->class('foo\bar\emptyTest')->isSubClassOf($testedClassName)869 ->object($test->mockTestedClass('foo', 'bar'))->isIdenticalTo($test)870 ->class('foo\bar')->isSubClassOf($testedClassName)871 ;872 }873 public function testGetTaggedTestMethods()874 {875 $this876 ->if($test = new emptyTest())877 ->then878 ->array($test->getTaggedTestMethods(array()))->isEmpty()879 ->array($test->getTaggedTestMethods(array(uniqid())))->isEmpty()880 ->array($test->getTaggedTestMethods(array(uniqid(), uniqid())))->isEmpty()881 ->if($test = new notEmptyTest())882 ->then883 ->array($test->getTaggedTestMethods(array()))->isEmpty()884 ->array($test->getTaggedTestMethods(array(uniqid())))->isEmpty()885 ->array($test->getTaggedTestMethods(array(uniqid(), uniqid())))->isEmpty()886 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod1', uniqid())))->isEmpty()887 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod1', uniqid(), 'testMethod2')))->isEmpty()888 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2')))->isEmpty()889 ->if($test->ignore(false))890 ->then891 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod1', uniqid())))->isEqualTo(array('testMethod1'))892 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod2', uniqid())))->isEqualTo(array('testMethod2'))893 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2')))->isEqualTo(array('Testmethod1', 'Testmethod2'))894 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2'), array('one')))->isEqualTo(array('Testmethod1'))895 ->if($test->ignoreMethod('testMethod1', true))896 ->then897 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod1', uniqid())))->isEmpty()898 ->array($test->getTaggedTestMethods(array(uniqid(), 'testMethod2', uniqid())))->isEqualTo(array('testMethod2'))899 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2')))->isEqualTo(array('Testmethod2'))900 ->array($test->getTaggedTestMethods(array(uniqid(), 'Testmethod1', uniqid(), 'Testmethod2'), array('one')))->isEmpty()901 ;902 }903 public function testSetDataProvider()904 {905 $this906 ->if($test = new emptyTest())907 ->then908 ->exception(function() use ($test, & $method) { $test->setDataProvider($method = uniqid(), uniqid()); })909 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')910 ->hasMessage('Test method ' . get_class($test) . '::' . $method . '() does not exist')911 ->if($test = new notEmptyTest())912 ->then913 ->exception(function() use ($test, & $dataProvider) { $test->setDataProvider('testMethod1', $dataProvider = uniqid()); })914 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')915 ->hasMessage('Data provider ' . get_class($test) . '::' . $dataProvider . '() is unknown')916 ->object($test->setDataProvider('testMethod1', 'aDataProvider'))->isIdenticalTo($test)917 ->array($test->getDataProviders())->isEqualTo(array('testMethod1' => 'aDataProvider'))918 ->if($test = new dataProviderTest())919 ->then920 ->object($test->setDataProvider('testMethod2'))->isIdenticalTo($test)921 ->array($providers = $test->getDataProviders())922 ->object['testMethod2']->isInstanceOf('mageekguy\atoum\test\data\provider\aggregator')923 ->exception(function() use ($providers) { $providers['testMethod2'](); })924 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')925 ->hasMessage('Could not instanciate a mock from ' . $test->getMockGenerator()->getDefaultNamespace() . '\\SplFileInfo because SplFileInfo::__construct() has at least one mandatory argument')926 ->if($test->getMockGenerator()->allIsInterface())927 ->then928 ->exception(function() use ($providers) { $providers['testMethod2'](); })929 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')930 ->hasMessage('Could not instanciate a mock from ' . $test->getMockGenerator()->getDefaultNamespace() . '\\SplFileInfo because SplFileInfo::__construct() has at least one mandatory argument')931 ->if($test->getMockGenerator()->setDefaultNamespace('testMocks'))932 ->then933 ->array($providers['testMethod2']())->isEqualTo(array(array(new \testMocks\splFileInfo())))934 ->if($test = new dataProviderTest())935 ->then936 ->exception(function() use ($test, & $dataProvider) { $test->setDataProvider('testMethod3'); })937 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')938 ->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')939 ->object($test->setDataProvider('testMethod1'))->isIdenticalTo($test)940 ->array($test->getDataProviders())941 ->object['testMethod1']->isInstanceOf('mageekguy\atoum\test\data\provider\aggregator')942 ->if($test = new dataProviderTest())943 ->then944 ->exception(function() use ($test, & $dataProvider) { $test->setDataProvider('testMethod3', function() {}); })945 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')946 ->hasMessage('Cannot use a closure as a data provider for method ' . get_class($test) . '::testMethod3()')947 ;948 }949 public function testCalling()950 {951 $this952 ->if($test = new emptyTest())953 ->and($mock = new \mock\foo())954 ->and($test->calling($mock)->bar = $value = uniqid())955 ->then956 ->string($mock->bar())->isEqualTo($value)957 ->and($test->Æ($mock)->bar = $otherValue = uniqid())958 ->then959 ->string($mock->bar())->isEqualTo($otherValue)960 ;961 }962 public function testResetMock()963 {964 $this965 ->if($test = new emptyTest())966 ->and($mockController = new \mock\mageekguy\atoum\mock\controller())967 ->and($mockController->control($mock = new \mock\object()))968 ->and($this->resetMock($mockController))969 ->then970 ->object($test->resetMock($mock))->isIdenticalTo($mock->getMockController())971 ->mock($mockController)->call('resetCalls')->once()972 ;973 }974 public function testResetFunction()975 {976 $this977 ->if($test = new emptyTest())978 ->and($this->function->md5 = uniqid())979 ->then980 ->object($test->resetFunction($this->function->md5))->isIdenticalTo($this->function->md5)981 ;982 }983 public function testResetAdapter()984 {985 $this986 ->if($test = new emptyTest())987 ->and($adapter = new \mock\mageekguy\atoum\test\adapter())988 ->and($this->resetMock($adapter))989 ->then990 ->object($test->resetAdapter($adapter))->isIdenticalTo($adapter)991 ->mock($adapter)->call('resetCalls')->once()992 ;993 }994 public function testErrorHandler()995 {996 $this997 ->if($test = new emptyTest())998 ->and($adapter = new atoum\test\adapter())999 ->and($adapter->error_reporting = 0)1000 ->and($test->setAdapter($adapter))1001 ->then1002 ->boolean($test->errorHandler(rand(1, PHP_INT_MAX), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1003 ->array($test->getScore()->getErrors())->isEmpty()1004 ->if($adapter->error_reporting = E_ALL)1005 ->then1006 ->boolean($test->errorHandler(E_NOTICE, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1007 ->variable($test->getScore()->errorExists($errstr, E_NOTICE))->isNotNull()1008 ->boolean($test->errorHandler(E_WARNING, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1009 ->variable($test->getScore()->errorExists($errstr, E_WARNING))->isNotNull()1010 ->boolean($test->errorHandler(E_USER_NOTICE, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1011 ->variable($test->getScore()->errorExists($errstr, E_USER_NOTICE))->isNotNull()1012 ->boolean($test->errorHandler(E_USER_WARNING, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1013 ->variable($test->getScore()->errorExists($errstr, E_USER_WARNING))->isNotNull()1014 ->boolean($test->errorHandler(E_DEPRECATED, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1015 ->variable($test->getScore()->errorExists($errstr, E_DEPRECATED))->isNotNull()1016 ->boolean($test->errorHandler(E_RECOVERABLE_ERROR, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isFalse()1017 ->variable($test->getScore()->errorExists($errstr, E_RECOVERABLE_ERROR))->isNotNull()1018 ->if($adapter->error_reporting = E_ALL & ~E_DEPRECATED)1019 ->then1020 ->boolean($test->errorHandler(E_NOTICE, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1021 ->variable($test->getScore()->errorExists($errstr, E_NOTICE))->isNotNull()1022 ->boolean($test->errorHandler(E_WARNING, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1023 ->variable($test->getScore()->errorExists($errstr, E_WARNING))->isNotNull()1024 ->boolean($test->errorHandler(E_USER_NOTICE, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1025 ->variable($test->getScore()->errorExists($errstr, E_USER_NOTICE))->isNotNull()1026 ->boolean($test->errorHandler(E_USER_WARNING, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1027 ->variable($test->getScore()->errorExists($errstr, E_USER_WARNING))->isNotNull()1028 ->boolean($test->errorHandler(E_DEPRECATED, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1029 ->variable($test->getScore()->errorExists($errstr, E_DEPRECATED))->isNull()1030 ->if($adapter->error_reporting = E_ALL & ~E_RECOVERABLE_ERROR)1031 ->then1032 ->boolean($test->errorHandler(E_RECOVERABLE_ERROR, $errstr = uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))->isTrue()1033 ->variable($test->getScore()->errorExists($errstr, E_RECOVERABLE_ERROR))->isNull()1034 ->if($adapter->error_reporting = 32767)1035 ->and($factory = function($class) use (& $reflection, & $filename, & $classname) {1036 $reflection = new \mock\ReflectionClass($class);1037 $reflection->getMockController()->getFilename = $filename = 'filename';1038 $reflection->getMockController()->getName = $classname = 'classname';1039 return $reflection;1040 })1041 ->and($score = new \mock\mageekguy\atoum\test\score())1042 ->and($test = new emptyTest(null, null, null, null, $factory))1043 ->and($test->setAdapter($adapter))1044 ->and($test->setScore($score))1045 ->then1046 ->boolean($test->errorHandler($errno = E_NOTICE, $errstr = 'errstr', $errfile = 'errfile', $errline = rand(1, PHP_INT_MAX)))->isTrue()1047 ->mock($score)1048 ->call('addError')->withArguments($errfile, $classname, $test->getCurrentMethod(), $errline, $errno, $errstr, $errfile, $errline, null, null, null)->once()1049 ->boolean($test->errorHandler($errno, $errstr, null, $errline = rand(1, PHP_INT_MAX)))->isTrue()1050 ->mock($score)1051 ->call('addError')->withArguments($filename, $classname, $test->getCurrentMethod(), $errline, $errno, $errstr, null, $errline, null, null, null)->once()1052 ;1053 }1054 public function testGetTestedClassNameFromTestClass()1055 {1056 $this1057 ->string(atoum\test::getTestedClassNameFromTestClass(__CLASS__))->isEqualTo('mageekguy\atoum\test')1058 ->string(atoum\test::getTestedClassNameFromTestClass('foo\bar\tests\units\testedClass'))->isEqualTo('foo\bar\testedClass')1059 ->if(atoum\test::setNamespace('test\unit'))1060 ->then1061 ->string(atoum\test::getTestedClassNameFromTestClass('foo\bar\test\unit\testedClass'))->isEqualTo('foo\bar\testedClass')1062 ->if(atoum\test::setNamespace('\test\unit\\'))1063 ->then1064 ->string(atoum\test::getTestedClassNameFromTestClass('foo\bar\test\unit\testedClass'))->isEqualTo('foo\bar\testedClass')1065 ->if(atoum\test::setNamespace('test\unit\\'))1066 ->then1067 ->string(atoum\test::getTestedClassNameFromTestClass('foo\bar\test\unit\testedClass'))->isEqualTo('foo\bar\testedClass')1068 ->if(atoum\test::setNamespace('\test\unit'))...
testGetTestedClassName
Using AI Code Generation
1$t = new dataProviderTest;2$t->testGetTestedClassName();3$t = new dataProviderTest;4$t->testGetTestedClassName();5$t = new dataProviderTest;6$t->testGetTestedClassName();7$t = new dataProviderTest;8$t->testGetTestedClassName();9$t = new dataProviderTest;10$t->testGetTestedClassName();11$t = new dataProviderTest;12$t->testGetTestedClassName();13$t = new dataProviderTest;14$t->testGetTestedClassName();15$t = new dataProviderTest;16$t->testGetTestedClassName();17$t = new dataProviderTest;18$t->testGetTestedClassName();19$t = new dataProviderTest;20$t->testGetTestedClassName();21$t = new dataProviderTest;22$t->testGetTestedClassName();23$t = new dataProviderTest;24$t->testGetTestedClassName();25$t = new dataProviderTest;26$t->testGetTestedClassName();
testGetTestedClassName
Using AI Code Generation
1require_once 'dataProviderTest.php';2$test = new dataProviderTest();3echo $test->testGetTestedClassName();4require_once 'dataProviderTest.php';5$test = new dataProviderTest();6echo $test->testGetTestedClassName();7require_once 'dataProviderTest.php';8$test = new dataProviderTest();9echo $test->testGetTestedClassName();
testGetTestedClassName
Using AI Code Generation
1require_once('dataProviderTest.php');2$test = new dataProviderTest();3$test->testGetTestedClassName();4require_once('dataProviderTest.php');5$test = new dataProviderTest();6$test->testGetTestedClassName();7require_once('dataProviderTest.php');8$test = new dataProviderTest();9$test->testGetTestedClassName();10require_once('dataProviderTest.php');11$test = new dataProviderTest();12$test->testGetTestedClassName();13require_once('dataProviderTest.php');14$test = new dataProviderTest();15$test->testGetTestedClassName();16require_once('dataProviderTest.php');17$test = new dataProviderTest();18$test->testGetTestedClassName();19require_once('dataProviderTest.php');20$test = new dataProviderTest();21$test->testGetTestedClassName();22require_once('dataProviderTest.php');23$test = new dataProviderTest();24$test->testGetTestedClassName();25require_once('dataProviderTest.php');26$test = new dataProviderTest();27$test->testGetTestedClassName();28require_once('dataProviderTest.php');29$test = new dataProviderTest();30$test->testGetTestedClassName();31require_once('dataProviderTest.php');32$test = new dataProviderTest();33$test->testGetTestedClassName();
testGetTestedClassName
Using AI Code Generation
1$test = new dataProviderTest();2echo $test->testGetTestedClassName();3$test = new dataProviderTest();4echo $test->testGetTestedClassName();5$test = new dataProviderTest();6echo $test->testGetTestedClassName();7public function testGetTestedClassName()8{9 return __CLASS__;10}11$test = new dataProviderTest();12echo $test->testGetTestedClassName();13$test = new dataProviderTest();14echo $test->testGetTestedClassName();15$test = new dataProviderTest();16echo $test->testGetTestedClassName();
testGetTestedClassName
Using AI Code Generation
1require_once 'dataProvideTest.php';2{3 public function testGetTestedClassName()4 {5 $this->assertEquals('dataProvideTest', dataProvideTest::getTestedClassName());6 }7}8require_once 'dataProvideTest.php';9{10 public function testGetTestedClassName()11 {12 $this->assertEquals('dataProvideTest', dataProvideTest::getTestedClassName());13 }14}15{16 public static function getTestedClassName()17 {18 return 'dataProvideTest';19 }20}
testGetTestedClassName
Using AI Code Generation
1require_once 'DataProviderTest.php';2$test = new DataProviderTest('testGetTestedClassName');3$test->run();4echo $test->getStatus();5echo $test->getTestedClassName();6require_once 'DataProviderTest.php';7$test = new DataProviderTest('testGetTestedClassName');8$test->run();9echo $test->getStatus();10echo $test->getTestedClassName();11require_once 'DataProviderTest.php';12$test = new DataProviderTest('testGetTestedClassName');13$test->run();14echo $test->getStatus();15echo $test->getTestedClassName();16require_once 'DataProviderTest.php';17$test = new DataProviderTest('testGetTestedClassName');18$test->run();19echo $test->getStatus();20echo $test->getTestedClassName();21require_once 'DataProviderTest.php';22$test = new DataProviderTest('testGetTestedClassName');23$test->run();24echo $test->getStatus();25echo $test->getTestedClassName();26require_once 'DataProviderTest.php';27$test = new DataProviderTest('testGetTestedClassName');28$test->run();29echo $test->getStatus();30echo $test->getTestedClassName();31require_once 'DataProviderTest.php';32$test = new DataProviderTest('testGetTestedClassName');33$test->run();34echo $test->getStatus();35echo $test->getTestedClassName();36require_once 'DataProviderTest.php';37$test = new DataProviderTest('testGetTestedClassName');38$test->run();39echo $test->getStatus();40echo $test->getTestedClassName();
testGetTestedClassName
Using AI Code Generation
1$test = new dataProviderTest('testGetTestedClassName');2$test->run();3echo $test->getStatus();4echo $test->getTestedClassName();5$test = new dataProviderTest('testGetTestedClassName');6$test->run();7echo $test->getStatus();8echo $test->getTestedClassName();
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 testGetTestedClassName 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!!