mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
parent
5ddade85a5
commit
537b53859f
@ -20,6 +20,7 @@ class Kernel extends ConsoleKernel
|
|||||||
* Define the application's command schedule.
|
* Define the application's command schedule.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function schedule(Schedule $schedule)
|
protected function schedule(Schedule $schedule)
|
||||||
|
@ -30,6 +30,7 @@ class Handler extends ExceptionHandler
|
|||||||
* Report or log an exception.
|
* Report or log an exception.
|
||||||
*
|
*
|
||||||
* @param \Exception $exception
|
* @param \Exception $exception
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function report(Exception $exception)
|
public function report(Exception $exception)
|
||||||
@ -42,6 +43,7 @@ class Handler extends ExceptionHandler
|
|||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \Exception $exception
|
* @param \Exception $exception
|
||||||
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function render($request, Exception $exception)
|
public function render($request, Exception $exception)
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Auth;
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
use App\User;
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\User;
|
||||||
|
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
|
||||||
|
|
||||||
class RegisterController extends Controller
|
class RegisterController extends Controller
|
||||||
{
|
{
|
||||||
@ -44,6 +44,7 @@ class RegisterController extends Controller
|
|||||||
* Get a validator for an incoming registration request.
|
* Get a validator for an incoming registration request.
|
||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
|
*
|
||||||
* @return \Illuminate\Contracts\Validation\Validator
|
* @return \Illuminate\Contracts\Validation\Validator
|
||||||
*/
|
*/
|
||||||
protected function validator(array $data)
|
protected function validator(array $data)
|
||||||
@ -59,6 +60,7 @@ class RegisterController extends Controller
|
|||||||
* Create a new user instance after a valid registration.
|
* Create a new user instance after a valid registration.
|
||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
|
*
|
||||||
* @return \App\User
|
* @return \App\User
|
||||||
*/
|
*/
|
||||||
protected function create(array $data)
|
protected function create(array $data)
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
|
||||||
use Illuminate\Routing\Controller as BaseController;
|
|
||||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
|
||||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
|
|
||||||
class Controller extends BaseController
|
class Controller extends BaseController
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@ class Authenticate extends Middleware
|
|||||||
* Get the path the user should be redirected to when they are not authenticated.
|
* Get the path the user should be redirected to when they are not authenticated.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function redirectTo($request)
|
protected function redirectTo($request)
|
||||||
|
@ -13,6 +13,7 @@ class RedirectIfAuthenticated
|
|||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \Closure $next
|
* @param \Closure $next
|
||||||
* @param string|null $guard
|
* @param string|null $guard
|
||||||
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next, $guard = null)
|
public function handle($request, Closure $next, $guard = null)
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Fideloper\Proxy\TrustProxies as Middleware;
|
use Fideloper\Proxy\TrustProxies as Middleware;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class TrustProxies extends Middleware
|
class TrustProxies extends Middleware
|
||||||
{
|
{
|
||||||
|
@ -3,16 +3,15 @@
|
|||||||
namespace App\Models\Traits;
|
namespace App\Models\Traits;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CalculatesInvoiceTotals
|
* Class CalculatesInvoiceTotals.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CalculatesInvoiceTotals
|
class CalculatesInvoiceTotals
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $invoice;
|
protected $invoice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* InvoiceTotals constructor.
|
* InvoiceTotals constructor.
|
||||||
|
*
|
||||||
* @param $invoice
|
* @param $invoice
|
||||||
*/
|
*/
|
||||||
public function __construct($invoice)
|
public function __construct($invoice)
|
||||||
@ -20,16 +19,11 @@ class CalculatesInvoiceTotals
|
|||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function calculate()
|
public function calculate()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function sumLineItems()
|
private function sumLineItems()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Gate;
|
|
||||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
class AuthServiceProvider extends ServiceProvider
|
class AuthServiceProvider extends ServiceProvider
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
use Illuminate\Support\Facades\Broadcast;
|
use Illuminate\Support\Facades\Broadcast;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
class BroadcastServiceProvider extends ServiceProvider
|
class BroadcastServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Event;
|
|
||||||
use Illuminate\Auth\Events\Registered;
|
use Illuminate\Auth\Events\Registered;
|
||||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Event;
|
||||||
|
|
||||||
class EventServiceProvider extends ServiceProvider
|
class EventServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
|
||||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
class RouteServiceProvider extends ServiceProvider
|
class RouteServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
use Illuminate\Notifications\Notifiable;
|
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
|
@ -3,19 +3,18 @@
|
|||||||
namespace App\Utils;
|
namespace App\Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class NumberHelper
|
* Class NumberHelper.
|
||||||
* @package App\Utils
|
|
||||||
*/
|
*/
|
||||||
class NumberHelper
|
class NumberHelper
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param float $value
|
* @param float $value
|
||||||
* @param int $precision
|
* @param int $precision
|
||||||
|
*
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public static function roundValue(float $value, int $precision = 2) : float
|
public static function roundValue(float $value, int $precision = 2) : float
|
||||||
{
|
{
|
||||||
return round($value, $precision, PHP_ROUND_HALF_UP);
|
return round($value, $precision, PHP_ROUND_HALF_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
116
c3.php
116
c3.php
@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// @codingStandardsIgnoreFile
|
// @codingStandardsIgnoreFile
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
/**
|
/**
|
||||||
* C3 - Codeception Code Coverage
|
* C3 - Codeception Code Coverage.
|
||||||
*
|
*
|
||||||
* @author tiger
|
* @author tiger
|
||||||
*/
|
*/
|
||||||
@ -16,7 +17,7 @@ if (isset($_COOKIE['CODECEPTION_CODECOVERAGE'])) {
|
|||||||
}
|
}
|
||||||
if ($cookie) {
|
if ($cookie) {
|
||||||
foreach ($cookie as $key => $value) {
|
foreach ($cookie as $key => $value) {
|
||||||
$_SERVER["HTTP_X_CODECEPTION_" . strtoupper($key)] = $value;
|
$_SERVER['HTTP_X_CODECEPTION_'.strtoupper($key)] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -28,14 +29,14 @@ if (!function_exists('__c3_error')) {
|
|||||||
{
|
{
|
||||||
$errorLogFile = defined('C3_CODECOVERAGE_ERROR_LOG_FILE') ?
|
$errorLogFile = defined('C3_CODECOVERAGE_ERROR_LOG_FILE') ?
|
||||||
C3_CODECOVERAGE_ERROR_LOG_FILE :
|
C3_CODECOVERAGE_ERROR_LOG_FILE :
|
||||||
C3_CODECOVERAGE_MEDIATE_STORAGE . DIRECTORY_SEPARATOR . 'error.txt';
|
C3_CODECOVERAGE_MEDIATE_STORAGE.DIRECTORY_SEPARATOR.'error.txt';
|
||||||
if (is_writable($errorLogFile)) {
|
if (is_writable($errorLogFile)) {
|
||||||
file_put_contents($errorLogFile, $message);
|
file_put_contents($errorLogFile, $message);
|
||||||
} else {
|
} else {
|
||||||
$message = "Could not write error to log file ($errorLogFile), original message: $message";
|
$message = "Could not write error to log file ($errorLogFile), original message: $message";
|
||||||
}
|
}
|
||||||
if (!headers_sent()) {
|
if (!headers_sent()) {
|
||||||
header('X-Codeception-CodeCoverage-Error: ' . str_replace("\n", ' ', $message), true, 500);
|
header('X-Codeception-CodeCoverage-Error: '.str_replace("\n", ' ', $message), true, 500);
|
||||||
}
|
}
|
||||||
setcookie('CODECEPTION_CODECOVERAGE_ERROR', $message);
|
setcookie('CODECEPTION_CODECOVERAGE_ERROR', $message);
|
||||||
}
|
}
|
||||||
@ -57,13 +58,13 @@ if (!class_exists('PHPUnit_Runner_Version') && class_exists('PHPUnit\Runner\Vers
|
|||||||
}
|
}
|
||||||
// Autoload Codeception classes
|
// Autoload Codeception classes
|
||||||
if (!class_exists('\\Codeception\\Codecept')) {
|
if (!class_exists('\\Codeception\\Codecept')) {
|
||||||
if (file_exists(__DIR__ . '/codecept.phar')) {
|
if (file_exists(__DIR__.'/codecept.phar')) {
|
||||||
require_once 'phar://' . __DIR__ . '/codecept.phar/autoload.php';
|
require_once 'phar://'.__DIR__.'/codecept.phar/autoload.php';
|
||||||
} elseif (stream_resolve_include_path(__DIR__ . '/vendor/autoload.php')) {
|
} elseif (stream_resolve_include_path(__DIR__.'/vendor/autoload.php')) {
|
||||||
require_once __DIR__ . '/vendor/autoload.php';
|
require_once __DIR__.'/vendor/autoload.php';
|
||||||
// Required to load some methods only available at codeception/autoload.php
|
// Required to load some methods only available at codeception/autoload.php
|
||||||
if (stream_resolve_include_path(__DIR__ . '/vendor/codeception/codeception/autoload.php')) {
|
if (stream_resolve_include_path(__DIR__.'/vendor/codeception/codeception/autoload.php')) {
|
||||||
require_once __DIR__ . '/vendor/codeception/codeception/autoload.php';
|
require_once __DIR__.'/vendor/codeception/codeception/autoload.php';
|
||||||
}
|
}
|
||||||
} elseif (stream_resolve_include_path('Codeception/autoload.php')) {
|
} elseif (stream_resolve_include_path('Codeception/autoload.php')) {
|
||||||
require_once 'Codeception/autoload.php';
|
require_once 'Codeception/autoload.php';
|
||||||
@ -72,10 +73,10 @@ if (!class_exists('\\Codeception\\Codecept')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Load Codeception Config
|
// Load Codeception Config
|
||||||
$config_dist_file = realpath(__DIR__) . DIRECTORY_SEPARATOR . 'codeception.dist.yml';
|
$config_dist_file = realpath(__DIR__).DIRECTORY_SEPARATOR.'codeception.dist.yml';
|
||||||
$config_file = realpath(__DIR__) . DIRECTORY_SEPARATOR . 'codeception.yml';
|
$config_file = realpath(__DIR__).DIRECTORY_SEPARATOR.'codeception.yml';
|
||||||
if (isset($_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_CONFIG'])) {
|
if (isset($_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_CONFIG'])) {
|
||||||
$config_file = realpath(__DIR__) . DIRECTORY_SEPARATOR . $_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_CONFIG'];
|
$config_file = realpath(__DIR__).DIRECTORY_SEPARATOR.$_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_CONFIG'];
|
||||||
}
|
}
|
||||||
if (file_exists($config_file)) {
|
if (file_exists($config_file)) {
|
||||||
// Use codeception.yml for configuration.
|
// Use codeception.yml for configuration.
|
||||||
@ -85,6 +86,7 @@ if (file_exists($config_file)) {
|
|||||||
} else {
|
} else {
|
||||||
__c3_error(sprintf("Codeception config file '%s' not found", $config_file));
|
__c3_error(sprintf("Codeception config file '%s' not found", $config_file));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
\Codeception\Configuration::config($config_file);
|
\Codeception\Configuration::config($config_file);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -95,86 +97,92 @@ if (!defined('C3_CODECOVERAGE_MEDIATE_STORAGE')) {
|
|||||||
gc_disable();
|
gc_disable();
|
||||||
$memoryLimit = ini_get('memory_limit');
|
$memoryLimit = ini_get('memory_limit');
|
||||||
$requiredMemory = '384M';
|
$requiredMemory = '384M';
|
||||||
if ((substr($memoryLimit, -1) === 'M' && (int)$memoryLimit < (int)$requiredMemory)
|
if ((substr($memoryLimit, -1) === 'M' && (int) $memoryLimit < (int) $requiredMemory)
|
||||||
|| (substr($memoryLimit, -1) === 'K' && (int)$memoryLimit < (int)$requiredMemory * 1024)
|
|| (substr($memoryLimit, -1) === 'K' && (int) $memoryLimit < (int) $requiredMemory * 1024)
|
||||||
|| (ctype_digit($memoryLimit) && (int)$memoryLimit < (int)$requiredMemory * 1024 * 1024)
|
|| (ctype_digit($memoryLimit) && (int) $memoryLimit < (int) $requiredMemory * 1024 * 1024)
|
||||||
) {
|
) {
|
||||||
ini_set('memory_limit', $requiredMemory);
|
ini_set('memory_limit', $requiredMemory);
|
||||||
}
|
}
|
||||||
define('C3_CODECOVERAGE_MEDIATE_STORAGE', Codeception\Configuration::logDir() . 'c3tmp');
|
define('C3_CODECOVERAGE_MEDIATE_STORAGE', Codeception\Configuration::logDir().'c3tmp');
|
||||||
define('C3_CODECOVERAGE_PROJECT_ROOT', Codeception\Configuration::projectDir());
|
define('C3_CODECOVERAGE_PROJECT_ROOT', Codeception\Configuration::projectDir());
|
||||||
define('C3_CODECOVERAGE_TESTNAME', $_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE']);
|
define('C3_CODECOVERAGE_TESTNAME', $_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE']);
|
||||||
function __c3_build_html_report(PHP_CodeCoverage $codeCoverage, $path)
|
function __c3_build_html_report(PHP_CodeCoverage $codeCoverage, $path)
|
||||||
{
|
{
|
||||||
$writer = new PHP_CodeCoverage_Report_HTML();
|
$writer = new PHP_CodeCoverage_Report_HTML();
|
||||||
$writer->process($codeCoverage, $path . 'html');
|
$writer->process($codeCoverage, $path.'html');
|
||||||
if (file_exists($path . '.tar')) {
|
if (file_exists($path.'.tar')) {
|
||||||
unlink($path . '.tar');
|
unlink($path.'.tar');
|
||||||
}
|
}
|
||||||
$phar = new PharData($path . '.tar');
|
$phar = new PharData($path.'.tar');
|
||||||
$phar->setSignatureAlgorithm(Phar::SHA1);
|
$phar->setSignatureAlgorithm(Phar::SHA1);
|
||||||
$files = $phar->buildFromDirectory($path . 'html');
|
$files = $phar->buildFromDirectory($path.'html');
|
||||||
array_map('unlink', $files);
|
array_map('unlink', $files);
|
||||||
if (in_array('GZ', Phar::getSupportedCompression())) {
|
if (in_array('GZ', Phar::getSupportedCompression())) {
|
||||||
if (file_exists($path . '.tar.gz')) {
|
if (file_exists($path.'.tar.gz')) {
|
||||||
unlink($path . '.tar.gz');
|
unlink($path.'.tar.gz');
|
||||||
}
|
}
|
||||||
$phar->compress(\Phar::GZ);
|
$phar->compress(\Phar::GZ);
|
||||||
// close the file so that we can rename it
|
// close the file so that we can rename it
|
||||||
unset($phar);
|
unset($phar);
|
||||||
unlink($path . '.tar');
|
unlink($path.'.tar');
|
||||||
rename($path . '.tar.gz', $path . '.tar');
|
rename($path.'.tar.gz', $path.'.tar');
|
||||||
}
|
}
|
||||||
return $path . '.tar';
|
|
||||||
|
return $path.'.tar';
|
||||||
}
|
}
|
||||||
function __c3_build_clover_report(PHP_CodeCoverage $codeCoverage, $path)
|
function __c3_build_clover_report(PHP_CodeCoverage $codeCoverage, $path)
|
||||||
{
|
{
|
||||||
$writer = new PHP_CodeCoverage_Report_Clover();
|
$writer = new PHP_CodeCoverage_Report_Clover();
|
||||||
$writer->process($codeCoverage, $path . '.clover.xml');
|
$writer->process($codeCoverage, $path.'.clover.xml');
|
||||||
return $path . '.clover.xml';
|
|
||||||
|
return $path.'.clover.xml';
|
||||||
}
|
}
|
||||||
function __c3_build_crap4j_report(PHP_CodeCoverage $codeCoverage, $path)
|
function __c3_build_crap4j_report(PHP_CodeCoverage $codeCoverage, $path)
|
||||||
{
|
{
|
||||||
$writer = new PHP_CodeCoverage_Report_Crap4j();
|
$writer = new PHP_CodeCoverage_Report_Crap4j();
|
||||||
$writer->process($codeCoverage, $path . '.crap4j.xml');
|
$writer->process($codeCoverage, $path.'.crap4j.xml');
|
||||||
return $path . '.crap4j.xml';
|
|
||||||
|
return $path.'.crap4j.xml';
|
||||||
}
|
}
|
||||||
function __c3_build_phpunit_report(PHP_CodeCoverage $codeCoverage, $path)
|
function __c3_build_phpunit_report(PHP_CodeCoverage $codeCoverage, $path)
|
||||||
{
|
{
|
||||||
$writer = new PHP_CodeCoverage_Report_XML(\PHPUnit_Runner_Version::id());
|
$writer = new PHP_CodeCoverage_Report_XML(\PHPUnit_Runner_Version::id());
|
||||||
$writer->process($codeCoverage, $path . 'phpunit');
|
$writer->process($codeCoverage, $path.'phpunit');
|
||||||
if (file_exists($path . '.tar')) {
|
if (file_exists($path.'.tar')) {
|
||||||
unlink($path . '.tar');
|
unlink($path.'.tar');
|
||||||
}
|
}
|
||||||
$phar = new PharData($path . '.tar');
|
$phar = new PharData($path.'.tar');
|
||||||
$phar->setSignatureAlgorithm(Phar::SHA1);
|
$phar->setSignatureAlgorithm(Phar::SHA1);
|
||||||
$files = $phar->buildFromDirectory($path . 'phpunit');
|
$files = $phar->buildFromDirectory($path.'phpunit');
|
||||||
array_map('unlink', $files);
|
array_map('unlink', $files);
|
||||||
if (in_array('GZ', Phar::getSupportedCompression())) {
|
if (in_array('GZ', Phar::getSupportedCompression())) {
|
||||||
if (file_exists($path . '.tar.gz')) {
|
if (file_exists($path.'.tar.gz')) {
|
||||||
unlink($path . '.tar.gz');
|
unlink($path.'.tar.gz');
|
||||||
}
|
}
|
||||||
$phar->compress(\Phar::GZ);
|
$phar->compress(\Phar::GZ);
|
||||||
// close the file so that we can rename it
|
// close the file so that we can rename it
|
||||||
unset($phar);
|
unset($phar);
|
||||||
unlink($path . '.tar');
|
unlink($path.'.tar');
|
||||||
rename($path . '.tar.gz', $path . '.tar');
|
rename($path.'.tar.gz', $path.'.tar');
|
||||||
}
|
}
|
||||||
return $path . '.tar';
|
|
||||||
|
return $path.'.tar';
|
||||||
}
|
}
|
||||||
function __c3_send_file($filename)
|
function __c3_send_file($filename)
|
||||||
{
|
{
|
||||||
if (!headers_sent()) {
|
if (!headers_sent()) {
|
||||||
readfile($filename);
|
readfile($filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
return __c3_exit();
|
return __c3_exit();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param $filename
|
* @param $filename
|
||||||
* @param bool $lock Lock the file for writing?
|
* @param bool $lock Lock the file for writing?
|
||||||
|
*
|
||||||
* @return [null|PHP_CodeCoverage|\SebastianBergmann\CodeCoverage\CodeCoverage, resource]
|
* @return [null|PHP_CodeCoverage|\SebastianBergmann\CodeCoverage\CodeCoverage, resource]
|
||||||
*/
|
*/
|
||||||
function __c3_factory($filename, $lock=false)
|
function __c3_factory($filename, $lock = false)
|
||||||
{
|
{
|
||||||
$file = null;
|
$file = null;
|
||||||
if ($filename !== null && is_readable($filename)) {
|
if ($filename !== null && is_readable($filename)) {
|
||||||
@ -189,12 +197,13 @@ if (!defined('C3_CODECOVERAGE_MEDIATE_STORAGE')) {
|
|||||||
$phpCoverage = unserialize(file_get_contents($filename));
|
$phpCoverage = unserialize(file_get_contents($filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($phpCoverage, $file);
|
return [$phpCoverage, $file];
|
||||||
} else {
|
} else {
|
||||||
$phpCoverage = new PHP_CodeCoverage();
|
$phpCoverage = new PHP_CodeCoverage();
|
||||||
}
|
}
|
||||||
if (isset($_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_SUITE'])) {
|
if (isset($_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_SUITE'])) {
|
||||||
$suite = $_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_SUITE'];
|
$suite = $_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_SUITE'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$settings = \Codeception\Configuration::suiteSettings($suite, \Codeception\Configuration::config());
|
$settings = \Codeception\Configuration::suiteSettings($suite, \Codeception\Configuration::config());
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@ -203,6 +212,7 @@ if (!defined('C3_CODECOVERAGE_MEDIATE_STORAGE')) {
|
|||||||
} else {
|
} else {
|
||||||
$settings = \Codeception\Configuration::config();
|
$settings = \Codeception\Configuration::config();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
\Codeception\Coverage\Filter::setup($phpCoverage)
|
\Codeception\Coverage\Filter::setup($phpCoverage)
|
||||||
->whiteList($settings)
|
->whiteList($settings)
|
||||||
@ -210,14 +220,14 @@ if (!defined('C3_CODECOVERAGE_MEDIATE_STORAGE')) {
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
__c3_error($e->getMessage());
|
__c3_error($e->getMessage());
|
||||||
}
|
}
|
||||||
return array($phpCoverage, $file);
|
|
||||||
|
return [$phpCoverage, $file];
|
||||||
}
|
}
|
||||||
function __c3_exit()
|
function __c3_exit()
|
||||||
{
|
{
|
||||||
if (!isset($_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_DEBUG'])) {
|
if (!isset($_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_DEBUG'])) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
function __c3_clear()
|
function __c3_clear()
|
||||||
{
|
{
|
||||||
@ -226,21 +236,22 @@ if (!defined('C3_CODECOVERAGE_MEDIATE_STORAGE')) {
|
|||||||
}
|
}
|
||||||
if (!is_dir(C3_CODECOVERAGE_MEDIATE_STORAGE)) {
|
if (!is_dir(C3_CODECOVERAGE_MEDIATE_STORAGE)) {
|
||||||
if (mkdir(C3_CODECOVERAGE_MEDIATE_STORAGE, 0777, true) === false) {
|
if (mkdir(C3_CODECOVERAGE_MEDIATE_STORAGE, 0777, true) === false) {
|
||||||
__c3_error('Failed to create directory "' . C3_CODECOVERAGE_MEDIATE_STORAGE . '"');
|
__c3_error('Failed to create directory "'.C3_CODECOVERAGE_MEDIATE_STORAGE.'"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// evaluate base path for c3-related files
|
// evaluate base path for c3-related files
|
||||||
$path = realpath(C3_CODECOVERAGE_MEDIATE_STORAGE) . DIRECTORY_SEPARATOR . 'codecoverage';
|
$path = realpath(C3_CODECOVERAGE_MEDIATE_STORAGE).DIRECTORY_SEPARATOR.'codecoverage';
|
||||||
$requested_c3_report = (strpos($_SERVER['REQUEST_URI'], 'c3/report') !== false);
|
$requested_c3_report = (strpos($_SERVER['REQUEST_URI'], 'c3/report') !== false);
|
||||||
$complete_report = $current_report = $path . '.serialized';
|
$complete_report = $current_report = $path.'.serialized';
|
||||||
if ($requested_c3_report) {
|
if ($requested_c3_report) {
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
$route = ltrim(strrchr($_SERVER['REQUEST_URI'], '/'), '/');
|
$route = ltrim(strrchr($_SERVER['REQUEST_URI'], '/'), '/');
|
||||||
if ($route === 'clear') {
|
if ($route === 'clear') {
|
||||||
__c3_clear();
|
__c3_clear();
|
||||||
|
|
||||||
return __c3_exit();
|
return __c3_exit();
|
||||||
}
|
}
|
||||||
list($codeCoverage, ) = __c3_factory($complete_report);
|
list($codeCoverage) = __c3_factory($complete_report);
|
||||||
switch ($route) {
|
switch ($route) {
|
||||||
case 'html':
|
case 'html':
|
||||||
try {
|
try {
|
||||||
@ -248,6 +259,7 @@ if ($requested_c3_report) {
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
__c3_error($e->getMessage());
|
__c3_error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return __c3_exit();
|
return __c3_exit();
|
||||||
case 'clover':
|
case 'clover':
|
||||||
try {
|
try {
|
||||||
@ -255,6 +267,7 @@ if ($requested_c3_report) {
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
__c3_error($e->getMessage());
|
__c3_error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return __c3_exit();
|
return __c3_exit();
|
||||||
case 'crap4j':
|
case 'crap4j':
|
||||||
try {
|
try {
|
||||||
@ -262,6 +275,7 @@ if ($requested_c3_report) {
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
__c3_error($e->getMessage());
|
__c3_error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return __c3_exit();
|
return __c3_exit();
|
||||||
case 'serialized':
|
case 'serialized':
|
||||||
try {
|
try {
|
||||||
@ -269,6 +283,7 @@ if ($requested_c3_report) {
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
__c3_error($e->getMessage());
|
__c3_error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return __c3_exit();
|
return __c3_exit();
|
||||||
case 'phpunit':
|
case 'phpunit':
|
||||||
try {
|
try {
|
||||||
@ -276,10 +291,11 @@ if ($requested_c3_report) {
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
__c3_error($e->getMessage());
|
__c3_error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return __c3_exit();
|
return __c3_exit();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
list($codeCoverage, ) = __c3_factory(null);
|
list($codeCoverage) = __c3_factory(null);
|
||||||
$codeCoverage->start(C3_CODECOVERAGE_TESTNAME);
|
$codeCoverage->start(C3_CODECOVERAGE_TESTNAME);
|
||||||
if (!array_key_exists('HTTP_X_CODECEPTION_CODECOVERAGE_DEBUG', $_SERVER)) {
|
if (!array_key_exists('HTTP_X_CODECEPTION_CODECOVERAGE_DEBUG', $_SERVER)) {
|
||||||
register_shutdown_function(
|
register_shutdown_function(
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateUsersTable extends Migration
|
class CreateUsersTable extends Migration
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreatePasswordResetsTable extends Migration
|
class CreatePasswordResetsTable extends Migration
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Laravel - A PHP Framework For Web Artisans
|
* Laravel - A PHP Framework For Web Artisans.
|
||||||
*
|
*
|
||||||
* @package Laravel
|
|
||||||
* @author Taylor Otwell <taylor@laravel.com>
|
* @author Taylor Otwell <taylor@laravel.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('LARAVEL_START', microtime(true));
|
define('LARAVEL_START', microtime(true));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Laravel - A PHP Framework For Web Artisans
|
* Laravel - A PHP Framework For Web Artisans.
|
||||||
*
|
*
|
||||||
* @package Laravel
|
|
||||||
* @author Taylor Otwell <taylor@laravel.com>
|
* @author Taylor Otwell <taylor@laravel.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$uri = urldecode(
|
$uri = urldecode(
|
||||||
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
|
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
|
||||||
);
|
);
|
||||||
|
@ -4,17 +4,14 @@ namespace Tests\Unit;
|
|||||||
|
|
||||||
use App\Utils\NumberHelper;
|
use App\Utils\NumberHelper;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
|
|
||||||
class NumberTest extends TestCase
|
class NumberTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testRoundingThreeLow()
|
public function testRoundingThreeLow()
|
||||||
{
|
{
|
||||||
$rounded = NumberHelper::roundValue(3.144444444444, 3);
|
$rounded = NumberHelper::roundValue(3.144444444444, 3);
|
||||||
|
|
||||||
$this->assertEquals(3.144, $rounded);
|
$this->assertEquals(3.144, $rounded);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRoundingThreeHigh()
|
public function testRoundingThreeHigh()
|
||||||
@ -22,7 +19,6 @@ class NumberTest extends TestCase
|
|||||||
$rounded = NumberHelper::roundValue(3.144944444444, 3);
|
$rounded = NumberHelper::roundValue(3.144944444444, 3);
|
||||||
|
|
||||||
$this->assertEquals(3.145, $rounded);
|
$this->assertEquals(3.145, $rounded);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRoundingTwoLow()
|
public function testRoundingTwoLow()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// This is global bootstrap for autoloading
|
// This is global bootstrap for autoloading
|
||||||
use Codeception\Util\Fixtures;
|
use Codeception\Util\Fixtures;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user