PHP Classes

File: Tests/AbstractTestCase.php

Recommend this page to a friend!
  Classes of Joseluis Laso   Simple Logger   Tests/AbstractTestCase.php   Download  
File: Tests/AbstractTestCase.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Simple Logger
Log messages and view log filtered files
Author: By
Last change: Update of Tests/AbstractTestCase.php
Date: 1 year ago
Size: 1,057 bytes
 

Contents

Class file image Download
<?php

namespace JLaso\SimpleLogger\Tests;

use
Symfony\Component\Yaml\Yaml;

abstract class
AbstractTestCase extends \PHPUnit_Framework_TestCase
{
   
/** @var string */
   
protected $tmpFile;
   
/** @var string */
   
protected $loggerFile;
   
/** @var array */
   
protected $testConfig;

    protected function
setUp()
    {
       
$this->tmpFile = dirname(__DIR__) . '/config-simple-logger.yml';
       
$this->loggerFile = __DIR__ . '/logger.log';

       
$this->testConfig = array(
           
'logger' => array(
               
'path' => $this->loggerFile,
               
'level' => 'error',
               
'date_format' => '',
            ),
        );

       
file_put_contents($this->tmpFile, Yaml::dump($this->testConfig));
    }

    protected function
tearDown()
    {
       
$this->cleanTmp();
    }

    protected function
cleanTmp()
    {
        if (
file_exists($this->tmpFile)) {
           
unlink($this->tmpFile);
        }
        if (
file_exists($this->loggerFile)) {
           
unlink($this->loggerFile);
        }
    }
}