Merge branch 'master' into 'master'
1.0.1 Release The release of 1.01 Development of 1.02 will now commence. See merge request !53
This commit is contained in:
commit
85b11b082d
|
@ -1,7 +1,8 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitlab_ci.yml export-ignore
|
||||
.gitlab-ci.yml export-ignore
|
||||
.travis.yml export-ignore
|
||||
tests/ export-ignore
|
||||
CI/ export-ignore
|
||||
Application/ export-ignore
|
||||
Application/ export-ignore
|
||||
DCO export-ignore
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
n<?php
|
||||
<?php
|
||||
/**
|
||||
* FuzeWorks.
|
||||
*
|
||||
|
@ -27,7 +27,7 @@ n<?php
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
n<?php
|
||||
<?php
|
||||
/**
|
||||
* FuzeWorks.
|
||||
*
|
||||
|
@ -27,7 +27,7 @@ n<?php
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks;
|
||||
|
@ -516,7 +516,7 @@ class Logger {
|
|||
Layout::view($view);
|
||||
} catch (LayoutException $exception) {
|
||||
// No error page could be found, just echo the result
|
||||
echo "<h1>$errno</h1><h3>" . $http_codes[$errno] . '</h3>';
|
||||
Factory::getInstance()->output->set_output("<h1>$errno</h1><h3>" . $http_codes[$errno] . '</h3>');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
namespace FuzeWorks;
|
||||
|
@ -79,8 +79,28 @@ class LoggerTracyBridge implements IBarPanel {
|
|||
|
||||
public function getPanel()
|
||||
{
|
||||
// If an error is thrown, log it
|
||||
$errfile = 'Unknown file';
|
||||
$errstr = 'shutdown';
|
||||
$errno = E_CORE_ERROR;
|
||||
$errline = 0;
|
||||
|
||||
$error = error_get_last();
|
||||
if ($error !== null) {
|
||||
$errno = $error['type'];
|
||||
$errfile = $error['file'];
|
||||
$errline = $error['line'];
|
||||
$errstr = $error['message'];
|
||||
|
||||
// Log it!
|
||||
Logger::errorHandler($errno, $errstr, $errfile, $errline);
|
||||
}
|
||||
|
||||
// Reverse the logs
|
||||
$logs = array_reverse(Logger::$Logs, true);
|
||||
|
||||
// Parse the panel
|
||||
ob_start(function () {});
|
||||
$logs = Logger::$Logs;
|
||||
require dirname(__DIR__) . '/views/view.tracyloggerpanel.php';
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Type</th>
|
||||
<th>Message</th>
|
||||
<th>File</th>
|
||||
|
@ -47,7 +48,7 @@
|
|||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($logs as $log): ?>
|
||||
<?php foreach ($logs as $key => $log): ?>
|
||||
<?php if ($log['type'] === 'LEVEL_STOP')
|
||||
{
|
||||
continue;
|
||||
|
@ -58,6 +59,7 @@
|
|||
}
|
||||
?>
|
||||
<tr class="<?php echo($log['type']); ?>">
|
||||
<td><?php echo( htmlspecialchars($key)); ?></td>
|
||||
<td><?php echo( htmlspecialchars ($log['type'])); ?></td>
|
||||
<td><?php echo( htmlspecialchars ($log['message'])); ?></td>
|
||||
<td><?php echo( empty($log['logFile']) ? 'x' : htmlspecialchars ($log['logFile'])); ?></td>
|
||||
|
|
|
@ -27,11 +27,12 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
use FuzeWorks\Events;
|
||||
use FuzeWorks\Layout;
|
||||
use FuzeWorks\Factory;
|
||||
use FuzeWorks\LoggerTracyBridge;
|
||||
|
||||
/**
|
||||
* Class CoreTestAbstract.
|
||||
|
@ -47,9 +48,19 @@ abstract class CoreTestAbstract extends PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
// Clear all events created by tests
|
||||
Events::$listeners = array();
|
||||
|
||||
// Re-register the LoggerTracyBridge to supress errors
|
||||
LoggerTracyBridge::register();
|
||||
|
||||
// Reset the layout manager
|
||||
Layout::reset();
|
||||
|
||||
// Re-enable events, in case they have been disabled
|
||||
Events::enable();
|
||||
|
||||
// Clear the output
|
||||
Factory::getInstance()->output->set_output('');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ $parameters = array(
|
|||
);
|
||||
$configurator->setParameters($parameters);
|
||||
|
||||
$configurator->setDebugMode(true);
|
||||
$configurator->setTimeZone('Europe/Amsterdam');
|
||||
$configurator->setTempDirectory(__DIR__ . '/temp');
|
||||
$configurator->setLogDirectory(__DIR__ . '/temp');
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
use FuzeWorks\Factory;
|
||||
use FuzeWorks\Config;
|
||||
|
||||
/**
|
||||
* Class ConfigTest.
|
||||
|
@ -43,8 +43,7 @@ class configTest extends CoreTestAbstract
|
|||
|
||||
public function setUp()
|
||||
{
|
||||
$factory = Factory::getInstance();
|
||||
$this->config = $factory->config;
|
||||
$this->config = new Config();
|
||||
}
|
||||
|
||||
public function testGetConfigClass()
|
||||
|
|
|
@ -0,0 +1,196 @@
|
|||
<?php
|
||||
/**
|
||||
* FuzeWorks.
|
||||
*
|
||||
* The FuzeWorks MVC PHP FrameWork
|
||||
*
|
||||
* Copyright (C) 2015 TechFuze
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @author TechFuze
|
||||
* @copyright Copyright (c) 2013 - 2016, Techfuze. (http://techfuze.net)
|
||||
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
|
||||
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
|
||||
*
|
||||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
use FuzeWorks\Exception\Exception;
|
||||
use FuzeWorks\Exception\CoreException;
|
||||
use FuzeWorks\Exception\ConfigException;
|
||||
use FuzeWorks\Exception\DatabaseException;
|
||||
use FuzeWorks\Exception\EventException;
|
||||
use FuzeWorks\Exception\FactoryException;
|
||||
use FuzeWorks\Exception\HelperException;
|
||||
use FuzeWorks\Exception\InvalidArgumentException;
|
||||
use FuzeWorks\Exception\LanguageException;
|
||||
use FuzeWorks\Exception\LayoutException;
|
||||
use FuzeWorks\Exception\LibraryException;
|
||||
use FuzeWorks\Exception\LoggerException;
|
||||
use FuzeWorks\Exception\ModelException;
|
||||
use FuzeWorks\Exception\ModuleException;
|
||||
use FuzeWorks\Exception\RouterException;
|
||||
use FuzeWorks\Exception\SecurityException;
|
||||
use FuzeWorks\Exception\UriException;
|
||||
|
||||
/**
|
||||
* Class ExceptionTest.
|
||||
*
|
||||
* Exception testing suite, tests if all exceptions can be fired
|
||||
*/
|
||||
class exceptionTestTest extends CoreTestAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\Exception
|
||||
*/
|
||||
public function testException()
|
||||
{
|
||||
throw new Exception("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\CoreException
|
||||
*/
|
||||
public function testCoreException()
|
||||
{
|
||||
throw new CoreException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\ConfigException
|
||||
*/
|
||||
public function testConfigException()
|
||||
{
|
||||
throw new ConfigException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\DatabaseException
|
||||
*/
|
||||
public function testDatabaseException()
|
||||
{
|
||||
throw new DatabaseException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\EventException
|
||||
*/
|
||||
public function testEventException()
|
||||
{
|
||||
throw new EventException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\FactoryException
|
||||
*/
|
||||
public function testFactoryException()
|
||||
{
|
||||
throw new FactoryException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\HelperException
|
||||
*/
|
||||
public function testHelperException()
|
||||
{
|
||||
throw new HelperException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidArgumentException()
|
||||
{
|
||||
throw new InvalidArgumentException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\LayoutException
|
||||
*/
|
||||
public function testLayoutException()
|
||||
{
|
||||
throw new LayoutException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\LanguageException
|
||||
*/
|
||||
public function testLanguageException()
|
||||
{
|
||||
throw new LanguageException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\LibraryException
|
||||
*/
|
||||
public function testLibraryException()
|
||||
{
|
||||
throw new LibraryException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\LoggerException
|
||||
*/
|
||||
public function testLoggerException()
|
||||
{
|
||||
throw new LoggerException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\ModelException
|
||||
*/
|
||||
public function testModelException()
|
||||
{
|
||||
throw new ModelException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\ModuleException
|
||||
*/
|
||||
public function testModuleException()
|
||||
{
|
||||
throw new ModuleException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\RouterException
|
||||
*/
|
||||
public function testRouterException()
|
||||
{
|
||||
throw new RouterException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\SecurityException
|
||||
*/
|
||||
public function testSecurityException()
|
||||
{
|
||||
throw new SecurityException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FuzeWorks\Exception\UriException
|
||||
*/
|
||||
public function testUriException()
|
||||
{
|
||||
throw new UriException("Exception Test Run", 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -27,11 +27,12 @@
|
|||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 0.0.1
|
||||
*
|
||||
* @version Version 1.0.0
|
||||
* @version Version 1.0.1
|
||||
*/
|
||||
|
||||
use FuzeWorks\Config;
|
||||
use FuzeWorks\Logger;
|
||||
use FuzeWorks\Factory;
|
||||
use FuzeWorks\Exception\LoggerException;
|
||||
|
||||
/**
|
||||
|
@ -43,9 +44,12 @@ class loggerTest extends CoreTestAbstract
|
|||
{
|
||||
protected $logger;
|
||||
|
||||
protected $output;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
Config::get('error')->error_reporting = false;
|
||||
$this->output = Factory::getInstance()->output;
|
||||
Logger::$Logs = array();
|
||||
}
|
||||
|
||||
|
@ -111,14 +115,11 @@ class loggerTest extends CoreTestAbstract
|
|||
// Create the exception
|
||||
$exception = new LoggerException();
|
||||
|
||||
// Prepare output buffering
|
||||
ob_start(function () {});
|
||||
|
||||
// Log the exception
|
||||
Logger::exceptionHandler($exception);
|
||||
|
||||
// Check the output
|
||||
$this->assertEquals('<h1>500</h1><h3>Internal Server Error</h3>', ob_get_clean());
|
||||
$this->assertEquals('<h1>500</h1><h3>Internal Server Error</h3>', $this->output->get_output());
|
||||
|
||||
// Check the logs
|
||||
$log = Logger::$Logs[0];
|
||||
|
@ -209,34 +210,31 @@ class loggerTest extends CoreTestAbstract
|
|||
|
||||
// Test all error codes
|
||||
foreach ($http_codes as $code => $description) {
|
||||
// Prepare output buffering
|
||||
ob_start(function () {});
|
||||
|
||||
// Fire the error
|
||||
Logger::http_error($code);
|
||||
|
||||
// Check the output
|
||||
$this->assertEquals('<h1>'.$code.'</h1><h3>'.$description.'</h3>', ob_get_clean());
|
||||
$this->assertEquals('<h1>'.$code.'</h1><h3>'.$description.'</h3>', $this->output->get_output());
|
||||
}
|
||||
|
||||
// Test when not viewing
|
||||
Logger::http_error(404, false);
|
||||
}
|
||||
|
||||
public function testEnable()
|
||||
public function testEnableDisable()
|
||||
{
|
||||
// First enable
|
||||
Logger::enable();
|
||||
$this->assertTrue(Logger::isEnabled());
|
||||
}
|
||||
|
||||
public function testDisable()
|
||||
{
|
||||
// Then disable
|
||||
Logger::disable();
|
||||
$this->assertFalse(Logger::isEnabled());
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
Logger::disable();
|
||||
Logger::$Logs = array();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue