|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * CakePHP : Rapid Development Framework (http://cakephp.org) |
| 4 | + * Copyright 2005-2011, Cake Software Foundation, Inc. |
| 5 | + * |
| 6 | + * Licensed under The MIT License |
| 7 | + * Redistributions of files must retain the above copyright notice. |
| 8 | + * |
| 9 | + * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. |
| 10 | + * @link http://cakephp.org CakePHP Project |
| 11 | + * @package Cake.Test.Case.TestSuite |
| 12 | + * @since CakePHP v 1.2.0.4487 |
| 13 | + * @license MIT License (http://www.opensource.org/licenses/mit-license.php) |
| 14 | + */ |
| 15 | + |
| 16 | +/** |
| 17 | + * CakeTestSuiteTest |
| 18 | + * |
| 19 | + * @package Cake.Test.Case.TestSuite |
| 20 | + */ |
| 21 | +class CakeTestSuiteTest extends CakeTestCase { |
| 22 | + |
| 23 | +/** |
| 24 | + * setUp |
| 25 | + * |
| 26 | + * @return void |
| 27 | + */ |
| 28 | + public function setUp() { |
| 29 | + parent::setUp(); |
| 30 | + } |
| 31 | + |
| 32 | +/** |
| 33 | + * tearDown |
| 34 | + * |
| 35 | + * @return void |
| 36 | + */ |
| 37 | + public function tearDown() { |
| 38 | + parent::tearDown(); |
| 39 | + } |
| 40 | + |
| 41 | +/** |
| 42 | + * testAddTestDirectory |
| 43 | + * |
| 44 | + * @return void |
| 45 | + */ |
| 46 | + public function testAddTestDirectory() { |
| 47 | + $testFolder = CORE_TEST_CASES . DS . 'TestSuite'; |
| 48 | + $count = count(glob($testFolder . DS . '*Test.php')); |
| 49 | + |
| 50 | + $suite = $this->getMock('CakeTestSuite', array('addTestFile')); |
| 51 | + $suite |
| 52 | + ->expects($this->exactly($count)) |
| 53 | + ->method('addTestFile'); |
| 54 | + |
| 55 | + $suite->addTestDirectory($testFolder); |
| 56 | + } |
| 57 | + |
| 58 | +/** |
| 59 | + * testAddTestDirectoryRecursive |
| 60 | + * |
| 61 | + * @return void |
| 62 | + */ |
| 63 | + public function testAddTestDirectoryRecursive() {return; |
| 64 | + $testFolder = CORE_TEST_CASES . DS . 'Cache'; |
| 65 | + $count = count(glob($testFolder . DS . '*Test.php')); |
| 66 | + $count += count(glob($testFolder . DS . 'Engine' . DS . '*Test.php')); |
| 67 | + |
| 68 | + $suite = $this->getMock('CakeTestSuite', array('addTestFile')); |
| 69 | + $suite |
| 70 | + ->expects($this->exactly($count)) |
| 71 | + ->method('addTestFile'); |
| 72 | + |
| 73 | + $suite->addTestDirectoryRecursive($testFolder); |
| 74 | + } |
| 75 | + |
| 76 | +/** |
| 77 | + * testAddTestDirectoryRecursiveWithHidden |
| 78 | + * |
| 79 | + * @return void |
| 80 | + */ |
| 81 | + public function testAddTestDirectoryRecursiveWithHidden() { |
| 82 | + $this->skipIf(!is_writeable(TMP), 'Cant addTestDirectoryRecursiveWithHidden unless the tmp folder is writable.'); |
| 83 | + |
| 84 | + $Folder = new Folder(TMP . 'MyTestFolder', true, 0777); |
| 85 | + mkdir($Folder->path . DS . '.svn', 0777, true); |
| 86 | + touch($Folder->path . DS . '.svn' . DS . 'InHiddenFolderTest.php'); |
| 87 | + touch($Folder->path . DS . 'NotHiddenTest.php'); |
| 88 | + touch($Folder->path . DS . '.HiddenTest.php'); |
| 89 | + |
| 90 | + $suite = $this->getMock('CakeTestSuite', array('addTestFile')); |
| 91 | + $suite |
| 92 | + ->expects($this->exactly(1)) |
| 93 | + ->method('addTestFile'); |
| 94 | + |
| 95 | + $suite->addTestDirectoryRecursive($Folder->pwd()); |
| 96 | + |
| 97 | + $Folder->delete(); |
| 98 | + } |
| 99 | +} |
0 commit comments