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.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
|
@ -30,6 +30,7 @@ class Handler extends ExceptionHandler
|
||||
* Report or log an exception.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $exception)
|
||||
@ -42,6 +43,7 @@ class Handler extends ExceptionHandler
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $exception
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $exception)
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\User;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
@ -44,6 +44,7 @@ class RegisterController extends Controller
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function validator(array $data)
|
||||
@ -59,6 +60,7 @@ class RegisterController extends Controller
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return \App\User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
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\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as 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.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
|
@ -13,6 +13,7 @@ class RedirectIfAuthenticated
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null $guard
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Fideloper\Proxy\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
|
@ -3,16 +3,15 @@
|
||||
namespace App\Models\Traits;
|
||||
|
||||
/**
|
||||
* Class CalculatesInvoiceTotals
|
||||
* Class CalculatesInvoiceTotals.
|
||||
*/
|
||||
|
||||
class CalculatesInvoiceTotals
|
||||
{
|
||||
|
||||
protected $invoice;
|
||||
|
||||
/**
|
||||
* InvoiceTotals constructor.
|
||||
*
|
||||
* @param $invoice
|
||||
*/
|
||||
public function __construct($invoice)
|
||||
@ -20,16 +19,11 @@ class CalculatesInvoiceTotals
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
|
||||
|
||||
public function calculate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private function sumLineItems()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
@ -2,9 +2,8 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
|
@ -3,19 +3,18 @@
|
||||
namespace App\Utils;
|
||||
|
||||
/**
|
||||
* Class NumberHelper
|
||||
* @package App\Utils
|
||||
* Class NumberHelper.
|
||||
*/
|
||||
class NumberHelper
|
||||
{
|
||||
/**
|
||||
* @param float $value
|
||||
* @param int $precision
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function roundValue(float $value, int $precision = 2) : float
|
||||
{
|
||||
return round($value, $precision, PHP_ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
}
|
30
c3.php
30
c3.php
@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
// @codingStandardsIgnoreFile
|
||||
// @codeCoverageIgnoreStart
|
||||
/**
|
||||
* C3 - Codeception Code Coverage
|
||||
* C3 - Codeception Code Coverage.
|
||||
*
|
||||
* @author tiger
|
||||
*/
|
||||
@ -16,7 +17,7 @@ if (isset($_COOKIE['CODECEPTION_CODECOVERAGE'])) {
|
||||
}
|
||||
if ($cookie) {
|
||||
foreach ($cookie as $key => $value) {
|
||||
$_SERVER["HTTP_X_CODECEPTION_" . strtoupper($key)] = $value;
|
||||
$_SERVER['HTTP_X_CODECEPTION_'.strtoupper($key)] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -85,6 +86,7 @@ if (file_exists($config_file)) {
|
||||
} else {
|
||||
__c3_error(sprintf("Codeception config file '%s' not found", $config_file));
|
||||
}
|
||||
|
||||
try {
|
||||
\Codeception\Configuration::config($config_file);
|
||||
} catch (\Exception $e) {
|
||||
@ -125,18 +127,21 @@ if (!defined('C3_CODECOVERAGE_MEDIATE_STORAGE')) {
|
||||
unlink($path.'.tar');
|
||||
rename($path.'.tar.gz', $path.'.tar');
|
||||
}
|
||||
|
||||
return $path.'.tar';
|
||||
}
|
||||
function __c3_build_clover_report(PHP_CodeCoverage $codeCoverage, $path)
|
||||
{
|
||||
$writer = new PHP_CodeCoverage_Report_Clover();
|
||||
$writer->process($codeCoverage, $path.'.clover.xml');
|
||||
|
||||
return $path.'.clover.xml';
|
||||
}
|
||||
function __c3_build_crap4j_report(PHP_CodeCoverage $codeCoverage, $path)
|
||||
{
|
||||
$writer = new PHP_CodeCoverage_Report_Crap4j();
|
||||
$writer->process($codeCoverage, $path.'.crap4j.xml');
|
||||
|
||||
return $path.'.crap4j.xml';
|
||||
}
|
||||
function __c3_build_phpunit_report(PHP_CodeCoverage $codeCoverage, $path)
|
||||
@ -160,6 +165,7 @@ if (!defined('C3_CODECOVERAGE_MEDIATE_STORAGE')) {
|
||||
unlink($path.'.tar');
|
||||
rename($path.'.tar.gz', $path.'.tar');
|
||||
}
|
||||
|
||||
return $path.'.tar';
|
||||
}
|
||||
function __c3_send_file($filename)
|
||||
@ -167,11 +173,13 @@ if (!defined('C3_CODECOVERAGE_MEDIATE_STORAGE')) {
|
||||
if (!headers_sent()) {
|
||||
readfile($filename);
|
||||
}
|
||||
|
||||
return __c3_exit();
|
||||
}
|
||||
/**
|
||||
* @param $filename
|
||||
* @param bool $lock Lock the file for writing?
|
||||
*
|
||||
* @return [null|PHP_CodeCoverage|\SebastianBergmann\CodeCoverage\CodeCoverage, resource]
|
||||
*/
|
||||
function __c3_factory($filename, $lock = false)
|
||||
@ -189,12 +197,13 @@ if (!defined('C3_CODECOVERAGE_MEDIATE_STORAGE')) {
|
||||
$phpCoverage = unserialize(file_get_contents($filename));
|
||||
}
|
||||
|
||||
return array($phpCoverage, $file);
|
||||
return [$phpCoverage, $file];
|
||||
} else {
|
||||
$phpCoverage = new PHP_CodeCoverage();
|
||||
}
|
||||
if (isset($_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_SUITE'])) {
|
||||
$suite = $_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_SUITE'];
|
||||
|
||||
try {
|
||||
$settings = \Codeception\Configuration::suiteSettings($suite, \Codeception\Configuration::config());
|
||||
} catch (Exception $e) {
|
||||
@ -203,6 +212,7 @@ if (!defined('C3_CODECOVERAGE_MEDIATE_STORAGE')) {
|
||||
} else {
|
||||
$settings = \Codeception\Configuration::config();
|
||||
}
|
||||
|
||||
try {
|
||||
\Codeception\Coverage\Filter::setup($phpCoverage)
|
||||
->whiteList($settings)
|
||||
@ -210,14 +220,14 @@ if (!defined('C3_CODECOVERAGE_MEDIATE_STORAGE')) {
|
||||
} catch (Exception $e) {
|
||||
__c3_error($e->getMessage());
|
||||
}
|
||||
return array($phpCoverage, $file);
|
||||
|
||||
return [$phpCoverage, $file];
|
||||
}
|
||||
function __c3_exit()
|
||||
{
|
||||
if (!isset($_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_DEBUG'])) {
|
||||
exit;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function __c3_clear()
|
||||
{
|
||||
@ -238,9 +248,10 @@ if ($requested_c3_report) {
|
||||
$route = ltrim(strrchr($_SERVER['REQUEST_URI'], '/'), '/');
|
||||
if ($route === 'clear') {
|
||||
__c3_clear();
|
||||
|
||||
return __c3_exit();
|
||||
}
|
||||
list($codeCoverage, ) = __c3_factory($complete_report);
|
||||
list($codeCoverage) = __c3_factory($complete_report);
|
||||
switch ($route) {
|
||||
case 'html':
|
||||
try {
|
||||
@ -248,6 +259,7 @@ if ($requested_c3_report) {
|
||||
} catch (Exception $e) {
|
||||
__c3_error($e->getMessage());
|
||||
}
|
||||
|
||||
return __c3_exit();
|
||||
case 'clover':
|
||||
try {
|
||||
@ -255,6 +267,7 @@ if ($requested_c3_report) {
|
||||
} catch (Exception $e) {
|
||||
__c3_error($e->getMessage());
|
||||
}
|
||||
|
||||
return __c3_exit();
|
||||
case 'crap4j':
|
||||
try {
|
||||
@ -262,6 +275,7 @@ if ($requested_c3_report) {
|
||||
} catch (Exception $e) {
|
||||
__c3_error($e->getMessage());
|
||||
}
|
||||
|
||||
return __c3_exit();
|
||||
case 'serialized':
|
||||
try {
|
||||
@ -269,6 +283,7 @@ if ($requested_c3_report) {
|
||||
} catch (Exception $e) {
|
||||
__c3_error($e->getMessage());
|
||||
}
|
||||
|
||||
return __c3_exit();
|
||||
case 'phpunit':
|
||||
try {
|
||||
@ -276,10 +291,11 @@ if ($requested_c3_report) {
|
||||
} catch (Exception $e) {
|
||||
__c3_error($e->getMessage());
|
||||
}
|
||||
|
||||
return __c3_exit();
|
||||
}
|
||||
} else {
|
||||
list($codeCoverage, ) = __c3_factory(null);
|
||||
list($codeCoverage) = __c3_factory(null);
|
||||
$codeCoverage->start(C3_CODECOVERAGE_TESTNAME);
|
||||
if (!array_key_exists('HTTP_X_CODECEPTION_CODECOVERAGE_DEBUG', $_SERVER)) {
|
||||
register_shutdown_function(
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePasswordResetsTable extends Migration
|
||||
{
|
||||
|
@ -1,12 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Laravel - A PHP Framework For Web Artisans
|
||||
* Laravel - A PHP Framework For Web Artisans.
|
||||
*
|
||||
* @package Laravel
|
||||
* @author Taylor Otwell <taylor@laravel.com>
|
||||
*/
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
/*
|
||||
|
@ -1,12 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Laravel - A PHP Framework For Web Artisans
|
||||
* Laravel - A PHP Framework For Web Artisans.
|
||||
*
|
||||
* @package Laravel
|
||||
* @author Taylor Otwell <taylor@laravel.com>
|
||||
*/
|
||||
|
||||
$uri = urldecode(
|
||||
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
|
||||
);
|
||||
|
@ -4,17 +4,14 @@ namespace Tests\Unit;
|
||||
|
||||
use App\Utils\NumberHelper;
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
class NumberTest extends TestCase
|
||||
{
|
||||
|
||||
public function testRoundingThreeLow()
|
||||
{
|
||||
$rounded = NumberHelper::roundValue(3.144444444444, 3);
|
||||
|
||||
$this->assertEquals(3.144, $rounded);
|
||||
|
||||
}
|
||||
|
||||
public function testRoundingThreeHigh()
|
||||
@ -22,7 +19,6 @@ class NumberTest extends TestCase
|
||||
$rounded = NumberHelper::roundValue(3.144944444444, 3);
|
||||
|
||||
$this->assertEquals(3.145, $rounded);
|
||||
|
||||
}
|
||||
|
||||
public function testRoundingTwoLow()
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
// This is global bootstrap for autoloading
|
||||
use Codeception\Util\Fixtures;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user