From 01ca660b6b3baf1b750625685d62fdadc7d98644 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 9 Mar 2017 17:48:21 +0200 Subject: [PATCH] Working on adding check-data to Travis --- .travis.yml | 2 +- app/Http/Controllers/AppController.php | 10 ++++++++++ app/Http/routes.php | 4 ++++ tests/acceptance/AllPagesCept.php | 4 ++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3c6b4778c2..edd37f9289 100644 --- a/.travis.yml +++ b/.travis.yml @@ -70,7 +70,6 @@ before_script: #- php artisan ninja:create-test-data 25 script: - #- php ./vendor/codeception/codeception/codecept run --debug acceptance AllPagesCept.php #- php ./vendor/codeception/codeception/codecept run --debug acceptance APICest.php #- php ./vendor/codeception/codeception/codecept run --debug acceptance TaxRatesCest.php #- php ./vendor/codeception/codeception/codecept run --debug acceptance CheckBalanceCest.php @@ -83,6 +82,7 @@ script: #- php ./vendor/codeception/codeception/codecept run --debug acceptance OnlinePaymentCest.php #- php ./vendor/codeception/codeception/codecept run --debug acceptance PaymentCest.php #- php ./vendor/codeception/codeception/codecept run --debug acceptance TaskCest.php + - php ./vendor/codeception/codeception/codecept run --debug acceptance AllPagesCept.php #- sed -i 's/NINJA_DEV=true/NINJA_PROD=true/g' .env #- php ./vendor/codeception/codeception/codecept run acceptance GoProCest.php diff --git a/app/Http/Controllers/AppController.php b/app/Http/Controllers/AppController.php index 2a2ce584ae..c9a1d90f8e 100644 --- a/app/Http/Controllers/AppController.php +++ b/app/Http/Controllers/AppController.php @@ -320,6 +320,16 @@ class AppController extends BaseController return RESULT_SUCCESS; } + public function checkData() + { + try { + Artisan::call('ninja:check-data'); + return RESULT_SUCCESS; + } catch (Exception $exception) { + return RESULT_FAILURE; + } + } + public function stats() { if (! hash_equals(Input::get('password'), env('RESELLER_PASSWORD'))) { diff --git a/app/Http/routes.php b/app/Http/routes.php index 1a9bf65705..e6478e3bbf 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -113,6 +113,10 @@ if (Utils::isReseller()) { Route::post('/reseller_stats', 'AppController@stats'); } +if (Utils::isTravis() || true) { + Route::get('/check_data', 'AppController@checkData'); +} + Route::group(['middleware' => 'auth:user'], function () { Route::get('dashboard', 'DashboardController@index'); Route::get('dashboard_chart_data/{group_by}/{start_date}/{end_date}/{currency_id}/{include_expenses}', 'DashboardController@chartData'); diff --git a/tests/acceptance/AllPagesCept.php b/tests/acceptance/AllPagesCept.php index 3bdced0522..807bbd8ad7 100644 --- a/tests/acceptance/AllPagesCept.php +++ b/tests/acceptance/AllPagesCept.php @@ -84,6 +84,10 @@ $I->see('Invoice Email'); $I->amOnPage('/reports'); $I->see('Reports'); +$I->amOnPage('/check_data'); +$I->see('success'); + + //try to logout //$I->click('#myAccountButton'); //$I->see('Log Out');