public function testWarn() { $msg = 'msg de test'; $expected = '/^\\w+ \\d+ \\d+:\\d+:\\d+ \\[WARN\\] ' . $msg . '$/'; $this->object->warn($msg); $file = file(self::$_filename); $this->assertRegExp($expected, $file[count($file) - 1]); }
/** * Register a new task name under the specified key. * $obj is a class which implements the ITask interface * and has an execute() method defined. * * @param string $taskName The name of task * @param Phigrate_Task_ITask $taskObj The task object * * @return boolean */ public function registerTask($taskName, $taskObj) { $this->_logger->debug(__METHOD__ . ' Start'); if ($this->hasTask($taskName)) { $msg = sprintf("Task name '%s' is already defined!", $taskName); $this->_logger->warn($msg); require_once 'Phigrate/Exception/Argument.php'; throw new Phigrate_Exception_Argument($msg); } if (!$taskObj instanceof Phigrate_Task_ITask) { $msg = 'Task (' . $taskName . ') does not implement Phigrate_ITask'; $this->_logger->warn($msg); require_once 'Phigrate/Exception/Argument.php'; throw new Phigrate_Exception_Argument($msg); } $this->_logger->debug('migrationDir: ' . $this->_migrationDir); $taskObj->setDirectoryOfMigrations($this->_migrationDir); $this->_tasks[$taskName] = $taskObj; $this->_logger->debug(__METHOD__ . ' End'); return true; }