| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
class sfTestsUpgrade extends sfUpgrade |
|---|
| 20 |
{ |
|---|
| 21 |
public function upgrade() |
|---|
| 22 |
{ |
|---|
| 23 |
if (file_exists($file = sfConfig::get('sf_test_dir').'/bootstrap/unit.php')) |
|---|
| 24 |
{ |
|---|
| 25 |
$current = file_get_contents($file); |
|---|
| 26 |
|
|---|
| 27 |
$new = file_get_contents(sfConfig::get('sf_symfony_lib_dir').'/task/generator/skeleton/project/test/bootstrap/unit.php'); |
|---|
| 28 |
$old = <<<EOF |
|---|
| 29 |
<?php |
|---|
| 30 |
|
|---|
| 31 |
/* |
|---|
| 32 |
* This file is part of the symfony package. |
|---|
| 33 |
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> |
|---|
| 34 |
* |
|---|
| 35 |
* For the full copyright and license information, please view the LICENSE |
|---|
| 36 |
* file that was distributed with this source code. |
|---|
| 37 |
*/ |
|---|
| 38 |
|
|---|
| 39 |
\$_test_dir = realpath(dirname(__FILE__).'/..'); |
|---|
| 40 |
|
|---|
| 41 |
require_once(dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'); |
|---|
| 42 |
\$configuration = new ProjectConfiguration(realpath(\$_test_dir.'/..')); |
|---|
| 43 |
include(\$configuration->getSymfonyLibDir().'/vendor/lime/lime.php'); |
|---|
| 44 |
|
|---|
| 45 |
EOF; |
|---|
| 46 |
|
|---|
| 47 |
if ($old == $current) |
|---|
| 48 |
{ |
|---|
| 49 |
$this->logSection('file+', $file); |
|---|
| 50 |
file_put_contents($file, $new); |
|---|
| 51 |
} |
|---|
| 52 |
else if ($new != $current) |
|---|
| 53 |
{ |
|---|
| 54 |
$temp = sfConfig::get('sf_test_dir').'/bootstrap/unit_new.php'; |
|---|
| 55 |
|
|---|
| 56 |
$this->logSection('tests', 'You must update test/bootstrap/unit.php manually', null, 'ERROR'); |
|---|
| 57 |
$this->logSection('tests', 'see '.$temp, null, 'ERROR'); |
|---|
| 58 |
|
|---|
| 59 |
$this->logSection('file+', $temp); |
|---|
| 60 |
file_put_contents($temp, $new); |
|---|
| 61 |
} |
|---|
| 62 |
} |
|---|
| 63 |
} |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|