开发者

How to run lime test in Symfony plugin?

开发者 https://www.devze.com 2023-03-14 03:36 出处:网络
I have a plugin in Symfony 1.4 and I have created for him some tests put them in ROOT/myPlugin/test/unit/MyTest.php

I have a plugin in Symfony 1.4 and I have created for him some tests put them in ROOT/myPlugin/test/unit/MyTest.php

The plugin was generated with sfTaskExtraPlugin.

The content of MyTest.php is:

<?php

require_once dirname(__FILE__).'/../bootstrap/unit.php';
$t = new lime_test(1); 
$r = new My();
$v = $r->getSomething(2);
$t->is($v, true);         

?>

When I run ./symfony test:unit Rights the response is >> test no tests found

However if I copy MyTest.php file in ROOT/test/unit the command ./symfony test:unit Rig开发者_运维百科hts is working.

The plugin is enabled in ProjectConfiguration.class.php

Why the test are not working if I write them in plugin?


Plugin's tests are not run by default (for good reason - why would you want to run tests for a 3rd party plugin every time you want to test your app?).

Edit your ProjectConfiguration like this:

class ProjectConfiguration extends sfProjectConfiguration
{
  public function setup()
  {
    $this->enablePlugins('myPlugin');
  }

  public function setupPlugins()
  {
    $this->pluginConfigurations['myPlugin']->connectTests();
  }
}

this will run the given plugin's tests along with the project's. Taken from symfony.com, about testing plugins.

0

精彩评论

暂无评论...
验证码 换一张
取 消