Development

/branches/1.3/lib/task/project/upgrade1.3/sfTestsUpgrade.class.php

You must first sign up to be able to contribute.

root/branches/1.3/lib/task/project/upgrade1.3/sfTestsUpgrade.class.php

Revision 23205, 1.8 kB (checked in by Kris.Wallsmith, 5 years ago)

[1.3] fixed project autoloading in unit tests

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * Upgrades project tests.
13  *
14  * @package    symfony
15  * @subpackage task
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
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
Note: See TracBrowser for help on using the browser.