diff --git a/tests/_support/Page/Http.php b/tests/_support/Page/Http.php new file mode 100644 index 00000000000..7735ae09a56 --- /dev/null +++ b/tests/_support/Page/Http.php @@ -0,0 +1,93 @@ +Money Doesn\'t Grow On Trees'; + public const TEST_DOMAIN = 'phalcon.io'; + public const TEST_IP_IPV6 = '2a00:8640:1::224:36ff:feef:1d89'; + public const TEST_IP_ONE = '10.4.6.1'; + public const TEST_IP_TWO = '10.4.6.2'; + public const TEST_IP_THREE = '10.4.6.3'; + public const TEST_IP_MULTI = '10.4.6.4,10.4.6.5'; + public const TEST_URI = 'https://phalcon.io'; + public const TEST_USER_AGENT = 'Chrome/Other 1.0.0'; +} diff --git a/tests/unit/Assets/Collection/GetRealTargetPathCest.php b/tests/unit/Assets/Collection/GetRealTargetPathCest.php index fb676bb8a33..ab188610e23 100644 --- a/tests/unit/Assets/Collection/GetRealTargetPathCest.php +++ b/tests/unit/Assets/Collection/GetRealTargetPathCest.php @@ -50,7 +50,8 @@ public function assetsCollectionGetRealTargetPath(UnitTester $I) } /** - * Tests Phalcon\Assets\Collection :: getRealTargetPath() - file does not exist + * Tests Phalcon\Assets\Collection :: getRealTargetPath() - file does not + * exist * * @param UnitTester $I * diff --git a/tests/unit/Autoload/Loader/GetAddSetDirectoriesCest.php b/tests/unit/Autoload/Loader/GetAddSetDirectoriesCest.php index d1c6136dd02..c463dd4fc37 100644 --- a/tests/unit/Autoload/Loader/GetAddSetDirectoriesCest.php +++ b/tests/unit/Autoload/Loader/GetAddSetDirectoriesCest.php @@ -24,7 +24,8 @@ class GetAddSetDirectoriesCest use LoaderTrait; /** - * Tests Phalcon\Autoload\Loader :: getDirectories()/addDirectory()/setDirectories() + * Tests Phalcon\Autoload\Loader :: + * getDirectories()/addDirectory()/setDirectories() * * @param UnitTester $I * diff --git a/tests/unit/Events/Manager/AttachCest.php b/tests/unit/Events/Manager/AttachCest.php index feda9397858..e2d109191b5 100644 --- a/tests/unit/Events/Manager/AttachCest.php +++ b/tests/unit/Events/Manager/AttachCest.php @@ -62,7 +62,8 @@ public function eventsManagerAttachByNameAfterDetatchAll(UnitTester $I) $eventsManager->attach('log', $first); $logListeners = $component->getEventsManager() - ->getListeners('log'); + ->getListeners('log') + ; $I->assertCount(1, $logListeners); $expected = OneListener::class; @@ -73,7 +74,8 @@ public function eventsManagerAttachByNameAfterDetatchAll(UnitTester $I) ->attach('log', $second) ; $logListeners = $component->getEventsManager() - ->getListeners('log'); + ->getListeners('log') + ; $I->assertCount(2, $logListeners); $expected = OneListener::class; @@ -88,14 +90,16 @@ public function eventsManagerAttachByNameAfterDetatchAll(UnitTester $I) ->detachAll('log') ; $logListeners = $component->getEventsManager() - ->getListeners('log'); + ->getListeners('log') + ; $I->assertEmpty($logListeners); $component->getEventsManager() ->attach('log', $second) ; $logListeners = $component->getEventsManager() - ->getListeners('log'); + ->getListeners('log') + ; $I->assertCount(1, $logListeners); $expected = TwoListener::class; diff --git a/tests/unit/Events/Manager/FireCest.php b/tests/unit/Events/Manager/FireCest.php index 45777b8fdd9..467647b4e32 100644 --- a/tests/unit/Events/Manager/FireCest.php +++ b/tests/unit/Events/Manager/FireCest.php @@ -55,7 +55,8 @@ public function eventsManagerFire(UnitTester $I) $expected = ['three', 'two', 'one']; $actual = $component->getEventsManager() - ->getResponses(); + ->getResponses() + ; $I->assertSame($expected, $actual); } @@ -90,7 +91,8 @@ public function eventsManagerFireWithPriorities(UnitTester $I) $expected = ['one', 'two', 'three']; $actual = $component->getEventsManager() - ->getResponses(); + ->getResponses() + ; $I->assertSame($expected, $actual); } diff --git a/tests/unit/Events/Manager/GetListenersCest.php b/tests/unit/Events/Manager/GetListenersCest.php index face833acb3..da648934a28 100644 --- a/tests/unit/Events/Manager/GetListenersCest.php +++ b/tests/unit/Events/Manager/GetListenersCest.php @@ -43,7 +43,8 @@ public function eventsManagerGetListeners(UnitTester $I) $eventsManager->attach('log', $first); $eventsManager->attach('log', $second); $logListeners = $component->getEventsManager() - ->getListeners('log'); + ->getListeners('log') + ; $I->assertCount(2, $logListeners); $expected = OneListener::class; diff --git a/tests/unit/Events/Manager/GetResponsesCest.php b/tests/unit/Events/Manager/GetResponsesCest.php index f1d75ff5336..1b03bc5f6a4 100644 --- a/tests/unit/Events/Manager/GetResponsesCest.php +++ b/tests/unit/Events/Manager/GetResponsesCest.php @@ -53,7 +53,8 @@ public function eventsManagerGetResponses(UnitTester $I) $expected = ['one']; $actual = $component->getEventsManager() - ->getResponses(); + ->getResponses() + ; $I->assertSame($expected, $actual); } } diff --git a/tests/unit/Events/Manager/IsValidHandlerCest.php b/tests/unit/Events/Manager/IsValidHandlerCest.php index 9ebc16e8f93..1e20f834c7a 100644 --- a/tests/unit/Events/Manager/IsValidHandlerCest.php +++ b/tests/unit/Events/Manager/IsValidHandlerCest.php @@ -55,7 +55,7 @@ private function getExamples(): array [ 'string', false, - 'handler' + 'handler', ], [ 'integer', @@ -70,12 +70,12 @@ private function getExamples(): array [ 'callable - method', true, - [$objectHandler, 'hasListeners'] + [$objectHandler, 'hasListeners'], ], [ 'closure', true, - $closureHandler + $closureHandler, ], ]; } diff --git a/tests/unit/Filter/Filter/SanitizeMultipleCest.php b/tests/unit/Filter/Filter/SanitizeMultipleCest.php index 417fc6b81ba..05781abe58f 100644 --- a/tests/unit/Filter/Filter/SanitizeMultipleCest.php +++ b/tests/unit/Filter/Filter/SanitizeMultipleCest.php @@ -32,8 +32,8 @@ class SanitizeMultipleCest * @param UnitTester $I * @param Example $example * - * @author Phalcon Team - * @since 2021-10-23 + * @author Phalcon Team + * @since 2021-10-23 */ public function filterFilterSanitize(UnitTester $I, Example $example) { @@ -47,7 +47,7 @@ public function filterFilterSanitize(UnitTester $I, Example $example) $filters = $example['filters']; $noRecursive = $example['noRecursive']; - $actual = $filter->sanitize($source, $filters, $noRecursive); + $actual = $filter->sanitize($source, $filters, $noRecursive); $I->assertSame($expected, $actual); } @@ -117,7 +117,7 @@ public function filterFilterSanitizeCustomFilters(UnitTester $I, Example $exampl $filter->set($name, $testFilter); } - $actual = $filter->sanitize($source, array_keys($filters), $noRecursive); + $actual = $filter->sanitize($source, array_keys($filters), $noRecursive); $I->assertSame($expected, $actual); } @@ -129,49 +129,49 @@ private function getFilterSanitizeExamples(): array { return [ [ - 'label' => 'null value', - 'source' => null, - 'filters' => [ + 'label' => 'null value', + 'source' => null, + 'filters' => [ 'string', 'trim', ], 'noRecursive' => false, - 'expected' => null, + 'expected' => null, ], [ - 'label' => 'string with filters', - 'source' => ' lol<<< ', - 'filters' => [ + 'label' => 'string with filters', + 'source' => ' lol<<< ', + 'filters' => [ 'string', 'trim', ], 'noRecursive' => false, - 'expected' => 'lol<<<', + 'expected' => 'lol<<<', ], [ - 'label' => 'array with filters', - 'source' => [' 1 ', ' 2', '3 '], - 'filters' => 'trim', + 'label' => 'array with filters', + 'source' => [' 1 ', ' 2', '3 '], + 'filters' => 'trim', 'noRecursive' => false, - 'expected' => ['1', '2', '3'], + 'expected' => ['1', '2', '3'], ], [ - 'label' => 'array with multiple filters', - 'source' => [' 1 ', '

2

', '

3

'], - 'filters' => ['striptags', 'trim'], + 'label' => 'array with multiple filters', + 'source' => [' 1 ', '

2

', '

3

'], + 'filters' => ['striptags', 'trim'], 'noRecursive' => false, - 'expected' => ['1', '2', '3'], + 'expected' => ['1', '2', '3'], ], [ - 'label' => 'multiple filters and more parameters', - 'source' => ' mary had a little lamb ', - 'filters' => [ + 'label' => 'multiple filters and more parameters', + 'source' => ' mary had a little lamb ', + 'filters' => [ 'trim', 'replace' => [' ', '-'], 'remove' => ['mary'], ], 'noRecursive' => false, - 'expected' => '-had-a-little-lamb', + 'expected' => '-had-a-little-lamb', ], ]; } @@ -183,24 +183,24 @@ private function getFilterSanitizeCustomFiltersExamples(): array { return [ [ - 'label' => 'no recursive array value with multiple sanitizers', - 'source' => [4, 2, 0], - 'filters' => [ - 'sum' => fn ($input) => array_sum($input), - 'half' => fn ($input) => $input / 2, + 'label' => 'no recursive array value with multiple sanitizers', + 'source' => [4, 2, 0], + 'filters' => [ + 'sum' => fn($input) => array_sum($input), + 'half' => fn($input) => $input / 2, ], 'noRecursive' => true, - 'expected' => 3, + 'expected' => 3, ], [ - 'label' => 'recursive array value with multiple sanitizers', - 'source' => [4, 2, 0], - 'filters' => [ - 'double' => fn ($input) => $input * 2, - 'inverse' => fn ($input) => 0 - $input, + 'label' => 'recursive array value with multiple sanitizers', + 'source' => [4, 2, 0], + 'filters' => [ + 'double' => fn($input) => $input * 2, + 'inverse' => fn($input) => 0 - $input, ], 'noRecursive' => false, - 'expected' => [-8, -4, 0], + 'expected' => [-8, -4, 0], ], ]; } diff --git a/tests/unit/Filter/SanitizeCest.php b/tests/unit/Filter/SanitizeCest.php index 6dcd42c9809..458c57a549d 100644 --- a/tests/unit/Filter/SanitizeCest.php +++ b/tests/unit/Filter/SanitizeCest.php @@ -377,8 +377,10 @@ private function getExamples(): array 'class' => 'email', 'label' => 'email()', 'method' => 'email', - 'source' => ["!(first.guy) - @*my-domain**##.com.rx//"], + 'source' => [ + "!(first.guy) + @*my-domain**##.com.rx//", + ], 'expected' => "!first.guy@*my-domain**##.com.rx", ], [ diff --git a/tests/unit/Html/Escaper/AttributesCest.php b/tests/unit/Html/Escaper/AttributesCest.php index 256d16e8ca6..356b98c2019 100644 --- a/tests/unit/Html/Escaper/AttributesCest.php +++ b/tests/unit/Html/Escaper/AttributesCest.php @@ -39,13 +39,14 @@ class AttributesCest */ public function escaperAttributes(UnitTester $I, Example $example) { - $I->wantToTest('Escaper - attributes()'); - - $escaper = new Escaper(); - $text = $example['text']; $flags = $example['htmlQuoteType']; + $I->wantToTest( + 'Escaper - attributes() - ' . $flags + ); + + $escaper = new Escaper(); $escaper->setFlags($flags); $expected = $example['expected']; diff --git a/tests/unit/Html/Escaper/GetSetFlagsCest.php b/tests/unit/Html/Escaper/GetSetFlagsCest.php index f2912fabc56..95a39aa6a1b 100644 --- a/tests/unit/Html/Escaper/GetSetFlagsCest.php +++ b/tests/unit/Html/Escaper/GetSetFlagsCest.php @@ -45,6 +45,10 @@ public function escaperGetSetFlags(UnitTester $I) $actual = $escaper->getFlags(); $I->assertSame($expected, $actual); + $expected = 'That's right'; + $actual = $escaper->attributes("That's right"); + $I->assertSame($expected, $actual); + $escaper->setFlags(ENT_HTML401); $expected = ENT_HTML401; diff --git a/tests/unit/Html/Helper/Link/UnderscoreInvokeCest.php b/tests/unit/Html/Helper/Link/UnderscoreInvokeCest.php index a6c2bd5c84f..8141df070c2 100644 --- a/tests/unit/Html/Helper/Link/UnderscoreInvokeCest.php +++ b/tests/unit/Html/Helper/Link/UnderscoreInvokeCest.php @@ -93,7 +93,7 @@ private function getExamples(): array 'add' => [ 'https://phalcon.io/assets/base.css' => [ 'rel' => 'stylesheet', - 'media' => 'screen' + 'media' => 'screen', ], ], 'indent' => ' ', diff --git a/tests/unit/Html/Link/EvolvableLink/WithoutRelCest.php b/tests/unit/Html/Link/EvolvableLink/WithoutRelCest.php index e08fe82a19d..6799baee3ea 100644 --- a/tests/unit/Html/Link/EvolvableLink/WithoutRelCest.php +++ b/tests/unit/Html/Link/EvolvableLink/WithoutRelCest.php @@ -42,7 +42,8 @@ public function linkEvolvableLinkWithoutRel(UnitTester $I) $newInstance = $link ->withRel('citation') - ->withRel('canonical'); + ->withRel('canonical') + ; $I->assertNotSame($link, $newInstance); diff --git a/tests/unit/Html/Link/Link/ConstructCest.php b/tests/unit/Html/Link/Link/ConstructCest.php index 08a8f1ac844..f211754b761 100644 --- a/tests/unit/Html/Link/Link/ConstructCest.php +++ b/tests/unit/Html/Link/Link/ConstructCest.php @@ -13,8 +13,8 @@ namespace Phalcon\Tests\Unit\Html\Link\Link; -use Phalcon\Html\Link\Link; use Phalcon\Html\Link\Interfaces\LinkInterface; +use Phalcon\Html\Link\Link; use UnitTester; /** diff --git a/tests/unit/Html/Link/LinkProvider/ConstructCest.php b/tests/unit/Html/Link/LinkProvider/ConstructCest.php index 905378fb057..8e04e2c5679 100644 --- a/tests/unit/Html/Link/LinkProvider/ConstructCest.php +++ b/tests/unit/Html/Link/LinkProvider/ConstructCest.php @@ -13,9 +13,9 @@ namespace Phalcon\Tests\Unit\Html\Link\LinkProvider; +use Phalcon\Html\Link\Interfaces\LinkProviderInterface; use Phalcon\Html\Link\Link; use Phalcon\Html\Link\LinkProvider; -use Phalcon\Html\Link\Interfaces\LinkProviderInterface; use UnitTester; /** diff --git a/tests/unit/Image/Adapter/Gd/RenderCest.php b/tests/unit/Image/Adapter/Gd/RenderCest.php index 66922c57e79..1196326a53a 100644 --- a/tests/unit/Image/Adapter/Gd/RenderCest.php +++ b/tests/unit/Image/Adapter/Gd/RenderCest.php @@ -38,7 +38,7 @@ public function imageAdapterGdRender(UnitTester $I) 'png' => [8802, '30787c3c1e181818'], 'wbmp' => [31761, '00c78ffe78030200'], 'webp' => [483066, '270640183c3c7c7c'], - 'xyz' => [8802, '30787c3c1e181818'] // unknown defaults to png, + 'xyz' => [8802, '30787c3c1e181818'], // unknown defaults to png, ]; foreach ($this->getImages() as $type => $imagePath) { diff --git a/tests/unit/Image/Adapter/Imagick/GetImageCest.php b/tests/unit/Image/Adapter/Imagick/GetImageCest.php index aed8fe0a49c..3b05c5f1edc 100644 --- a/tests/unit/Image/Adapter/Imagick/GetImageCest.php +++ b/tests/unit/Image/Adapter/Imagick/GetImageCest.php @@ -37,7 +37,7 @@ public function imageAdapterImagickGetImage(UnitTester $I) dataDir('assets/images/example-jpg.jpg') ); - $class = \Imagick::class; + $class = \Imagick::class; $actual = $image->getImage(); $I->assertInstanceOf($class, $actual); } diff --git a/tests/unit/Image/Adapter/Imagick/SetResourceLimitCest.php b/tests/unit/Image/Adapter/Imagick/SetResourceLimitCest.php index 6c3a41979c9..9ce3a6a9e46 100644 --- a/tests/unit/Image/Adapter/Imagick/SetResourceLimitCest.php +++ b/tests/unit/Image/Adapter/Imagick/SetResourceLimitCest.php @@ -22,7 +22,8 @@ class SetResourceLimitCest { /** - * Unit Tests Phalcon\Image\Adapter\Imagick :: setResourceLimit() - exception + * Unit Tests Phalcon\Image\Adapter\Imagick :: setResourceLimit() - + * exception * * @author Phalcon Team * @since 2022-08-02 diff --git a/tests/unit/Logger/Adapter/Noop/AddCest.php b/tests/unit/Logger/Adapter/Noop/AddCest.php index a062b9af467..cc5f4842d8d 100644 --- a/tests/unit/Logger/Adapter/Noop/AddCest.php +++ b/tests/unit/Logger/Adapter/Noop/AddCest.php @@ -16,8 +16,8 @@ use DateTimeImmutable; use DateTimeZone; use Phalcon\Logger\Adapter\Noop; +use Phalcon\Logger\Enum; use Phalcon\Logger\Item; -use Phalcon\Logger\Logger; use UnitTester; use function date_default_timezone_get; @@ -45,21 +45,21 @@ public function loggerAdapterNoopAdd(UnitTester $I) $item1 = new Item( 'Message 1', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); $item2 = new Item( 'Message 2', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); $item3 = new Item( 'Message 3', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); diff --git a/tests/unit/Logger/Adapter/Noop/ProcessCest.php b/tests/unit/Logger/Adapter/Noop/ProcessCest.php index ccde5c11976..b7fb8ad99cb 100644 --- a/tests/unit/Logger/Adapter/Noop/ProcessCest.php +++ b/tests/unit/Logger/Adapter/Noop/ProcessCest.php @@ -16,8 +16,8 @@ use DateTimeImmutable; use DateTimeZone; use Phalcon\Logger\Adapter\Noop; +use Phalcon\Logger\Enum; use Phalcon\Logger\Item; -use Phalcon\Logger\Logger; use UnitTester; use function date_default_timezone_get; @@ -43,7 +43,7 @@ public function loggerAdapterNoopProcess(UnitTester $I) $item = new Item( 'Message 1', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); diff --git a/tests/unit/Logger/Adapter/Stream/AddCest.php b/tests/unit/Logger/Adapter/Stream/AddCest.php index 4281111d9ec..043a3d27398 100644 --- a/tests/unit/Logger/Adapter/Stream/AddCest.php +++ b/tests/unit/Logger/Adapter/Stream/AddCest.php @@ -16,8 +16,8 @@ use DateTimeImmutable; use DateTimeZone; use Phalcon\Logger\Adapter\Stream; +use Phalcon\Logger\Enum; use Phalcon\Logger\Item; -use Phalcon\Logger\Logger; use UnitTester; use function date_default_timezone_get; @@ -45,19 +45,19 @@ public function loggerAdapterStreamAdd(UnitTester $I) $item1 = new Item( 'Message 1', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); $item2 = new Item( 'Message 2', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); $item3 = new Item( 'Message 3', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); diff --git a/tests/unit/Logger/Adapter/Stream/CloseCest.php b/tests/unit/Logger/Adapter/Stream/CloseCest.php index dc8846ea7d0..0f96f2c12db 100644 --- a/tests/unit/Logger/Adapter/Stream/CloseCest.php +++ b/tests/unit/Logger/Adapter/Stream/CloseCest.php @@ -16,9 +16,9 @@ use DateTimeImmutable; use DateTimeZone; use Phalcon\Logger\Adapter\Stream; +use Phalcon\Logger\Enum; use Phalcon\Logger\Exception; use Phalcon\Logger\Item; -use Phalcon\Logger\Logger; use UnitTester; use function date_default_timezone_get; @@ -45,7 +45,7 @@ public function loggerAdapterStreamClose(UnitTester $I) $item = new Item( 'Message 1', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); $adapter->process($item); diff --git a/tests/unit/Logger/Adapter/Stream/ProcessCest.php b/tests/unit/Logger/Adapter/Stream/ProcessCest.php index 2d6996a4bb3..4498d170f34 100644 --- a/tests/unit/Logger/Adapter/Stream/ProcessCest.php +++ b/tests/unit/Logger/Adapter/Stream/ProcessCest.php @@ -18,8 +18,8 @@ use DateTimeZone; use LogicException; use Phalcon\Logger\Adapter\Stream; +use Phalcon\Logger\Enum; use Phalcon\Logger\Item; -use Phalcon\Logger\Logger; use UnitTester; use function date_default_timezone_get; @@ -47,7 +47,7 @@ public function loggerAdapterStreamProcess(UnitTester $I) $item = new Item( 'Message 1', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); $adapter->process($item); @@ -97,7 +97,7 @@ function () use ($outputPath, $fileName) { $item = new Item( 'Message 1', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); $adapter->process($item); diff --git a/tests/unit/Logger/Adapter/Syslog/AddCest.php b/tests/unit/Logger/Adapter/Syslog/AddCest.php index 9ee1e5b86a1..3bbc6de20a7 100644 --- a/tests/unit/Logger/Adapter/Syslog/AddCest.php +++ b/tests/unit/Logger/Adapter/Syslog/AddCest.php @@ -21,10 +21,9 @@ use DateTimeImmutable; use DateTimeZone; use Phalcon\Logger\Adapter\Syslog; +use Phalcon\Logger\Enum; use Phalcon\Logger\Item; -use Phalcon\Logger\Logger; use UnitTester; - use function date_default_timezone_get; class AddCest @@ -51,21 +50,21 @@ public function loggerAdapterSyslogAdd(UnitTester $I) $item1 = new Item( 'Message 1', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); $item2 = new Item( 'Message 2', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); $item3 = new Item( 'Message 3', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); diff --git a/tests/unit/Logger/Adapter/Syslog/ProcessCest.php b/tests/unit/Logger/Adapter/Syslog/ProcessCest.php index bcc78579449..f4cf7c80806 100644 --- a/tests/unit/Logger/Adapter/Syslog/ProcessCest.php +++ b/tests/unit/Logger/Adapter/Syslog/ProcessCest.php @@ -18,8 +18,8 @@ use DateTimeZone; use LogicException; use Phalcon\Logger\Adapter\Syslog; +use Phalcon\Logger\Enum; use Phalcon\Logger\Item; -use Phalcon\Logger\Logger; use UnitTester; use function date_default_timezone_get; @@ -46,7 +46,7 @@ public function loggerAdapterSyslogProcess(UnitTester $I) $item = new Item( 'Message 1', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); @@ -88,7 +88,7 @@ function () use ($fileName) { $item = new Item( 'Message 1', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); $adapter->process($item); diff --git a/tests/unit/Logger/Formatter/Json/FormatCest.php b/tests/unit/Logger/Formatter/Json/FormatCest.php index 53b5114f544..8fd1777ba1c 100644 --- a/tests/unit/Logger/Formatter/Json/FormatCest.php +++ b/tests/unit/Logger/Formatter/Json/FormatCest.php @@ -16,9 +16,9 @@ use DateTimeImmutable; use DateTimeZone; use Exception; +use Phalcon\Logger\Enum; use Phalcon\Logger\Formatter\Json; use Phalcon\Logger\Item; -use Phalcon\Logger\Logger; use UnitTester; use function date_default_timezone_get; @@ -45,7 +45,7 @@ public function loggerFormatterJsonFormat(UnitTester $I) $item = new Item( 'log message', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); @@ -80,7 +80,7 @@ public function loggerFormatterJsonFormatCustom(UnitTester $I) $item = new Item( 'log message', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); diff --git a/tests/unit/Logger/Formatter/Line/FormatCest.php b/tests/unit/Logger/Formatter/Line/FormatCest.php index 59e1c549993..f215037f5e8 100644 --- a/tests/unit/Logger/Formatter/Line/FormatCest.php +++ b/tests/unit/Logger/Formatter/Line/FormatCest.php @@ -16,12 +16,13 @@ use DateTimeImmutable; use DateTimeZone; use Exception; +use Phalcon\Logger\Enum; use Phalcon\Logger\Formatter\Line; use Phalcon\Logger\Item; -use Phalcon\Logger\Logger; use UnitTester; use function date_default_timezone_get; +use function uniqid; class FormatCest { @@ -44,7 +45,7 @@ public function loggerFormatterLineFormat(UnitTester $I) $item = new Item( 'log message', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); @@ -52,11 +53,8 @@ public function loggerFormatterLineFormat(UnitTester $I) '[%s][debug] log message', $datetime->format('c') ); - - $I->assertSame( - $expected, - $formatter->format($item) - ); + $actual = $formatter->format($item); + $I->assertSame($expected, $actual); } /** @@ -78,7 +76,7 @@ public function loggerFormatterLineFormatCustom(UnitTester $I) $item = new Item( 'log message', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); @@ -86,11 +84,8 @@ public function loggerFormatterLineFormatCustom(UnitTester $I) 'log message-[debug]-%s', $datetime->format('c') ); - - $I->assertSame( - $expected, - $formatter->format($item) - ); + $actual = $formatter->format($item); + $I->assertSame($expected, $actual); } /** @@ -116,15 +111,66 @@ public function loggerFormatterLineFormatCustomWithMilliseconds(UnitTester $I) $item = new Item( 'log message', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); $result = $formatter->format($item); $parts = explode('-', $result); $parts = explode('.', $parts[2]); - $I->assertCount(2, $parts); - $I->assertGreaterThan(0, (int) $parts[0]); - $I->assertGreaterThan(0, (int) $parts[1]); + + $expected = 2; + $actual = $parts; + $I->assertCount($expected, $actual); + + $expected = 0; + $actual = (int) $parts[0]; + $I->assertGreaterThan($expected, $actual); + + $expected = 0; + $actual = (int) $parts[1]; + $I->assertGreaterThan($expected, $actual); + } + + /** + * Tests Phalcon\Logger\Formatter\Line :: format() - custom interpolator + * + * @param UnitTester $I + * + * @throws Exception + * @since 2022-09-11 + * @author Phalcon Team + */ + public function loggerFormatterLineFormatCustomInterpolator(UnitTester $I) + { + $I->wantToTest('Logger\Formatter\Line - format() - custom - interpolator'); + + $formatter = new Line( + '%message%-[%level%]-%date%-%server%:%user%', + 'U.u' + ); + + $timezone = date_default_timezone_get(); + $datetime = new DateTimeImmutable('now', new DateTimeZone($timezone)); + $context = [ + 'server' => uniqid('srv-'), + 'user' => uniqid('usr-'), + ]; + $item = new Item( + 'log message', + 'debug', + Enum::DEBUG, + $datetime, + $context + ); + + $expected = sprintf( + 'log message-[debug]-%s-%s:%s', + $datetime->format('U.u'), + $context['server'], + $context['user'] + ); + $actual = $formatter->format($item); + $I->assertSame($expected, $actual); } } diff --git a/tests/unit/Logger/Item/GetContextCest.php b/tests/unit/Logger/Item/GetContextCest.php index 36b4ab753ab..5ca7ffc7308 100644 --- a/tests/unit/Logger/Item/GetContextCest.php +++ b/tests/unit/Logger/Item/GetContextCest.php @@ -15,8 +15,8 @@ use DateTimeImmutable; use DateTimeZone; +use Phalcon\Logger\Enum; use Phalcon\Logger\Item; -use Phalcon\Logger\Logger; use UnitTester; use function date_default_timezone_get; @@ -41,7 +41,7 @@ public function loggerItemGetContext(UnitTester $I) $item = new Item( 'log message', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime, $context ); diff --git a/tests/unit/Logger/Item/GetDateTimeCest.php b/tests/unit/Logger/Item/GetDateTimeCest.php index 817dd6038b7..e130ae06941 100644 --- a/tests/unit/Logger/Item/GetDateTimeCest.php +++ b/tests/unit/Logger/Item/GetDateTimeCest.php @@ -15,8 +15,8 @@ use DateTimeImmutable; use DateTimeZone; +use Phalcon\Logger\Enum; use Phalcon\Logger\Item; -use Phalcon\Logger\Logger; use UnitTester; use function date_default_timezone_get; @@ -40,7 +40,7 @@ public function loggerItemGetTime(UnitTester $I) $item = new Item( 'log message', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); diff --git a/tests/unit/Logger/Item/GetLevelCest.php b/tests/unit/Logger/Item/GetLevelCest.php index 7593b7611be..aea53dd2fd5 100644 --- a/tests/unit/Logger/Item/GetLevelCest.php +++ b/tests/unit/Logger/Item/GetLevelCest.php @@ -15,8 +15,8 @@ use DateTimeImmutable; use DateTimeZone; +use Phalcon\Logger\Enum; use Phalcon\Logger\Item; -use Phalcon\Logger\Logger; use UnitTester; use function date_default_timezone_get; @@ -40,11 +40,11 @@ public function loggerItemGetLevel(UnitTester $I) $item = new Item( 'log message', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); - $expected = Logger::DEBUG; + $expected = Enum::DEBUG; $actual = $item->getLevel(); $I->assertSame($expected, $actual); } diff --git a/tests/unit/Logger/Item/GetLevelNameCest.php b/tests/unit/Logger/Item/GetLevelNameCest.php index f730c26dc57..51b8cb31ad0 100644 --- a/tests/unit/Logger/Item/GetLevelNameCest.php +++ b/tests/unit/Logger/Item/GetLevelNameCest.php @@ -15,8 +15,8 @@ use DateTimeImmutable; use DateTimeZone; +use Phalcon\Logger\Enum; use Phalcon\Logger\Item; -use Phalcon\Logger\Logger; use UnitTester; use function date_default_timezone_get; @@ -40,7 +40,7 @@ public function loggerItemGetLevelName(UnitTester $I) $item = new Item( 'log message', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); diff --git a/tests/unit/Logger/Item/GetMessageCest.php b/tests/unit/Logger/Item/GetMessageCest.php index 8a3f0d47a37..4f9a8b45154 100644 --- a/tests/unit/Logger/Item/GetMessageCest.php +++ b/tests/unit/Logger/Item/GetMessageCest.php @@ -15,8 +15,8 @@ use DateTimeImmutable; use DateTimeZone; +use Phalcon\Logger\Enum; use Phalcon\Logger\Item; -use Phalcon\Logger\Logger; use UnitTester; use function date_default_timezone_get; @@ -40,7 +40,7 @@ public function loggerItemGetMessage(UnitTester $I) $item = new Item( 'log message', 'debug', - Logger::DEBUG, + Enum::DEBUG, $datetime ); diff --git a/tests/unit/Logger/Logger/ConstructCest.php b/tests/unit/Logger/Logger/ConstructCest.php index 37fb5e98c57..370a9b6f559 100644 --- a/tests/unit/Logger/Logger/ConstructCest.php +++ b/tests/unit/Logger/Logger/ConstructCest.php @@ -14,6 +14,7 @@ namespace Phalcon\Tests\Unit\Logger\Logger; use Phalcon\Logger\Adapter\Stream; +use Phalcon\Logger\Enum; use Phalcon\Logger\Exception; use Phalcon\Logger\Formatter\Json; use Phalcon\Logger\Logger; @@ -50,15 +51,15 @@ public function loggerConstructConstants(UnitTester $I) { $I->wantToTest('Logger - __construct() - constants'); - $I->assertSame(2, Logger::ALERT); - $I->assertSame(1, Logger::CRITICAL); - $I->assertSame(7, Logger::DEBUG); - $I->assertSame(0, Logger::EMERGENCY); - $I->assertSame(3, Logger::ERROR); - $I->assertSame(6, Logger::INFO); - $I->assertSame(5, Logger::NOTICE); - $I->assertSame(4, Logger::WARNING); - $I->assertSame(8, Logger::CUSTOM); + $I->assertSame(2, Enum::ALERT); + $I->assertSame(1, Enum::CRITICAL); + $I->assertSame(7, Enum::DEBUG); + $I->assertSame(0, Enum::EMERGENCY); + $I->assertSame(3, Enum::ERROR); + $I->assertSame(6, Enum::INFO); + $I->assertSame(5, Enum::NOTICE); + $I->assertSame(4, Enum::WARNING); + $I->assertSame(8, Enum::CUSTOM); } /** @@ -89,7 +90,7 @@ public function loggerConstructStreamWithJsonConstants(UnitTester $I) $time = time(); $logger->debug('This is a message'); - $logger->log(Logger::ERROR, 'This is an error'); + $logger->log(Enum::ERROR, 'This is an error'); $logger->error('This is another error'); $I->amInPath($outputPath); diff --git a/tests/unit/Logger/Logger/GetSetLogLevelCest.php b/tests/unit/Logger/Logger/GetSetLogLevelCest.php index b4a7bd300a6..f4349007c50 100644 --- a/tests/unit/Logger/Logger/GetSetLogLevelCest.php +++ b/tests/unit/Logger/Logger/GetSetLogLevelCest.php @@ -13,6 +13,7 @@ namespace Phalcon\Tests\Unit\Logger\Logger; +use Phalcon\Logger\Enum; use Phalcon\Logger\Logger; use UnitTester; @@ -31,14 +32,14 @@ public function loggerGetSetLogLevel(UnitTester $I) $I->wantToTest('Logger - getLogLevel()/setLogLevel()'); $logger = new Logger('my-name'); - $I->assertSame(Logger::CUSTOM, $logger->getLogLevel()); + $I->assertSame(Enum::CUSTOM, $logger->getLogLevel()); - $object = $logger->setLogLevel(Logger::INFO); + $object = $logger->setLogLevel(Enum::INFO); $I->assertInstanceOf(Logger::class, $object); - $I->assertSame(Logger::INFO, $logger->getLogLevel()); + $I->assertSame(Enum::INFO, $logger->getLogLevel()); $logger->setLogLevel(99); - $I->assertSame(Logger::CUSTOM, $logger->getLogLevel()); + $I->assertSame(Enum::CUSTOM, $logger->getLogLevel()); } } diff --git a/tests/unit/Logger/Logger/LevelsCest.php b/tests/unit/Logger/Logger/LevelsCest.php index 9622ff14d62..f6ca69e8479 100644 --- a/tests/unit/Logger/Logger/LevelsCest.php +++ b/tests/unit/Logger/Logger/LevelsCest.php @@ -84,7 +84,8 @@ public function loggerAlert(UnitTester $I, Example $example) $logDateTime = new DateTime($date); $dateTimeAfterLog = new DateTime($logTime); $nInterval = $logDateTime->diff($dateTimeAfterLog) - ->format('%s'); + ->format('%s') + ; $nSecondThreshold = 60; $I->assertLessThan($nSecondThreshold, $nInterval); diff --git a/tests/unit/Logger/Logger/LogCest.php b/tests/unit/Logger/Logger/LogCest.php index 3026f21bfa6..0cfdf8210d7 100644 --- a/tests/unit/Logger/Logger/LogCest.php +++ b/tests/unit/Logger/Logger/LogCest.php @@ -14,12 +14,15 @@ namespace Phalcon\Tests\Unit\Logger\Logger; use Phalcon\Logger\Adapter\Stream; +use Phalcon\Logger\Enum; +use Phalcon\Logger\Formatter\Line; use Phalcon\Logger\Logger; use UnitTester; use function logsDir; use function sprintf; use function strtoupper; +use function uniqid; class LogCest { @@ -47,24 +50,24 @@ public function loggerLog(UnitTester $I) ); $levels = [ - Logger::ALERT => 'alert', - Logger::CRITICAL => 'critical', - Logger::DEBUG => 'debug', - Logger::EMERGENCY => 'emergency', - Logger::ERROR => 'error', - Logger::INFO => 'info', - Logger::NOTICE => 'notice', - Logger::WARNING => 'warning', - Logger::CUSTOM => 'custom', - 'alert' => 'alert', - 'critical' => 'critical', - 'debug' => 'debug', - 'emergency' => 'emergency', - 'error' => 'error', - 'info' => 'info', - 'notice' => 'notice', - 'warning' => 'warning', - 'custom' => 'custom', + Enum::ALERT => 'alert', + Enum::CRITICAL => 'critical', + Enum::DEBUG => 'debug', + Enum::EMERGENCY => 'emergency', + Enum::ERROR => 'error', + Enum::INFO => 'info', + Enum::NOTICE => 'notice', + Enum::WARNING => 'warning', + Enum::CUSTOM => 'custom', + 'alert' => 'alert', + 'critical' => 'critical', + 'debug' => 'debug', + 'emergency' => 'emergency', + 'error' => 'error', + 'info' => 'info', + 'notice' => 'notice', + 'warning' => 'warning', + 'custom' => 'custom', ]; foreach ($levels as $level => $levelName) { @@ -111,30 +114,30 @@ public function loggerLogLogLevel(UnitTester $I) ] ); - $logger->setLogLevel(Logger::ALERT); + $logger->setLogLevel(Enum::ALERT); $levelsYes = [ - Logger::ALERT => 'alert', - Logger::CRITICAL => 'critical', - Logger::EMERGENCY => 'emergency', - 'alert' => 'alert', - 'critical' => 'critical', - 'emergency' => 'emergency', + Enum::ALERT => 'alert', + Enum::CRITICAL => 'critical', + Enum::EMERGENCY => 'emergency', + 'alert' => 'alert', + 'critical' => 'critical', + 'emergency' => 'emergency', ]; $levelsNo = [ - Logger::DEBUG => 'debug', - Logger::ERROR => 'error', - Logger::INFO => 'info', - Logger::NOTICE => 'notice', - Logger::WARNING => 'warning', - Logger::CUSTOM => 'custom', - 'debug' => 'debug', - 'error' => 'error', - 'info' => 'info', - 'notice' => 'notice', - 'warning' => 'warning', - 'custom' => 'custom', + Enum::DEBUG => 'debug', + Enum::ERROR => 'error', + Enum::INFO => 'info', + Enum::NOTICE => 'notice', + Enum::WARNING => 'warning', + Enum::CUSTOM => 'custom', + 'debug' => 'debug', + 'error' => 'error', + 'info' => 'info', + 'notice' => 'notice', + 'warning' => 'warning', + 'custom' => 'custom', ]; foreach ($levelsYes as $level => $levelName) { @@ -169,4 +172,52 @@ public function loggerLogLogLevel(UnitTester $I) $adapter->close(); $I->safeDeleteFile($fileName); } + + /** + * Tests Phalcon\Logger :: log() - interpolator + * + * @param UnitTester $I + * + * @author Phalcon Team + * @since 2022-09-11 + */ + public function loggerLogLogInterpolator(UnitTester $I) + { + $I->wantToTest('Logger - log() - interpolator'); + + $logPath = logsDir(); + $fileName = $I->getNewFileName('log', 'log'); + $formatter = new Line( + '%message%-[%level%]-%server%:%user%', + 'U.u' + ); + $context = [ + 'server' => uniqid('srv-'), + 'user' => uniqid('usr-'), + ]; + $adapter = new Stream($logPath . $fileName); + $adapter->setFormatter($formatter); + + $logger = new Logger( + 'my-logger', + [ + 'one' => $adapter, + ] + ); + + $logger->log(Enum::DEBUG, 'log message', $context); + + $I->amInPath($logPath); + $I->openFile($fileName); + + $expected = sprintf( + 'log message-[DEBUG]-%s:%s', + $context['server'], + $context['user'] + ); + $I->seeInThisFile($expected); + + $adapter->close(); + $I->safeDeleteFile($fileName); + } } diff --git a/tests/unit/Messages/Messages/JsonSerializeCest.php b/tests/unit/Messages/Messages/JsonSerializeCest.php index ae4692fc79a..1fb9ed1a0fd 100644 --- a/tests/unit/Messages/Messages/JsonSerializeCest.php +++ b/tests/unit/Messages/Messages/JsonSerializeCest.php @@ -88,7 +88,7 @@ public function messagesMessagesJsonSerializeNoJsonSerialize(UnitTester $I): voi $messages = new Messages( [ - $fixture + $fixture, ] ); diff --git a/tests/unit/Support/Helper/File/BasenameCest.php b/tests/unit/Support/Helper/File/BasenameCest.php index 3d04703baef..9a3f00bfddb 100644 --- a/tests/unit/Support/Helper/File/BasenameCest.php +++ b/tests/unit/Support/Helper/File/BasenameCest.php @@ -51,7 +51,8 @@ public function supportHelperFileBasenamePureASCII(UnitTester $I, Example $examp } /** - * Tests Phalcon\Support\Helper\File :: basename() with non-ASCII $uri support + * Tests Phalcon\Support\Helper\File :: basename() with non-ASCII $uri + * support * * @dataProvider getNonAsciiExamples * diff --git a/tests/unit/Support/Helper/Str/InterpolateCest.php b/tests/unit/Support/Helper/Str/InterpolateCest.php index ea17b6b87dd..6006b4e05ca 100644 --- a/tests/unit/Support/Helper/Str/InterpolateCest.php +++ b/tests/unit/Support/Helper/Str/InterpolateCest.php @@ -53,7 +53,7 @@ private function getExamples(): array '%date% is the date', [ 'date' => '2020-09-09', - ] + ], ], [ 'date/level', @@ -61,8 +61,8 @@ private function getExamples(): array '%date% is the date %level% is the level', [ 'date' => '2020-09-09', - 'level' => 'CRITICAL' - ] + 'level' => 'CRITICAL', + ], ], [ 'empty', @@ -70,7 +70,7 @@ private function getExamples(): array 'no format', [ 'date' => '2020-09-09', - ] + ], ], [ 'date', @@ -78,7 +78,7 @@ private function getExamples(): array '%date% is the date', [ 'date' => '2020-09-09', - ] + ], ], [ 'date and context', @@ -87,7 +87,7 @@ private function getExamples(): array [ 'date' => '2020-09-09', 'stub' => 'AAA', - ] + ], ], ]; } diff --git a/tests/unit/Support/Helper/Str/ReduceSlashesCest.php b/tests/unit/Support/Helper/Str/ReduceSlashesCest.php index d903a3ac03c..6f8e95ef1bd 100644 --- a/tests/unit/Support/Helper/Str/ReduceSlashesCest.php +++ b/tests/unit/Support/Helper/Str/ReduceSlashesCest.php @@ -13,6 +13,7 @@ namespace Phalcon\Tests\Unit\Support\Helper\Str; +use Page\Http; use Phalcon\Support\Helper\Str\ReduceSlashes; use UnitTester; @@ -45,8 +46,8 @@ public function supportHelperStrReduceSlashes(UnitTester $I) $actual = $object('http://foo//bar/baz/buz'); $I->assertSame($expected, $actual); - $expected = 'php://memory'; - $actual = $object('php://memory'); + $expected = Http::STREAM_MEMORY; + $actual = $object(Http::STREAM_MEMORY); $I->assertSame($expected, $actual); $expected = 'http/https'; diff --git a/tests/unit/Support/Helper/Str/StartsWithCest.php b/tests/unit/Support/Helper/Str/StartsWithCest.php index 432c880af47..283dab36830 100644 --- a/tests/unit/Support/Helper/Str/StartsWithCest.php +++ b/tests/unit/Support/Helper/Str/StartsWithCest.php @@ -66,7 +66,8 @@ public function supportHelperStrStartsWithEmpty(UnitTester $I) } /** - * Tests Phalcon\Support\Helper\Str :: startsWith() - finding an empty string + * Tests Phalcon\Support\Helper\Str :: startsWith() - finding an empty + * string * * @param UnitTester $I * diff --git a/tests/unit/Support/HelperFactory/NewInstanceCest.php b/tests/unit/Support/HelperFactory/NewInstanceCest.php index ca99c3e7bc4..7ef15e537c6 100644 --- a/tests/unit/Support/HelperFactory/NewInstanceCest.php +++ b/tests/unit/Support/HelperFactory/NewInstanceCest.php @@ -183,6 +183,7 @@ private function getExamples(): array ["random", Random::class], ["reduceSlashes", ReduceSlashes::class], ["startsWith", StartsWith::class], + ["snakeCase", SnakeCase::class], ["suffix", Suffix::class], ["ucwords", Ucwords::class], ["uncamelize", Uncamelize::class], diff --git a/tests/unit/Translate/Adapter/Csv/ConstructCest.php b/tests/unit/Translate/Adapter/Csv/ConstructCest.php index 4dc44bb1524..3980b7cbb5b 100644 --- a/tests/unit/Translate/Adapter/Csv/ConstructCest.php +++ b/tests/unit/Translate/Adapter/Csv/ConstructCest.php @@ -73,7 +73,8 @@ function () { } /** - * Tests Phalcon\Translate\Adapter\Csv :: __construct() - Exception error loading file + * Tests Phalcon\Translate\Adapter\Csv :: __construct() - Exception error + * loading file * * @param UnitTester $I * diff --git a/tests/unit/Translate/Adapter/Csv/HasCest.php b/tests/unit/Translate/Adapter/Csv/HasCest.php index bb597c8d27f..7cf486ef494 100644 --- a/tests/unit/Translate/Adapter/Csv/HasCest.php +++ b/tests/unit/Translate/Adapter/Csv/HasCest.php @@ -42,8 +42,6 @@ public function translateAdapterCsvHas(UnitTester $I) $language = $this->getCsvConfig()['en']; $translator = new Csv(new InterpolatorFactory(), $language); - $actual = $translator->exists('hi'); - $I->assertTrue($actual); $actual = $translator->has('hi'); $I->assertTrue($actual); } diff --git a/tests/unit/Translate/Adapter/Gettext/HasCest.php b/tests/unit/Translate/Adapter/Gettext/HasCest.php index 3c8ac6c8070..98f9a02cff9 100644 --- a/tests/unit/Translate/Adapter/Gettext/HasCest.php +++ b/tests/unit/Translate/Adapter/Gettext/HasCest.php @@ -42,8 +42,6 @@ public function translateAdapterGettextHas(UnitTester $I) $params = $this->getGettextConfig(); $translator = new Gettext(new InterpolatorFactory(), $params); - $actual = $translator->exists('hi'); - $I->assertTrue($actual); $actual = $translator->has('hi'); $I->assertTrue($actual); } diff --git a/tests/unit/Translate/Adapter/Gettext/OffsetExistsCest.php b/tests/unit/Translate/Adapter/Gettext/OffsetExistsCest.php index 85c662e8c0e..e235acb0529 100644 --- a/tests/unit/Translate/Adapter/Gettext/OffsetExistsCest.php +++ b/tests/unit/Translate/Adapter/Gettext/OffsetExistsCest.php @@ -42,6 +42,6 @@ public function translateAdapterGettextOffsetExists(UnitTester $I) $params = $this->getGettextConfig(); $translator = new Gettext(new InterpolatorFactory(), $params); - $I->assertTrue($translator->exists('hi')); + $I->assertTrue($translator->has('hi')); } } diff --git a/tests/unit/Translate/Adapter/NativeArray/HasCest.php b/tests/unit/Translate/Adapter/NativeArray/HasCest.php index 51d0d007d2b..fd978842fa2 100644 --- a/tests/unit/Translate/Adapter/NativeArray/HasCest.php +++ b/tests/unit/Translate/Adapter/NativeArray/HasCest.php @@ -43,8 +43,6 @@ public function translateAdapterNativeArrayHas(UnitTester $I) ] ); - $expected = $translator->exists('hi'); - $I->assertTrue($expected); $expected = $translator->has('hi'); $I->assertTrue($expected); }