rewrite test after Tlog refactoring

This commit is contained in:
Manuel Raynaud
2013-01-19 22:52:51 +01:00
parent f3f8793074
commit 88a82c69d1
11 changed files with 58 additions and 154 deletions

View File

@@ -56,6 +56,9 @@ class TlogDestinationFile extends AbstractTlogDestination
if (! is_dir($dir)) {
mkdir($dir, 0777, true);
}
touch($file_path);
chmod($file_path, 0777);
}
if ($this->fh) @fclose($this->fh);

View File

@@ -27,22 +27,22 @@ use Thelia\Log\AbstractTlogDestination;
class TlogDestinationNull extends AbstractTlogDestination
{
public function get_titre()
public function getTitle()
{
return "Trou noir";
}
public function get_description()
public function getDescription()
{
return "Cette destination ne provoque aucune sortie";
}
public function ajouter($string)
public function add($string)
{
// Rien
}
public function ecrire(&$res)
public function write(&$res)
{
// Rien
}

View File

@@ -32,22 +32,22 @@ class TlogDestinationText extends AbstractTlogDestination
parent::__construct();
}
public function get_titre()
public function getTitle()
{
return "Affichage direct dans la page, en texte brut";
}
public function get_description()
public function getDescription()
{
return "Permet d'afficher les logs directement dans la page resultat, au format texte brut.";
}
public function ajouter($texte)
public function add($texte)
{
echo $texte."\n";
}
public function ecrire(&$res)
public function write(&$res)
{
// Rien
}

View File

@@ -23,7 +23,6 @@
namespace Thelia\Log;
use Thelia\Model\ConfigQuery;
use Psr\Log\LoggerInterface;
/**
*
@@ -61,6 +60,10 @@ class Tlog Implements TlogInterface
const DEFAUT_IP = "";
const DEFAUT_SHOW_REDIRECT = 0;
/**
*
* @var \Thelia\Log\Tlog
*/
private static $instance = false;
protected $destinations = array();
@@ -88,7 +91,7 @@ class Tlog Implements TlogInterface
*
* @return \Thelia\Log\Tlog
*/
public static function instance() {
public static function getInstance() {
if (self::$instance == false) {
self::$instance = new Tlog();