Best Atoum code snippet using coverage.getExcludedMethods
coverage.php
Source:coverage.php
...257 $this258 ->if($coverage = new testedClass())259 ->then260 ->object($coverage->resetExcludedMethods())->isIdenticalTo($coverage)261 ->array($coverage->getExcludedMethods())->isEmpty()262 ->if($coverage->excludeMethod(uniqid()))263 ->then264 ->object($coverage->resetExcludedMethods())->isIdenticalTo($coverage)265 ->array($coverage->getExcludedMethods())->isEmpty()266 ;267 }268 public function testResetExcludedClasses()269 {270 $this271 ->if($coverage = new testedClass())272 ->then273 ->object($coverage->resetExcludedClasses())->isIdenticalTo($coverage)274 ->array($coverage->getExcludedClasses())->isEmpty()275 ->if($coverage->excludeClass(uniqid()))276 ->then277 ->object($coverage->resetExcludedClasses())->isIdenticalTo($coverage)278 ->array($coverage->getExcludedClasses())->isEmpty()279 ;280 }281 public function testResetExcludedNamespaces()282 {283 $this284 ->if($coverage = new testedClass())285 ->then286 ->object($coverage->resetExcludedNamespaces())->isIdenticalTo($coverage)287 ->array($coverage->getExcludedNamespaces())->isEmpty()288 ->if($coverage->excludeNamespace(uniqid()))289 ->then290 ->object($coverage->resetExcludedNamespaces())->isIdenticalTo($coverage)291 ->array($coverage->getExcludedNamespaces())->isEmpty()292 ;293 }294 public function testResetExcludedDirectories()295 {296 $this297 ->if($coverage = new testedClass())298 ->then299 ->object($coverage->resetExcludedDirectories())->isIdenticalTo($coverage)300 ->array($coverage->getExcludedDirectories())->isEmpty()301 ->if($coverage->excludeDirectory(uniqid()))302 ->then303 ->object($coverage->resetExcludedDirectories())->isIdenticalTo($coverage)304 ->array($coverage->getExcludedDirectories())->isEmpty()305 ;306 }307 public function testMerge()308 {309 $this310 ->if($classController = new mock\controller())311 ->and($classController->disableMethodChecking())312 ->and($classController->__construct = function() {})313 ->and($classController->getName = function() use (& $className) { return $className; })314 ->and($classController->getFileName = function() use (& $classFile) { return $classFile; })315 ->and($classController->getTraits = array())316 ->and($classController->getStartLine = 1)317 ->and($classController->getEndLine = 12)318 ->and($class = new \mock\reflectionClass(uniqid(), $classController))319 ->and($methodController = new mock\controller())320 ->and($methodController->__construct = function() {})321 ->and($methodController->getName = function() use (& $methodName) { return $methodName; })322 ->and($methodController->isAbstract = false)323 ->and($methodController->getFileName = function() use (& $classFile) { return $classFile; })324 ->and($methodController->getDeclaringClass = function() use ($class) { return $class; })325 ->and($methodController->getStartLine = 6)326 ->and($methodController->getEndLine = 8)327 ->and($method = new \mock\reflectionMethod(uniqid(), uniqid(), $methodController))328 ->and($classController->getMethod = function() use ($method) { return $method; })329 ->and($classController->getMethods = array($method))330 ->and($classFile = uniqid())331 ->and($className = uniqid())332 ->and($methodName = uniqid())333 ->and($xdebugData = array(334 $classFile =>335 array(336 5 => -2,337 6 => -1,338 7 => 1,339 8 => -2,340 9 =>-2341 ),342 uniqid() =>343 array(344 5 => 2,345 6 => 3,346 7 => 4,347 8 => 3,348 9 => 2349 )350 )351 )352 ->and($coverage = new testedClass())353 ->and($coverage->setReflectionClassFactory(function() use ($class) { return $class; }))354 ->then355 ->object($coverage->merge($coverage))->isIdenticalTo($coverage)356 ->array($coverage->getClasses())->isEmpty()357 ->array($coverage->getMethods())->isEmpty()358 ->if($otherCoverage = new testedClass())359 ->then360 ->object($coverage->merge($otherCoverage))->isIdenticalTo($coverage)361 ->array($coverage->getClasses())->isEmpty()362 ->array($coverage->getMethods())->isEmpty()363 ->if($coverage->addXdebugDataForTest($this, $xdebugData))364 ->then365 ->object($coverage->merge($otherCoverage))->isIdenticalTo($coverage)366 ->array($coverage->getClasses())->isEqualTo(array($className => $classFile))367 ->array($coverage->getMethods())->isEqualTo(array(368 $className => array(369 $methodName => array(370 6 => -1,371 7 => 1,372 8 => -2373 )374 )375 )376 )377 ->object($coverage->merge($coverage))->isIdenticalTo($coverage)378 ->array($coverage->getClasses())->isEqualTo(array($className => $classFile))379 ->array($coverage->getMethods())->isEqualTo(array(380 $className => array(381 $methodName => array(382 6 => -1,383 7 => 1,384 8 => -2385 )386 )387 )388 )389 ->if($otherClassController = new mock\controller())390 ->and($otherClassController->disableMethodChecking())391 ->and($otherClassController->__construct = function() {})392 ->and($otherClassController->getName = function() use (& $otherClassName) { return $otherClassName; })393 ->and($otherClassController->getFileName = function() use (& $otherClassFile) { return $otherClassFile; })394 ->and($otherClassController->getTraits = array())395 ->and($otherClassController->getStartLine = 1)396 ->and($otherClassController->getEndLine = 12)397 ->and($otherClass = new \mock\reflectionClass($class, $otherClassController))398 ->and($otherMethodController = new mock\controller())399 ->and($otherMethodController->__construct = function() {})400 ->and($otherMethodController->getName = function() use (& $otherMethodName) { return $otherMethodName; })401 ->and($otherMethodController->isAbstract = false)402 ->and($otherMethodController->getFileName = function() use (& $otherClassFile) { return $otherClassFile; })403 ->and($otherMethodController->getDeclaringClass = function() use ($otherClass) { return $otherClass; })404 ->and($otherMethodController->getStartLine = 5)405 ->and($otherMethodController->getEndLine = 9)406 ->and($otherClassController->getMethods = array(new \mock\reflectionMethod(uniqid(), uniqid(), $otherMethodController)))407 ->and($otherClassFile = uniqid())408 ->and($otherClassName = uniqid())409 ->and($otherMethodName = uniqid())410 ->and($otherXdebugData = array(411 $otherClassFile =>412 array(413 1 => -2,414 2 => -1,415 3 => 1,416 4 => 1,417 5 => -1,418 6 => 1,419 7 => 1,420 8 => -1,421 9 => -2,422 10 => 1423 ),424 uniqid() =>425 array(426 500 => 200,427 600 => 300,428 700 => 400,429 800 => 300,430 900 => 200431 )432 )433 )434 ->and($otherCoverage->setReflectionClassFactory(function() use ($otherClass) { return $otherClass; }))435 ->then436 ->object($coverage->merge($otherCoverage->addXdebugDataForTest($this, $otherXdebugData)))->isIdenticalTo($coverage)437 ->array($coverage->getClasses())->isEqualTo(array(438 $className => $classFile,439 $otherClassName => $otherClassFile440 )441 )442 ->array($coverage->getMethods())->isEqualTo(array(443 $className => array(444 $methodName => array(445 6 => -1,446 7 => 1,447 8 =>-2448 )449 ),450 $otherClassName => array(451 $otherMethodName => array(452 5 => -1,453 6 => 1,454 7 => 1,455 8 => -1,456 9 => -2457 )458 )459 )460 )461 ->if($classController = new mock\controller())462 ->and($classController->disableMethodChecking())463 ->and($classController->__construct = function() {})464 ->and($classController->getName = function() use (& $className) { return $className; })465 ->and($classController->getFileName = function() use (& $classFile) { return $classFile; })466 ->and($classController->getTraits = array())467 ->and($classController->getStartLine = 1)468 ->and($classController->getEndLine = 12)469 ->and($class = new \mock\reflectionClass(uniqid(), $classController))470 ->and($methodController = new mock\controller())471 ->and($methodController->__construct = function() {})472 ->and($methodController->getName = function() use (& $methodName) { return $methodName; })473 ->and($methodController->isAbstract = false)474 ->and($methodController->getFileName = function() use (& $classFile) { return $classFile; })475 ->and($methodController->getDeclaringClass = function() use ($class) { return $class; })476 ->and($methodController->getStartLine = 6)477 ->and($methodController->getEndLine = 8)478 ->and($method = new \mock\reflectionMethod(uniqid(), uniqid(), $methodController))479 ->and($classController->getMethod = function() use ($method) { return $method; })480 ->and($classController->getMethods = array($method))481 ->and($classFile = uniqid())482 ->and($className = uniqid())483 ->and($methodName = uniqid())484 ->and($xdebugData = array(485 $classFile =>486 array(487 5 => -2,488 6 => -1,489 7 => 1,490 8 => -2,491 9 =>-2492 ),493 uniqid() =>494 array(495 5 => 2,496 6 => 3,497 7 => 4,498 8 => 3,499 9 => 2500 )501 )502 )503 ->and($coverage = new testedClass())504 ->and($coverage->setReflectionClassFactory(function() use ($class) { return $class; }))505 ->and($coverage->excludeClass($className))506 ->and($otherCoverage = new testedClass())507 ->and($otherCoverage->setReflectionClassFactory(function() use ($class) { return $class; }))508 ->and($otherCoverage->addXdebugDataForTest($this, $xdebugData))509 ->then510 ->array($otherCoverage->getClasses())->isNotEmpty()511 ->array($otherCoverage->getMethods())->isNotEmpty()512 ->object($coverage->merge($otherCoverage))->isIdenticalTo($coverage)513 ->array($coverage->getClasses())->isEmpty()514 ->array($coverage->getMethods())->isEmpty()515 ;516 }517 public function testCount()518 {519 $this520 ->if($coverage = new testedClass())521 ->then522 ->sizeOf($coverage)->isZero()523 ->if($classController = new mock\controller())524 ->and($classController->disableMethodChecking())525 ->and($classController->__construct = function() {})526 ->and($classController->getName = function() use (& $className) { return $className; })527 ->and($classController->getFileName = function() use (& $classFile) { return $classFile; })528 ->and($classController->getTraits = array())529 ->and($classController->getStartLine = 1)530 ->and($classController->getEndLine = 12)531 ->and($class = new \mock\reflectionClass(uniqid(), $classController))532 ->and($methodController = new mock\controller())533 ->and($methodController->__construct = function() {})534 ->and($methodController->getName = function() use (& $methodName) { return $methodName; })535 ->and($methodController->isAbstract = false)536 ->and($methodController->getFileName = function() use (& $classFile) { return $classFile; })537 ->and($methodController->getDeclaringClass = function() use ($class) { return $class; })538 ->and($methodController->getStartLine = 6)539 ->and($methodController->getEndLine = 8)540 ->and($classController->getMethods = array(new \mock\reflectionMethod(uniqid(), uniqid(), $methodController)))541 ->and($classFile = uniqid())542 ->and($className = uniqid())543 ->and($methodName = uniqid())544 ->and($xdebugData = array(545 $classFile =>546 array(547 5 => 1,548 6 => 2,549 7 => 3,550 8 => 2,551 9 => 1552 ),553 uniqid() =>554 array(555 5 => 2,556 6 => 3,557 7 => 4,558 8 => 3,559 9 => 2560 )561 )562 )563 ->and($coverage->setReflectionClassFactory(function() use ($class) { return $class; }))564 ->then565 ->sizeOf($coverage->addXdebugDataForTest($this, $xdebugData))->isEqualTo(1)566 ;567 }568 public function testGetClasses()569 {570 $this571 ->if($classController = new mock\controller())572 ->and($classController->disableMethodChecking())573 ->and($classController->__construct = function() {})574 ->and($classController->getName = function() use (& $className) { return $className; })575 ->and($classController->getFileName = function() use (& $classFile) { return $classFile; })576 ->and($classController->getTraits = array())577 ->and($classController->getStartLine = 1)578 ->and($classController->getEndLine = 12)579 ->and($class = new \mock\reflectionClass(uniqid(), $classController))580 ->and($methodController = new mock\controller())581 ->and($methodController->__construct = function() {})582 ->and($methodController->getName = function() { return uniqid(); })583 ->and($methodController->isAbstract = false)584 ->and($methodController->getFileName = function() use (& $classFile) { return $classFile; })585 ->and($methodController->getDeclaringClass = function() use ($class) { return $class; })586 ->and($methodController->getStartLine = 4)587 ->and($methodController->getEndLine = 8)588 ->and($classController->getMethods = array(new \mock\reflectionMethod(uniqid(), uniqid(), $methodController)))589 ->and($classFile = uniqid())590 ->and($className = uniqid())591 ->and($xdebugData = array(592 $classFile =>593 array(594 3 => -2,595 4 => -1,596 5 => -1,597 6 => -1,598 7 => -1,599 8 => -2,600 9 => -2601 )602 )603 )604 ->and($coverage = new testedClass())605 ->and($coverage->setReflectionClassFactory(function() use ($class) { return $class; }))606 ->and($coverage->addXdebugDataForTest($this, $xdebugData))607 ->then608 ->array($coverage->getClasses())->isEqualTo(array($className => $classFile))609 ;610 }611 public function testGetValue()612 {613 $this614 ->if($classController = new mock\controller())615 ->and($classController->disableMethodChecking())616 ->and($classController->__construct = function() {})617 ->and($classController->getName = function() use (& $className) { return $className; })618 ->and($classController->getFileName = function() use (& $classFile) { return $classFile; })619 ->and($classController->getTraits = array())620 ->and($classController->getStartLine = 1)621 ->and($classController->getEndLine = 12)622 ->and($class = new \mock\reflectionClass(uniqid(), $classController))623 ->and($methodController = new mock\controller())624 ->and($methodController->__construct = function() {})625 ->and($methodController->getName = function() { return uniqid(); })626 ->and($methodController->isAbstract = false)627 ->and($methodController->getFileName = function() use (& $classFile) { return $classFile; })628 ->and($methodController->getDeclaringClass = function() use ($class) { return $class; })629 ->and($methodController->getStartLine = 4)630 ->and($methodController->getEndLine = 8)631 ->and($classController->getMethods = array(new \mock\reflectionMethod(uniqid(), uniqid(), $methodController)))632 ->and($classFile = uniqid())633 ->and($className = uniqid())634 ->and($xdebugData = array(635 $classFile =>636 array(637 3 => -2,638 4 => -1,639 5 => -1,640 6 => -1,641 7 => -1,642 8 => -2,643 9 => -2644 ),645 uniqid() =>646 array(647 5 => 2,648 6 => 3,649 7 => 4,650 8 => 3,651 9 => 2652 )653 )654 )655 ->and($coverage = new testedClass())656 ->and($coverage->setReflectionClassFactory(function() use ($class) { return $class; }))657 ->and($coverage->addXdebugDataForTest($this, $xdebugData))658 ->then659 ->float($coverage->getValue())->isEqualTo(0.0)660 ->if($xdebugData = array(661 $classFile =>662 array(663 3 => -2,664 4 => 1,665 5 => -1,666 6 => -1,667 7 => -1,668 8 => -2,669 9 => -1670 ),671 uniqid() =>672 array(673 5 => 2,674 6 => 3,675 7 => 4,676 8 => 3,677 9 => 2678 )679 )680 )681 ->and($coverage->reset()->addXdebugDataForTest($this, $xdebugData))682 ->then683 ->float($coverage->getValue())->isEqualTo(1 / 4)684 ->if($xdebugData = array(685 $classFile =>686 array(687 3 => -2,688 4 => 1,689 5 => -1,690 6 => -1,691 7 => 1,692 8 => -2,693 9 => -1694 ),695 uniqid() =>696 array(697 5 => 2,698 6 => 3,699 7 => 4,700 8 => 3,701 9 => 2702 )703 )704 )705 ->and($coverage->reset()->addXdebugDataForTest($this, $xdebugData))706 ->then707 ->float($coverage->getValue())->isEqualTo(2 / 4)708 ->if($xdebugData = array(709 $classFile =>710 array(711 3 => -2,712 4 => 1,713 5 => 1,714 6 => 1,715 7 => 1,716 8 => -2,717 9 => -1718 ),719 uniqid() =>720 array(721 5 => 2,722 6 => 3,723 7 => 4,724 8 => 3,725 9 => 2726 )727 )728 )729 ->and($coverage->reset()->addXdebugDataForTest($this, $xdebugData))730 ->then731 ->float($coverage->getValue())->isEqualTo(1.0)732 ;733 }734 public function testGetValueForClass()735 {736 $this737 ->if($coverage = new testedClass())738 ->then739 ->variable($coverage->getValueForClass(uniqid()))->isNull()740 ->if($classController = new mock\controller())741 ->and($classController->disableMethodChecking())742 ->and($classController->__construct = function() {})743 ->and($classController->getName = function() use (& $className) { return $className; })744 ->and($classController->getFileName = function() use (& $classFile) { return $classFile; })745 ->and($classController->getTraits = array())746 ->and($classController->getStartLine = 1)747 ->and($classController->getEndLine = 12)748 ->and($class = new \mock\reflectionClass(uniqid(), $classController))749 ->and($methodController = new mock\controller())750 ->and($methodController->__construct = function() {})751 ->and($methodController->getName = function() { return uniqid(); })752 ->and($methodController->isAbstract = false)753 ->and($methodController->getFileName = function() use (& $classFile) { return $classFile; })754 ->and($methodController->getDeclaringClass = function() use ($class) { return $class; })755 ->and($methodController->getStartLine = 4)756 ->and($methodController->getEndLine = 8)757 ->and($classController->getMethods = array(new \mock\reflectionMethod(uniqid(), uniqid(), $methodController)))758 ->and($classFile = uniqid())759 ->and($className = uniqid())760 ->and($xdebugData = array(761 $classFile =>762 array(763 3 => -2,764 4 => -1,765 5 => -1,766 6 => -1,767 7 => -1,768 8 => -2,769 9 => -2770 ),771 uniqid() =>772 array(773 5 => 2,774 6 => 3,775 7 => 4,776 8 => 3,777 9 => 2778 )779 )780 )781 ->and($coverage = new testedClass())782 ->and($coverage->setReflectionClassFactory(function() use ($class) { return $class; }))783 ->and($coverage->addXdebugDataForTest($this, $xdebugData))784 ->then785 ->variable($coverage->getValueForClass(uniqid()))->isNull()786 ->float($coverage->getValueForClass($className))->isEqualTo(0.0)787 ->if($xdebugData = array(788 $classFile =>789 array(790 3 => -2,791 4 => 1,792 5 => -1,793 6 => -1,794 7 => -1,795 8 => -2,796 9 => -1797 ),798 uniqid() =>799 array(800 5 => 2,801 6 => 3,802 7 => 4,803 8 => 3,804 9 => 2805 )806 )807 )808 ->and($coverage->reset()->addXdebugDataForTest($this, $xdebugData))809 ->then810 ->variable($coverage->getValueForClass(uniqid()))->isNull()811 ->float($coverage->getValueForClass($className))->isEqualTo(1 / 4)812 ->if($xdebugData = array(813 $classFile =>814 array(815 3 => -2,816 4 => 1,817 5 => -1,818 6 => -1,819 7 => 1,820 8 => -2,821 9 => -1822 ),823 uniqid() =>824 array(825 5 => 2,826 6 => 3,827 7 => 4,828 8 => 3,829 9 => 2830 )831 )832 )833 ->and($coverage->reset()->addXdebugDataForTest($this, $xdebugData))834 ->then835 ->variable($coverage->getValueForClass(uniqid()))->isNull()836 ->float($coverage->getValueForClass($className))->isEqualTo(2 / 4)837 ->if($xdebugData = array(838 $classFile =>839 array(840 3 => -2,841 4 => 1,842 5 => 1,843 6 => 1,844 7 => 1,845 8 => -2,846 9 => -1847 ),848 uniqid() =>849 array(850 5 => 2,851 6 => 3,852 7 => 4,853 8 => 3,854 9 => 2855 )856 )857 )858 ->and($coverage->reset()->addXdebugDataForTest($this, $xdebugData))859 ->then860 ->variable($coverage->getValueForClass(uniqid()))->isNull()861 ->float($coverage->getValueForClass($className))->isEqualTo(1.0)862 ;863 }864 public function testGetCoverageForClass()865 {866 $this867 ->if($coverage = new testedClass())868 ->then869 ->array($coverage->getCoverageForClass(uniqid()))->isEmpty()870 ->if($classController = new mock\controller())871 ->and($classController->disableMethodChecking())872 ->and($classController->__construct = function() {})873 ->and($classController->getName = function() use (& $className) { return $className; })874 ->and($classController->getFileName = function() use (& $classFile) { return $classFile; })875 ->and($classController->getTraits = array())876 ->and($classController->getStartLine = 1)877 ->and($classController->getEndLine = 12)878 ->and($class = new \mock\reflectionClass(uniqid(), $classController))879 ->and($methodController = new mock\controller())880 ->and($methodController->__construct = function() {})881 ->and($methodController->getName = function() use (& $methodName) { return $methodName; })882 ->and($methodController->isAbstract = false)883 ->and($methodController->getFileName = function() use (& $classFile) { return $classFile; })884 ->and($methodController->getDeclaringClass = function() use ($class) { return $class; })885 ->and($methodController->getStartLine = 4)886 ->and($methodController->getEndLine = 8)887 ->and($classController->getMethods = array(new \mock\reflectionMethod(uniqid(), uniqid(), $methodController)))888 ->and($classFile = uniqid())889 ->and($className = uniqid())890 ->and($methodName = uniqid())891 ->and($xdebugData = array(892 $classFile =>893 array(894 3 => -2,895 4 => 1,896 5 => -1,897 6 => -1,898 7 => -1,899 8 => -2,900 9 => -1901 ),902 uniqid() =>903 array(904 5 => 2,905 6 => 3,906 7 => 4,907 8 => 3,908 9 => 2909 )910 )911 )912 ->and($expected = array(913 $methodName =>914 array(915 4 => 1,916 5 => -1,917 6 => -1,918 7 => -1,919 8 => -2,920 )921 )922 )923 ->and($coverage->setReflectionClassFactory(function() use ($class) { return $class; }))924 ->and($coverage->addXdebugDataForTest($this, $xdebugData))925 ->then926 ->array($coverage->getCoverageForClass($className))->isEqualTo($expected)927 ;928 }929 public function testGetNumberOfCoverableLinesInClass()930 {931 $this932 ->if($coverage = new testedClass())933 ->then934 ->integer($coverage->getNumberOfCoverableLinesInClass(uniqid()))->isZero()935 ->if($classController = new mock\controller())936 ->and($classController->disableMethodChecking())937 ->and($classController->__construct = function() {})938 ->and($classController->getName = function() use (& $className) { return $className; })939 ->and($classController->getFileName = function() use (& $classFile) { return $classFile; })940 ->and($classController->getTraits = array())941 ->and($classController->getStartLine = 1)942 ->and($classController->getEndLine = 12)943 ->and($class = new \mock\reflectionClass(uniqid(), $classController))944 ->and($methodController = new mock\controller())945 ->and($methodController->__construct = function() {})946 ->and($methodController->getName = function() use (& $methodName) { return $methodName; })947 ->and($methodController->isAbstract = false)948 ->and($methodController->getFileName = function() use (& $classFile) { return $classFile; })949 ->and($methodController->getDeclaringClass = function() use ($class) { return $class; })950 ->and($methodController->getStartLine = 4)951 ->and($methodController->getEndLine = 8)952 ->and($classController->getMethods = array(new \mock\reflectionMethod(uniqid(), uniqid(), $methodController)))953 ->and($classFile = uniqid())954 ->and($className = uniqid())955 ->and($methodName = uniqid())956 ->and($xdebugData = array(957 $classFile =>958 array(959 3 => -2,960 4 => 1,961 5 => -1,962 6 => -1,963 7 => -1,964 8 => -2,965 9 => -1966 ),967 uniqid() =>968 array(969 5 => 2,970 6 => 3,971 7 => 4,972 8 => 3,973 9 => 2974 )975 )976 )977 ->and($coverage->setReflectionClassFactory(function() use ($class) { return $class; }))978 ->and($coverage->addXdebugDataForTest($this, $xdebugData))979 ->then980 ->integer($coverage->getNumberOfCoverableLinesInClass($className))->isEqualTo(4)981 ;982 }983 public function testGetNumberOfCoveredLinesInClass()984 {985 $this986 ->if($coverage = new testedClass())987 ->then988 ->integer($coverage->getNumberOfCoveredLinesInClass(uniqid()))->isZero()989 ->if($classController = new mock\controller())990 ->and($classController->disableMethodChecking())991 ->and($classController->__construct = function() {})992 ->and($classController->getName = function() use (& $className) { return $className; })993 ->and($classController->getFileName = function() use (& $classFile) { return $classFile; })994 ->and($classController->getTraits = array())995 ->and($classController->getStartLine = 1)996 ->and($classController->getEndLine = 12)997 ->and($class = new \mock\reflectionClass(uniqid(), $classController))998 ->and($methodController = new mock\controller())999 ->and($methodController->__construct = function() {})1000 ->and($methodController->getName = function() use (& $methodName) { return $methodName; })1001 ->and($methodController->isAbstract = false)1002 ->and($methodController->getFileName = function() use (& $classFile) { return $classFile; })1003 ->and($methodController->getDeclaringClass = function() use ($class) { return $class; })1004 ->and($methodController->getStartLine = 4)1005 ->and($methodController->getEndLine = 8)1006 ->and($classController->getMethods = array(new \mock\reflectionMethod(uniqid(), uniqid(), $methodController)))1007 ->and($classFile = uniqid())1008 ->and($className = uniqid())1009 ->and($methodName = uniqid())1010 ->and($xdebugData = array(1011 $classFile =>1012 array(1013 3 => -2,1014 4 => 1,1015 5 => -1,1016 6 => -1,1017 7 => -1,1018 8 => -2,1019 9 => -11020 ),1021 uniqid() =>1022 array(1023 5 => 2,1024 6 => 3,1025 7 => 4,1026 8 => 3,1027 9 => 21028 )1029 )1030 )1031 ->and($coverage->setReflectionClassFactory(function() use ($class) { return $class; }))1032 ->and($coverage->addXdebugDataForTest($this, $xdebugData))1033 ->then1034 ->integer($coverage->getNumberOfCoveredLinesInClass($className))->isEqualTo(1)1035 ;1036 }1037 public function testGetValueForMethod()1038 {1039 $this1040 ->if($coverage = new testedClass())1041 ->then1042 ->variable($coverage->getValueForMethod(uniqid(), uniqid()))->isNull()1043 ->if($classController = new mock\controller())1044 ->and($classController->disableMethodChecking())1045 ->and($classController->__construct = function() {})1046 ->and($classController->getName = function() use (& $className) { return $className; })1047 ->and($classController->getFileName = function() use (& $classFile) { return $classFile; })1048 ->and($classController->getTraits = array())1049 ->and($classController->getStartLine = 1)1050 ->and($classController->getEndLine = 12)1051 ->and($class = new \mock\reflectionClass(uniqid(), $classController))1052 ->and($methodController = new mock\controller())1053 ->and($methodController->__construct = function() {})1054 ->and($methodController->getName = function() use (& $methodName) { return $methodName; })1055 ->and($methodController->isAbstract = false)1056 ->and($methodController->getFileName = function() use (& $classFile) { return $classFile; })1057 ->and($methodController->getDeclaringClass = function() use ($class) { return $class; })1058 ->and($methodController->getStartLine = 4)1059 ->and($methodController->getEndLine = 8)1060 ->and($classController->getMethods = array(new \mock\reflectionMethod(uniqid(), uniqid(), $methodController)))1061 ->and($classFile = uniqid())1062 ->and($className = uniqid())1063 ->and($methodName = uniqid())1064 ->and($xdebugData = array(1065 $classFile =>1066 array(1067 3 => -2,1068 4 => -1,1069 5 => -1,1070 6 => -1,1071 7 => -1,1072 8 => -2,1073 9 => -21074 ),1075 uniqid() =>1076 array(1077 5 => 2,1078 6 => 3,1079 7 => 4,1080 8 => 3,1081 9 => 21082 )1083 )1084 )1085 ->and($coverage->setReflectionClassFactory(function() use ($class) { return $class; }))1086 ->and($coverage->addXdebugDataForTest($this, $xdebugData))1087 ->then1088 ->variable($coverage->getValueForMethod(uniqid(), uniqid()))->isNull()1089 ->variable($coverage->getValueForMethod($className, uniqid()))->isNull()1090 ->float($coverage->getValueForMethod($className, $methodName))->isEqualTo(0.0)1091 ->if($xdebugData = array(1092 $classFile =>1093 array(1094 3 => -2,1095 4 => 1,1096 5 => -1,1097 6 => -1,1098 7 => -1,1099 8 => -2,1100 9 => -11101 ),1102 uniqid() =>1103 array(1104 5 => 2,1105 6 => 3,1106 7 => 4,1107 8 => 3,1108 9 => 21109 )1110 )1111 )1112 ->and($coverage->reset()->addXdebugDataForTest($this, $xdebugData))1113 ->then1114 ->variable($coverage->getValueForMethod(uniqid(), uniqid()))->isNull()1115 ->variable($coverage->getValueForMethod($className, uniqid()))->isNull()1116 ->float($coverage->getValueForMethod($className, $methodName))->isEqualTo(1 / 4)1117 ->if($xdebugData = array(1118 $classFile =>1119 array(1120 3 => -2,1121 4 => 1,1122 5 => -1,1123 6 => -1,1124 7 => 1,1125 8 => -2,1126 9 => -11127 ),1128 uniqid() =>1129 array(1130 5 => 2,1131 6 => 3,1132 7 => 4,1133 8 => 3,1134 9 => 21135 )1136 )1137 )1138 ->and($coverage->reset()->addXdebugDataForTest($this, $xdebugData))1139 ->then1140 ->variable($coverage->getValueForMethod(uniqid(), uniqid()))->isNull()1141 ->variable($coverage->getValueForMethod($className, uniqid()))->isNull()1142 ->float($coverage->getValueForMethod($className, $methodName))->isEqualTo(2 / 4)1143 ->if($xdebugData = array(1144 $classFile =>1145 array(1146 3 => -2,1147 4 => 1,1148 5 => 1,1149 6 => 1,1150 7 => 1,1151 8 => -2,1152 9 => -11153 ),1154 uniqid() =>1155 array(1156 5 => 2,1157 6 => 3,1158 7 => 4,1159 8 => 3,1160 9 => 21161 )1162 )1163 )1164 ->and($coverage->reset()->addXdebugDataForTest($this, $xdebugData))1165 ->then1166 ->variable($coverage->getValueForMethod(uniqid(), uniqid()))->isNull()1167 ->variable($coverage->getValueForMethod($className, uniqid()))->isNull()1168 ->float($coverage->getValueForMethod($className, $methodName))->isEqualTo(1.0)1169 ;1170 }1171 public function testGetCoverageForMethod()1172 {1173 $this1174 ->if($coverage = new testedClass())1175 ->then1176 ->array($coverage->getCoverageForClass(uniqid()))->isEmpty()1177 ->if($classController = new mock\controller())1178 ->and($classController->disableMethodChecking())1179 ->and($classController->__construct = function() {})1180 ->and($classController->getName = function() use (& $className) { return $className; })1181 ->and($classController->getFileName = function() use (& $classFile) { return $classFile; })1182 ->and($classController->getTraits = array())1183 ->and($classController->getStartLine = 1)1184 ->and($classController->getEndLine = 12)1185 ->and($class = new \mock\reflectionClass(uniqid(), $classController))1186 ->and($methodController = new mock\controller())1187 ->and($methodController->__construct = function() {})1188 ->and($methodController->getName = function() use (& $methodName) { return $methodName; })1189 ->and($methodController->isAbstract = false)1190 ->and($methodController->getFileName = function() use (& $classFile) { return $classFile; })1191 ->and($methodController->getDeclaringClass = function() use ($class) { return $class; })1192 ->and($methodController->getStartLine = 4)1193 ->and($methodController->getEndLine = 8)1194 ->and($classController->getMethods = array(new \mock\reflectionMethod(uniqid(), uniqid(), $methodController)))1195 ->and($classFile = uniqid())1196 ->and($className = uniqid())1197 ->and($methodName = uniqid())1198 ->and($xdebugData = array(1199 $classFile =>1200 array(1201 3 => -2,1202 4 => 1,1203 5 => -1,1204 6 => -1,1205 7 => -1,1206 8 => -2,1207 9 => -11208 ),1209 uniqid() =>1210 array(1211 5 => 2,1212 6 => 3,1213 7 => 4,1214 8 => 3,1215 9 => 21216 )1217 )1218 )1219 ->and($expected = array(1220 4 => 1,1221 5 => -1,1222 6 => -1,1223 7 => -1,1224 8 => -2,1225 )1226 )1227 ->and($coverage = new testedClass())1228 ->and($coverage->setReflectionClassFactory(function() use ($class) { return $class; }))1229 ->and($coverage->addXdebugDataForTest($this, $xdebugData))1230 ->then1231 ->array($coverage->getCoverageForMethod($className, $methodName))->isEqualTo($expected)1232 ;1233 }1234 public function testExcludeMethod()1235 {1236 $this1237 ->if($coverage = new testedClass())1238 ->then1239 ->object($coverage->excludeMethod($method = uniqid()))->isIdenticalTo($coverage)1240 ->array($coverage->getExcludedMethods())->isEqualTo(array($method))1241 ->object($coverage->excludeMethod($otherClass = rand(1, PHP_INT_MAX)))->isIdenticalTo($coverage)1242 ->array($coverage->getExcludedMethods())->isEqualTo(array($method, (string) $otherClass))1243 ->object($coverage->excludeMethod($method))->isIdenticalTo($coverage)1244 ->array($coverage->getExcludedMethods())->isEqualTo(array($method, (string) $otherClass))1245 ;1246 }1247 public function testExcludeClass()1248 {1249 $this1250 ->if($coverage = new testedClass())1251 ->then1252 ->object($coverage->excludeClass($class = uniqid()))->isIdenticalTo($coverage)1253 ->array($coverage->getExcludedClasses())->isEqualTo(array($class))1254 ->object($coverage->excludeClass($otherClass = rand(1, PHP_INT_MAX)))->isIdenticalTo($coverage)1255 ->array($coverage->getExcludedClasses())->isEqualTo(array($class, (string) $otherClass))1256 ->object($coverage->excludeClass($class))->isIdenticalTo($coverage)1257 ->array($coverage->getExcludedClasses())->isEqualTo(array($class, (string) $otherClass))1258 ;...
concurrent.php
Source:concurrent.php
...93 {94 $phpCode .= '$test->enableBranchesAndPathsCoverage();';95 }96 $phpCode .= '$coverage = $test->getCoverage();';97 foreach ($this->test->getCoverage()->getExcludedMethods() as $excludedMethod)98 {99 $phpCode .= '$coverage->excludeMethod(\'' . $excludedMethod . '\');';100 }101 foreach ($this->test->getCoverage()->getExcludedClasses() as $excludedClass)102 {103 $phpCode .= '$coverage->excludeClass(\'' . $excludedClass . '\');';104 }105 foreach ($this->test->getCoverage()->getExcludedNamespaces() as $excludedNamespace)106 {107 $phpCode .= '$coverage->excludeNamespace(\'' . $excludedNamespace . '\');';108 }109 foreach ($this->test->getCoverage()->getExcludedDirectories() as $excludedDirectory)110 {111 $phpCode .= '$coverage->excludeDirectory(\'' . $excludedDirectory . '\');';...
getExcludedMethods
Using AI Code Generation
1$coverage = new PHP_CodeCoverage();2$coverage->start('1.php');3require '1.php';4$coverage->stop();5$coverage->getExcludedMethods();6$coverage = new PHP_CodeCoverage();7$coverage->start('2.php');8require '2.php';9$coverage->stop();10$coverage->getExcludedMethods();11$coverage = new PHP_CodeCoverage();12$coverage->start('3.php');13require '3.php';14$coverage->stop();15$coverage->getExcludedMethods();16$coverage = new PHP_CodeCoverage();17$coverage->start('4.php');18require '4.php';19$coverage->stop();20$coverage->getExcludedMethods();21$coverage = new PHP_CodeCoverage();22$coverage->start('5.php');23require '5.php';24$coverage->stop();25$coverage->getExcludedMethods();26$coverage = new PHP_CodeCoverage();27$coverage->start('6.php');28require '6.php';29$coverage->stop();30$coverage->getExcludedMethods();31$coverage = new PHP_CodeCoverage();32$coverage->start('7.php');33require '7.php';34$coverage->stop();35$coverage->getExcludedMethods();36$coverage = new PHP_CodeCoverage();37$coverage->start('8.php');38require '8.php';39$coverage->stop();40$coverage->getExcludedMethods();41$coverage = new PHP_CodeCoverage();42$coverage->start('9.php');43require '9.php';44$coverage->stop();45$coverage->getExcludedMethods();46$coverage = new PHP_CodeCoverage();
getExcludedMethods
Using AI Code Generation
1require_once('phpunit/coverage.php');2$coverage = new Coverage();3$coverage->setExcludeList('exclude.txt');4$coverage->setExcludeList('exclude1.txt');5$methods = $coverage->getExcludedMethods();6print_r($methods);
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 getExcludedMethods 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!!