From a29fe46fde87391441167c79129bd04da60fe6eb Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Thu, 23 Mar 2023 16:23:57 +0000 Subject: [PATCH] Apply fixes from StyleCI --- .../Drivers/ExchangeRateHost/ConvertTest.php | 74 +++++++++---------- .../ExchangeRateHost/ExchangeRateTest.php | 30 ++++---- .../ExchangeRatesApiIo/ConvertTest.php | 74 +++++++++---------- .../ExchangeRatesApiIo/ExchangeRateTest.php | 28 +++---- .../ExchangeRatesDataApi/ConvertTest.php | 3 +- .../ExchangeRatesDataApi/CurrenciesTest.php | 3 +- .../ExchangeRateBetweenDateRangeTest.php | 3 +- .../ExchangeRatesDataApi/ExchangeRateTest.php | 16 ++-- 8 files changed, 114 insertions(+), 117 deletions(-) diff --git a/tests/Unit/Drivers/ExchangeRateHost/ConvertTest.php b/tests/Unit/Drivers/ExchangeRateHost/ConvertTest.php index 51f60ae..c2e089a 100644 --- a/tests/Unit/Drivers/ExchangeRateHost/ConvertTest.php +++ b/tests/Unit/Drivers/ExchangeRateHost/ConvertTest.php @@ -188,43 +188,43 @@ private function mockResponseForCurrentDateAndOneSymbol(): Response private function mockResponseForPastDateAndOneSymbol(): Response { return new Response([ - 'rates' => [ - 'CAD' => 1.4969, - 'HKD' => 8.8843, - 'ISK' => 138.5, - 'PHP' => 60.256, - 'DKK' => 7.4594, - 'HUF' => 321.31, - 'CZK' => 25.936, - 'AUD' => 1.5663, - 'RON' => 4.657, - 'SEK' => 10.2648, - 'IDR' => 16661.6, - 'INR' => 82.264, - 'BRL' => 4.254, - 'RUB' => 76.4283, - 'HRK' => 7.43, - 'JPY' => 129.26, - 'THB' => 37.453, - 'CHF' => 1.1414, - 'SGD' => 1.5627, - 'PLN' => 4.288, - 'BGN' => 1.9558, - 'TRY' => 6.2261, - 'CNY' => 7.8852, - 'NOK' => 9.5418, - 'NZD' => 1.6815, - 'ZAR' => 16.1884, - 'USD' => 1.1346, - 'MXN' => 23.0001, - 'ILS' => 4.171, - 'GBP' => 0.87053, - 'KRW' => 1278.77, - 'MYR' => 4.7399, - ], - 'base' => 'EUR', - 'date' => '2018-11-09', - ]); + 'rates' => [ + 'CAD' => 1.4969, + 'HKD' => 8.8843, + 'ISK' => 138.5, + 'PHP' => 60.256, + 'DKK' => 7.4594, + 'HUF' => 321.31, + 'CZK' => 25.936, + 'AUD' => 1.5663, + 'RON' => 4.657, + 'SEK' => 10.2648, + 'IDR' => 16661.6, + 'INR' => 82.264, + 'BRL' => 4.254, + 'RUB' => 76.4283, + 'HRK' => 7.43, + 'JPY' => 129.26, + 'THB' => 37.453, + 'CHF' => 1.1414, + 'SGD' => 1.5627, + 'PLN' => 4.288, + 'BGN' => 1.9558, + 'TRY' => 6.2261, + 'CNY' => 7.8852, + 'NOK' => 9.5418, + 'NZD' => 1.6815, + 'ZAR' => 16.1884, + 'USD' => 1.1346, + 'MXN' => 23.0001, + 'ILS' => 4.171, + 'GBP' => 0.87053, + 'KRW' => 1278.77, + 'MYR' => 4.7399, + ], + 'base' => 'EUR', + 'date' => '2018-11-09', + ]); } private function mockResponseForCurrentDateAndMultipleSymbols(): Response diff --git a/tests/Unit/Drivers/ExchangeRateHost/ExchangeRateTest.php b/tests/Unit/Drivers/ExchangeRateHost/ExchangeRateTest.php index b34bec7..0a69525 100644 --- a/tests/Unit/Drivers/ExchangeRateHost/ExchangeRateTest.php +++ b/tests/Unit/Drivers/ExchangeRateHost/ExchangeRateTest.php @@ -27,7 +27,7 @@ public function exchange_rate_for_today_is_returned_if_no_date_parameter_passed_ $exchangeRate = new ExchangeRateHostDriver($requestBuilderMock); $rate = $exchangeRate->exchangeRate('EUR', 'GBP'); $this->assertEquals('0.86158', $rate); - $this->assertEquals('0.86158', Cache::get('laravel_xr_EUR_GBP_' . now()->format('Y-m-d'))); + $this->assertEquals('0.86158', Cache::get('laravel_xr_EUR_GBP_'.now()->format('Y-m-d'))); } /** @test */ @@ -37,14 +37,14 @@ public function exchange_rate_in_the_past_is_returned_if_date_parameter_passed_a $requestBuilderMock = Mockery::mock(RequestBuilder::class); $requestBuilderMock->expects('makeRequest') - ->withArgs(['/' . $mockDate->format('Y-m-d'), ['base' => 'EUR', 'symbols' => 'GBP']]) + ->withArgs(['/'.$mockDate->format('Y-m-d'), ['base' => 'EUR', 'symbols' => 'GBP']]) ->once() ->andReturn($this->mockResponseForPastDateAndOneSymbol()); $exchangeRate = new ExchangeRateHostDriver($requestBuilderMock); $rate = $exchangeRate->exchangeRate('EUR', 'GBP', $mockDate); $this->assertEquals('0.87053', $rate); - $this->assertEquals('0.87053', Cache::get('laravel_xr_EUR_GBP_' . $mockDate->format('Y-m-d'))); + $this->assertEquals('0.87053', Cache::get('laravel_xr_EUR_GBP_'.$mockDate->format('Y-m-d'))); } /** @test */ @@ -52,7 +52,7 @@ public function cached_exchange_rate_is_returned_if_it_exists(): void { $mockDate = now(); - Cache::forever('laravel_xr_EUR_GBP_' . $mockDate->format('Y-m-d'), 0.123456); + Cache::forever('laravel_xr_EUR_GBP_'.$mockDate->format('Y-m-d'), 0.123456); $requestBuilderMock = Mockery::mock(RequestBuilder::class); $requestBuilderMock->expects('makeRequest')->never(); @@ -60,7 +60,7 @@ public function cached_exchange_rate_is_returned_if_it_exists(): void $exchangeRate = new ExchangeRateHostDriver($requestBuilderMock); $rate = $exchangeRate->exchangeRate('EUR', 'GBP', $mockDate); $this->assertEquals('0.123456', $rate); - $this->assertEquals('0.123456', Cache::get('laravel_xr_EUR_GBP_' . $mockDate->format('Y-m-d'))); + $this->assertEquals('0.123456', Cache::get('laravel_xr_EUR_GBP_'.$mockDate->format('Y-m-d'))); } /** @test */ @@ -77,7 +77,7 @@ public function multiple_exchange_rates_can_be_returned_if_no_date_parameter_pas $this->assertEquals(['CAD' => 1.4561, 'USD' => 1.1034, 'GBP' => 0.86158], $response); $this->assertEquals( ['CAD' => 1.4561, 'USD' => 1.1034, 'GBP' => 0.86158], - Cache::get('laravel_xr_EUR_CAD_GBP_USD_' . now()->format('Y-m-d')) + Cache::get('laravel_xr_EUR_CAD_GBP_USD_'.now()->format('Y-m-d')) ); } @@ -88,7 +88,7 @@ public function multiple_exchange_rates_can_be_returned_if_date_parameter_passed $requestBuilderMock = Mockery::mock(RequestBuilder::class); $requestBuilderMock->expects('makeRequest') - ->withArgs(['/' . $mockDate->format('Y-m-d'), ['base' => 'EUR', 'symbols' => 'GBP,CAD,USD']]) + ->withArgs(['/'.$mockDate->format('Y-m-d'), ['base' => 'EUR', 'symbols' => 'GBP,CAD,USD']]) ->once() ->andReturn($this->mockResponseForPastDateAndMultipleSymbols()); @@ -97,7 +97,7 @@ public function multiple_exchange_rates_can_be_returned_if_date_parameter_passed $this->assertEquals(['CAD' => 1.4969, 'USD' => 1.1346, 'GBP' => 0.87053], $response); $this->assertEquals( ['CAD' => 1.4969, 'USD' => 1.1346, 'GBP' => 0.87053], - Cache::get('laravel_xr_EUR_CAD_GBP_USD_' . $mockDate->format('Y-m-d')) + Cache::get('laravel_xr_EUR_CAD_GBP_USD_'.$mockDate->format('Y-m-d')) ); } @@ -106,9 +106,9 @@ public function multiple_cached_exchange_rates_are_returned_if_they_exist(): voi { $mockDate = now(); - Cache::forget('laravel_xr_EUR_CAD_GBP_USD_' . $mockDate->format('Y-m-d')); + Cache::forget('laravel_xr_EUR_CAD_GBP_USD_'.$mockDate->format('Y-m-d')); - Cache::forever('laravel_xr_EUR_CAD_GBP_USD_' . $mockDate->format('Y-m-d'), + Cache::forever('laravel_xr_EUR_CAD_GBP_USD_'.$mockDate->format('Y-m-d'), ['CAD' => 1.4561, 'USD' => 1.1034, 'GBP' => 0.86158] ); @@ -120,7 +120,7 @@ public function multiple_cached_exchange_rates_are_returned_if_they_exist(): voi $this->assertEquals(['CAD' => 1.4561, 'USD' => 1.1034, 'GBP' => 0.86158], $rate); $this->assertEquals( ['CAD' => 1.4561, 'USD' => 1.1034, 'GBP' => 0.86158], - Cache::get('laravel_xr_EUR_CAD_GBP_USD_' . $mockDate->format('Y-m-d')) + Cache::get('laravel_xr_EUR_CAD_GBP_USD_'.$mockDate->format('Y-m-d')) ); } @@ -129,18 +129,18 @@ public function cached_exchange_rate_is_not_used_if_should_bust_cache_method_is_ { $mockDate = now(); - Cache::forever('laravel_xr_EUR_GBP_' . $mockDate->format('Y-m-d'), '0.123456'); + Cache::forever('laravel_xr_EUR_GBP_'.$mockDate->format('Y-m-d'), '0.123456'); $requestBuilderMock = Mockery::mock(RequestBuilder::class); $requestBuilderMock->expects('makeRequest') - ->withArgs(['/' . $mockDate->format('Y-m-d'), ['base' => 'EUR', 'symbols' => 'GBP']]) + ->withArgs(['/'.$mockDate->format('Y-m-d'), ['base' => 'EUR', 'symbols' => 'GBP']]) ->once() ->andReturn($this->mockResponseForPastDateAndOneSymbol()); $exchangeRate = new ExchangeRateHostDriver($requestBuilderMock); $rate = $exchangeRate->shouldBustCache()->exchangeRate('EUR', 'GBP', $mockDate); $this->assertEquals('0.87053', $rate); - $this->assertEquals('0.87053', Cache::get('laravel_xr_EUR_GBP_' . $mockDate->format('Y-m-d'))); + $this->assertEquals('0.87053', Cache::get('laravel_xr_EUR_GBP_'.$mockDate->format('Y-m-d'))); } /** @test */ @@ -155,7 +155,7 @@ public function exchange_rate_is_not_cached_if_the_shouldCache_option_is_false() $exchangeRate = new ExchangeRateHostDriver($requestBuilderMock); $rate = $exchangeRate->shouldCache(false)->exchangeRate('EUR', 'GBP'); $this->assertEquals('0.86158', $rate); - $this->assertNull(Cache::get('laravel_xr_EUR_GBP_' . now()->format('Y-m-d'))); + $this->assertNull(Cache::get('laravel_xr_EUR_GBP_'.now()->format('Y-m-d'))); } /** @test */ diff --git a/tests/Unit/Drivers/ExchangeRatesApiIo/ConvertTest.php b/tests/Unit/Drivers/ExchangeRatesApiIo/ConvertTest.php index 188f05c..d7505d1 100644 --- a/tests/Unit/Drivers/ExchangeRatesApiIo/ConvertTest.php +++ b/tests/Unit/Drivers/ExchangeRatesApiIo/ConvertTest.php @@ -188,43 +188,43 @@ private function mockResponseForCurrentDateAndOneSymbol(): Response private function mockResponseForPastDateAndOneSymbol(): Response { return new Response([ - 'rates' => [ - 'CAD' => 1.4969, - 'HKD' => 8.8843, - 'ISK' => 138.5, - 'PHP' => 60.256, - 'DKK' => 7.4594, - 'HUF' => 321.31, - 'CZK' => 25.936, - 'AUD' => 1.5663, - 'RON' => 4.657, - 'SEK' => 10.2648, - 'IDR' => 16661.6, - 'INR' => 82.264, - 'BRL' => 4.254, - 'RUB' => 76.4283, - 'HRK' => 7.43, - 'JPY' => 129.26, - 'THB' => 37.453, - 'CHF' => 1.1414, - 'SGD' => 1.5627, - 'PLN' => 4.288, - 'BGN' => 1.9558, - 'TRY' => 6.2261, - 'CNY' => 7.8852, - 'NOK' => 9.5418, - 'NZD' => 1.6815, - 'ZAR' => 16.1884, - 'USD' => 1.1346, - 'MXN' => 23.0001, - 'ILS' => 4.171, - 'GBP' => 0.87053, - 'KRW' => 1278.77, - 'MYR' => 4.7399, - ], - 'base' => 'EUR', - 'date' => '2018-11-09', - ]); + 'rates' => [ + 'CAD' => 1.4969, + 'HKD' => 8.8843, + 'ISK' => 138.5, + 'PHP' => 60.256, + 'DKK' => 7.4594, + 'HUF' => 321.31, + 'CZK' => 25.936, + 'AUD' => 1.5663, + 'RON' => 4.657, + 'SEK' => 10.2648, + 'IDR' => 16661.6, + 'INR' => 82.264, + 'BRL' => 4.254, + 'RUB' => 76.4283, + 'HRK' => 7.43, + 'JPY' => 129.26, + 'THB' => 37.453, + 'CHF' => 1.1414, + 'SGD' => 1.5627, + 'PLN' => 4.288, + 'BGN' => 1.9558, + 'TRY' => 6.2261, + 'CNY' => 7.8852, + 'NOK' => 9.5418, + 'NZD' => 1.6815, + 'ZAR' => 16.1884, + 'USD' => 1.1346, + 'MXN' => 23.0001, + 'ILS' => 4.171, + 'GBP' => 0.87053, + 'KRW' => 1278.77, + 'MYR' => 4.7399, + ], + 'base' => 'EUR', + 'date' => '2018-11-09', + ]); } private function mockResponseForCurrentDateAndMultipleSymbols(): Response diff --git a/tests/Unit/Drivers/ExchangeRatesApiIo/ExchangeRateTest.php b/tests/Unit/Drivers/ExchangeRatesApiIo/ExchangeRateTest.php index eb7ea29..75f22f3 100644 --- a/tests/Unit/Drivers/ExchangeRatesApiIo/ExchangeRateTest.php +++ b/tests/Unit/Drivers/ExchangeRatesApiIo/ExchangeRateTest.php @@ -236,24 +236,24 @@ private function mockResponseForCurrentDateAndMultipleSymbols(): Response private function mockResponseForPastDateAndOneSymbol(): Response { return new Response([ - 'rates' => [ - 'GBP' => 0.87053, - ], - 'base' => 'EUR', - 'date' => '2018-11-09', - ]); + 'rates' => [ + 'GBP' => 0.87053, + ], + 'base' => 'EUR', + 'date' => '2018-11-09', + ]); } private function mockResponseForPastDateAndMultipleSymbols(): Response { return new Response([ - 'rates' => [ - 'CAD' => 1.4969, - 'USD' => 1.1346, - 'GBP' => 0.87053, - ], - 'base' => 'EUR', - 'date' => '2018-11-09', - ]); + 'rates' => [ + 'CAD' => 1.4969, + 'USD' => 1.1346, + 'GBP' => 0.87053, + ], + 'base' => 'EUR', + 'date' => '2018-11-09', + ]); } } diff --git a/tests/Unit/Drivers/ExchangeRatesDataApi/ConvertTest.php b/tests/Unit/Drivers/ExchangeRatesDataApi/ConvertTest.php index e4e467a..e1ece95 100644 --- a/tests/Unit/Drivers/ExchangeRatesDataApi/ConvertTest.php +++ b/tests/Unit/Drivers/ExchangeRatesDataApi/ConvertTest.php @@ -6,13 +6,12 @@ use AshAllenDesign\LaravelExchangeRates\Drivers\ExchangeRatesDataApi\ExchangeRatesDataApiDriver; use AshAllenDesign\LaravelExchangeRates\Drivers\ExchangeRatesDataApi\RequestBuilder; +use AshAllenDesign\LaravelExchangeRates\Drivers\ExchangeRatesDataApi\Response; use AshAllenDesign\LaravelExchangeRates\Exceptions\InvalidCurrencyException; use AshAllenDesign\LaravelExchangeRates\Exceptions\InvalidDateException; use AshAllenDesign\LaravelExchangeRates\Tests\Unit\TestCase; use Illuminate\Support\Facades\Cache; use Mockery; -use AshAllenDesign\LaravelExchangeRates\Drivers\ExchangeRatesDataApi\Response; - final class ConvertTest extends TestCase { diff --git a/tests/Unit/Drivers/ExchangeRatesDataApi/CurrenciesTest.php b/tests/Unit/Drivers/ExchangeRatesDataApi/CurrenciesTest.php index c634229..b11b680 100644 --- a/tests/Unit/Drivers/ExchangeRatesDataApi/CurrenciesTest.php +++ b/tests/Unit/Drivers/ExchangeRatesDataApi/CurrenciesTest.php @@ -6,11 +6,10 @@ use AshAllenDesign\LaravelExchangeRates\Drivers\ExchangeRatesDataApi\ExchangeRatesDataApiDriver; use AshAllenDesign\LaravelExchangeRates\Drivers\ExchangeRatesDataApi\RequestBuilder; +use AshAllenDesign\LaravelExchangeRates\Drivers\ExchangeRatesDataApi\Response; use AshAllenDesign\LaravelExchangeRates\Tests\Unit\TestCase; use Illuminate\Support\Facades\Cache; use Mockery; -use AshAllenDesign\LaravelExchangeRates\Drivers\ExchangeRatesDataApi\Response; - final class CurrenciesTest extends TestCase { diff --git a/tests/Unit/Drivers/ExchangeRatesDataApi/ExchangeRateBetweenDateRangeTest.php b/tests/Unit/Drivers/ExchangeRatesDataApi/ExchangeRateBetweenDateRangeTest.php index 01880f2..c8ebd9c 100644 --- a/tests/Unit/Drivers/ExchangeRatesDataApi/ExchangeRateBetweenDateRangeTest.php +++ b/tests/Unit/Drivers/ExchangeRatesDataApi/ExchangeRateBetweenDateRangeTest.php @@ -6,14 +6,13 @@ use AshAllenDesign\LaravelExchangeRates\Drivers\ExchangeRatesDataApi\ExchangeRatesDataApiDriver; use AshAllenDesign\LaravelExchangeRates\Drivers\ExchangeRatesDataApi\RequestBuilder; +use AshAllenDesign\LaravelExchangeRates\Drivers\ExchangeRatesDataApi\Response; use AshAllenDesign\LaravelExchangeRates\Exceptions\InvalidCurrencyException; use AshAllenDesign\LaravelExchangeRates\Exceptions\InvalidDateException; use AshAllenDesign\LaravelExchangeRates\Tests\Unit\TestCase; use Carbon\Carbon; use Illuminate\Support\Facades\Cache; use Mockery; -use AshAllenDesign\LaravelExchangeRates\Drivers\ExchangeRatesDataApi\Response; - final class ExchangeRateBetweenDateRangeTest extends TestCase { diff --git a/tests/Unit/Drivers/ExchangeRatesDataApi/ExchangeRateTest.php b/tests/Unit/Drivers/ExchangeRatesDataApi/ExchangeRateTest.php index f0ccedd..1bdc527 100644 --- a/tests/Unit/Drivers/ExchangeRatesDataApi/ExchangeRateTest.php +++ b/tests/Unit/Drivers/ExchangeRatesDataApi/ExchangeRateTest.php @@ -248,13 +248,13 @@ private function mockResponseForPastDateAndOneSymbol(): Response private function mockResponseForPastDateAndMultipleSymbols(): Response { return new Response([ - 'rates' => [ - 'CAD' => 1.4969, - 'USD' => 1.1346, - 'GBP' => 0.87053, - ], - 'base' => 'EUR', - 'date' => '2018-11-09', - ]); + 'rates' => [ + 'CAD' => 1.4969, + 'USD' => 1.1346, + 'GBP' => 0.87053, + ], + 'base' => 'EUR', + 'date' => '2018-11-09', + ]); } }