Created
May 1, 2010 20:35
-
-
Save havvg/386638 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once(dirname(__FILE__) . '/../bootstrap/task.php'); | |
# load fixtures of this plugin | |
$propelData->loadData(sfConfig::get('sf_plugins_dir') . '/yetAnotherPlugin/data/fixtures'); | |
$limeTest = new lime_test(1, new lime_output_color()); | |
$task = new ExampleTask($dispatcher, $formatter); | |
$task->run(array(), array()); | |
$logs = $logger->getLogEntries(); | |
$limeTest->like($logs[0], '/Task did log something/', 'Log entry found.'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// initialize configuration | |
$_test_dir = realpath(dirname(__FILE__) . '/..'); | |
require_once(dirname(__FILE__) . '/../../config/ProjectConfiguration.class.php'); | |
$configuration = new ProjectConfiguration(realpath($_test_dir . '/..')); | |
// initialize lime | |
require_once($configuration->getSymfonyLibDir() . '/vendor/lime/lime.php'); | |
// add autoloader | |
require_once($configuration->getSymfonyLibDir() . '/autoload/sfCoreAutoload.class.php'); | |
sfCoreAutoload::register(); | |
// add propel database fixture loader | |
new sfDatabaseManager(ProjectConfiguration::getApplicationConfiguration('frontend', 'test', true)); | |
$propelData = new sfPropelData(); | |
class TaskLogger | |
{ | |
protected $logEntries = array(); | |
public function log(sfEvent $event) | |
{ | |
$params = $event->getParameters(); | |
$this->logEntries[] = $params[0]; | |
} | |
public function getLogEntries() | |
{ | |
return $this->logEntries; | |
} | |
} | |
$logger = new TaskLogger(); | |
$formatter = new sfFormatter(80); | |
$dispatcher = new sfEventDispatcher(); | |
$dispatcher->connect('command.log', array($logger, "log")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment