From ae273f83200da0531bbf10be5f88b4abd9b08de3 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 15 Apr 2018 10:44:47 +0200 Subject: [PATCH] Also test PHP 7.2 --- .travis.yml | 1 + public/js/ff/moment/tr_TR.js | 2 +- .../Controllers/Auth/TwoFactorControllerTest.php | 15 +++++++++++++++ .../Feature/Controllers/NewUserControllerTest.php | 5 +++-- .../Controllers/PreferencesControllerTest.php | 2 +- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 100fc61eeb..4543dc5049 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: php php: - 7.1 + - 7.2 cache: directories: diff --git a/public/js/ff/moment/tr_TR.js b/public/js/ff/moment/tr_TR.js index 9e889dc917..c28097304d 100644 --- a/public/js/ff/moment/tr_TR.js +++ b/public/js/ff/moment/tr_TR.js @@ -130,7 +130,7 @@ var suffixes$4 = { 90: '\'ıncı' }; -hooks.defineLocale('tr_TR', { +moment.defineLocale('tr_TR', { months : 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split('_'), monthsShort : 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'), weekdays : 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split('_'), diff --git a/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php b/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php index dd347ecdca..fe774da3cc 100644 --- a/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php +++ b/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php @@ -57,10 +57,13 @@ class TwoFactorControllerTest extends TestCase $truePref->data = true; $secretPreference = new Preference; $secretPreference->data = 'JZMES376Z6YXY4QZ'; + $langPreference = new Preference; + $langPreference->data = 'en_US'; Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePref)->twice(); Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference)->once(); Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference)->once(); + Preferences::shouldReceive('get')->withArgs(['language', 'en_US'])->andReturn($langPreference); $response = $this->get(route('two-factor.index')); $response->assertStatus(200); @@ -75,9 +78,13 @@ class TwoFactorControllerTest extends TestCase $falsePreference = new Preference; $falsePreference->data = false; + $langPreference = new Preference; + $langPreference->data = 'en_US'; + Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($falsePreference)->twice(); Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn(null)->once(); Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn(null)->once(); + Preferences::shouldReceive('get')->withArgs(['language', 'en_US'])->andReturn($langPreference); $response = $this->get(route('two-factor.index')); $response->assertStatus(302); @@ -96,9 +103,13 @@ class TwoFactorControllerTest extends TestCase $truePref->data = true; $secretPreference = new Preference; $secretPreference->data = ''; + $langPreference = new Preference; + $langPreference->data = 'en_US'; + Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePref)->twice(); Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference)->once(); Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference)->once(); + Preferences::shouldReceive('get')->withArgs(['language', 'en_US'])->andReturn($langPreference); $response = $this->get(route('two-factor.index')); $response->assertStatus(500); @@ -115,9 +126,13 @@ class TwoFactorControllerTest extends TestCase $truePreference->data = true; $secretPreference = new Preference; $secretPreference->data = 'JZMES376Z6YXY4QZ'; + $langPreference = new Preference; + $langPreference->data = 'en_US'; + Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePreference); Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference); Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference); + Preferences::shouldReceive('get')->withArgs(['language', 'en_US'])->andReturn($langPreference); $response = $this->get(route('two-factor.lost')); $response->assertStatus(200); diff --git a/tests/Feature/Controllers/NewUserControllerTest.php b/tests/Feature/Controllers/NewUserControllerTest.php index 1752a5ad52..1a107b62b3 100644 --- a/tests/Feature/Controllers/NewUserControllerTest.php +++ b/tests/Feature/Controllers/NewUserControllerTest.php @@ -97,13 +97,14 @@ class NewUserControllerTest extends TestCase $accountRepos = $this->mock(AccountRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); - $accountRepos->shouldReceive('store')->times(2); + $accountRepos->shouldReceive('store')->times(3); $currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1)); $data = [ 'bank_name' => 'New bank', 'savings_balance' => '1000', 'bank_balance' => '100', + 'language' => 'en_US', 'amount_currency_id_bank_balance' => 1, ]; $this->be($this->emptyUser()); @@ -122,7 +123,7 @@ class NewUserControllerTest extends TestCase $accountRepos = $this->mock(AccountRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); - $accountRepos->shouldReceive('store')->twice(); + $accountRepos->shouldReceive('store')->times(3); $currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1)); $data = [ diff --git a/tests/Feature/Controllers/PreferencesControllerTest.php b/tests/Feature/Controllers/PreferencesControllerTest.php index 341d69d1f5..224130c430 100644 --- a/tests/Feature/Controllers/PreferencesControllerTest.php +++ b/tests/Feature/Controllers/PreferencesControllerTest.php @@ -30,7 +30,7 @@ use FireflyIII\Repositories\User\UserRepositoryInterface; use Illuminate\Support\Collection; use Log; use Tests\TestCase; - +use Preferences; /** * Class PreferencesControllerTest *