@@ -10,108 +10,108 @@ |
||
| 10 | 10 | |
| 11 | 11 | class Installer |
| 12 | 12 | { |
| 13 | - const TEST_FOLDER = 'application/tests'; |
|
| 13 | + const TEST_FOLDER = 'application/tests'; |
|
| 14 | 14 | |
| 15 | - public static function install() |
|
| 16 | - { |
|
| 17 | - self::recursiveCopy( |
|
| 18 | - 'vendor/kenjis/ci-phpunit-test/application/tests', |
|
| 19 | - static::TEST_FOLDER |
|
| 20 | - ); |
|
| 21 | - self::fixPath(); |
|
| 22 | - } |
|
| 15 | + public static function install() |
|
| 16 | + { |
|
| 17 | + self::recursiveCopy( |
|
| 18 | + 'vendor/kenjis/ci-phpunit-test/application/tests', |
|
| 19 | + static::TEST_FOLDER |
|
| 20 | + ); |
|
| 21 | + self::fixPath(); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Fix paths in Bootstrap.php |
|
| 26 | - */ |
|
| 27 | - private static function fixPath() |
|
| 28 | - { |
|
| 29 | - $file = static::TEST_FOLDER . '/Bootstrap.php'; |
|
| 30 | - $contents = file_get_contents($file); |
|
| 24 | + /** |
|
| 25 | + * Fix paths in Bootstrap.php |
|
| 26 | + */ |
|
| 27 | + private static function fixPath() |
|
| 28 | + { |
|
| 29 | + $file = static::TEST_FOLDER . '/Bootstrap.php'; |
|
| 30 | + $contents = file_get_contents($file); |
|
| 31 | 31 | |
| 32 | - if (! file_exists('system')) { |
|
| 33 | - if (file_exists('vendor/codeigniter/framework/system')) { |
|
| 34 | - $contents = str_replace( |
|
| 35 | - '$system_path = \'../../system\';', |
|
| 36 | - '$system_path = \'../../vendor/codeigniter/framework/system\';', |
|
| 37 | - $contents |
|
| 38 | - ); |
|
| 39 | - } else { |
|
| 40 | - throw new Exception('Can\'t find "system" folder.'); |
|
| 41 | - } |
|
| 42 | - } |
|
| 32 | + if (! file_exists('system')) { |
|
| 33 | + if (file_exists('vendor/codeigniter/framework/system')) { |
|
| 34 | + $contents = str_replace( |
|
| 35 | + '$system_path = \'../../system\';', |
|
| 36 | + '$system_path = \'../../vendor/codeigniter/framework/system\';', |
|
| 37 | + $contents |
|
| 38 | + ); |
|
| 39 | + } else { |
|
| 40 | + throw new Exception('Can\'t find "system" folder.'); |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - if (! file_exists('index.php')) { |
|
| 45 | - if (file_exists('public/index.php')) { |
|
| 46 | - $contents = str_replace( |
|
| 47 | - "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
|
| 48 | - "define('FCPATH', realpath(dirname(__FILE__).'/../../public').'/');", |
|
| 49 | - $contents |
|
| 50 | - ); |
|
| 51 | - } else { |
|
| 52 | - throw new Exception('Can\'t find "index.php".'); |
|
| 53 | - } |
|
| 54 | - } |
|
| 44 | + if (! file_exists('index.php')) { |
|
| 45 | + if (file_exists('public/index.php')) { |
|
| 46 | + $contents = str_replace( |
|
| 47 | + "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
|
| 48 | + "define('FCPATH', realpath(dirname(__FILE__).'/../../public').'/');", |
|
| 49 | + $contents |
|
| 50 | + ); |
|
| 51 | + } else { |
|
| 52 | + throw new Exception('Can\'t find "index.php".'); |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - file_put_contents($file, $contents); |
|
| 57 | - } |
|
| 56 | + file_put_contents($file, $contents); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - public static function update() |
|
| 60 | - { |
|
| 61 | - self::recursiveUnlink('application/tests/_ci_phpunit_test'); |
|
| 62 | - self::recursiveCopy( |
|
| 63 | - 'vendor/kenjis/ci-phpunit-test/application/tests/_ci_phpunit_test', |
|
| 64 | - 'application/tests/_ci_phpunit_test' |
|
| 65 | - ); |
|
| 66 | - } |
|
| 59 | + public static function update() |
|
| 60 | + { |
|
| 61 | + self::recursiveUnlink('application/tests/_ci_phpunit_test'); |
|
| 62 | + self::recursiveCopy( |
|
| 63 | + 'vendor/kenjis/ci-phpunit-test/application/tests/_ci_phpunit_test', |
|
| 64 | + 'application/tests/_ci_phpunit_test' |
|
| 65 | + ); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Recursive Copy |
|
| 70 | - * |
|
| 71 | - * @param string $src |
|
| 72 | - * @param string $dst |
|
| 73 | - */ |
|
| 74 | - private static function recursiveCopy($src, $dst) |
|
| 75 | - { |
|
| 76 | - @mkdir($dst, 0755); |
|
| 68 | + /** |
|
| 69 | + * Recursive Copy |
|
| 70 | + * |
|
| 71 | + * @param string $src |
|
| 72 | + * @param string $dst |
|
| 73 | + */ |
|
| 74 | + private static function recursiveCopy($src, $dst) |
|
| 75 | + { |
|
| 76 | + @mkdir($dst, 0755); |
|
| 77 | 77 | |
| 78 | - $iterator = new \RecursiveIteratorIterator( |
|
| 79 | - new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 80 | - \RecursiveIteratorIterator::SELF_FIRST |
|
| 81 | - ); |
|
| 78 | + $iterator = new \RecursiveIteratorIterator( |
|
| 79 | + new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 80 | + \RecursiveIteratorIterator::SELF_FIRST |
|
| 81 | + ); |
|
| 82 | 82 | |
| 83 | - foreach ($iterator as $file) { |
|
| 84 | - if ($file->isDir()) { |
|
| 85 | - @mkdir($dst . '/' . $iterator->getSubPathName()); |
|
| 86 | - } else { |
|
| 87 | - $success = copy($file, $dst . '/' . $iterator->getSubPathName()); |
|
| 88 | - if ($success) { |
|
| 89 | - echo 'copied: ' . $dst . '/' . $iterator->getSubPathName() . PHP_EOL; |
|
| 90 | - } |
|
| 91 | - } |
|
| 92 | - } |
|
| 93 | - } |
|
| 83 | + foreach ($iterator as $file) { |
|
| 84 | + if ($file->isDir()) { |
|
| 85 | + @mkdir($dst . '/' . $iterator->getSubPathName()); |
|
| 86 | + } else { |
|
| 87 | + $success = copy($file, $dst . '/' . $iterator->getSubPathName()); |
|
| 88 | + if ($success) { |
|
| 89 | + echo 'copied: ' . $dst . '/' . $iterator->getSubPathName() . PHP_EOL; |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * Recursive Unlink |
|
| 97 | - * |
|
| 98 | - * @param string $dir |
|
| 99 | - */ |
|
| 100 | - private static function recursiveUnlink($dir) |
|
| 101 | - { |
|
| 102 | - $iterator = new \RecursiveIteratorIterator( |
|
| 103 | - new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 104 | - \RecursiveIteratorIterator::CHILD_FIRST |
|
| 105 | - ); |
|
| 95 | + /** |
|
| 96 | + * Recursive Unlink |
|
| 97 | + * |
|
| 98 | + * @param string $dir |
|
| 99 | + */ |
|
| 100 | + private static function recursiveUnlink($dir) |
|
| 101 | + { |
|
| 102 | + $iterator = new \RecursiveIteratorIterator( |
|
| 103 | + new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 104 | + \RecursiveIteratorIterator::CHILD_FIRST |
|
| 105 | + ); |
|
| 106 | 106 | |
| 107 | - foreach ($iterator as $file) { |
|
| 108 | - if ($file->isDir()) { |
|
| 109 | - rmdir($file); |
|
| 110 | - } else { |
|
| 111 | - unlink($file); |
|
| 112 | - } |
|
| 113 | - } |
|
| 107 | + foreach ($iterator as $file) { |
|
| 108 | + if ($file->isDir()) { |
|
| 109 | + rmdir($file); |
|
| 110 | + } else { |
|
| 111 | + unlink($file); |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - rmdir($dir); |
|
| 116 | - } |
|
| 115 | + rmdir($dir); |
|
| 116 | + } |
|
| 117 | 117 | } |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of CI PHPUnit Test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of CI PHPUnit Test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | namespace Kenjis\MonkeyPatch; |
| 12 | 12 | |
@@ -251,10 +251,10 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
| 254 | - * Recursive Unlink |
|
| 255 | - * |
|
| 256 | - * @param string $dir |
|
| 257 | - */ |
|
| 254 | + * Recursive Unlink |
|
| 255 | + * |
|
| 256 | + * @param string $dir |
|
| 257 | + */ |
|
| 258 | 258 | protected static function recursiveUnlink($dir) |
| 259 | 259 | { |
| 260 | 260 | if (! is_dir($dir)) |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of CI PHPUnit Test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of CI PHPUnit Test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | require __DIR__ . '/Installer.php'; |
| 12 | 12 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of CI PHPUnit Test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of CI PHPUnit Test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | require __DIR__ . '/Installer.php'; |
| 12 | 12 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of CI PHPUnit Test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of CI PHPUnit Test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | require __DIR__ . '/Installer.php'; |
| 12 | 12 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of CI PHPUnit Test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of CI PHPUnit Test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | require __DIR__ . '/Installer.php'; |
| 12 | 12 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of CI PHPUnit Test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of CI PHPUnit Test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | require __DIR__ . '/Installer.php'; |
| 12 | 12 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of CI PHPUnit Test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of CI PHPUnit Test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | require __DIR__ . '/Installer.php'; |
| 12 | 12 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of CI PHPUnit Test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of CI PHPUnit Test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | require __DIR__ . '/Installer.php'; |
| 12 | 12 | |