-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phpunit and Illuminate\Cache\ #48686
Comments
Hi there, Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels: However, this issue will not be locked and everyone is still free to discuss solutions to your problem! Thanks. |
I really believe that this is a bug in this commit: illuminate/cache@b44c094 |
One thing I forgot to mention: I use the Lumen Framework |
Laravel Version
10.0.1
PHP Version
8.1.10
Database Driver & Version
No response
Description
I got these errors in my log files when I run vendor/bin/phpunit. Http Requests are working fine.
Error(code: 0): Call to undefined function Illuminate\Cache\now() at /var/www/html/vendor/illuminate/cache/ArrayStore.php:60
Error(code: 0): Call to undefined function now() at /var/www/html/vendor/illuminate/cache/ArrayStore.php:191
When I change these lines to Illuminate\Cache v9 Code it works again.
Thanks :)
I think this Commit illuminate/cache@b44c094 broke it.
Steps To Reproduce
In my Controller is this Code:
...
if (Cache::has($cache_key)) {
return Cache::get($cache_key);
}
...
Cache::put($cache_key, $res, 10);
...
It works via Http Requests. But not with phpunit. When I run vendor/bin/phpunit it fails.
Logfile Contains:
2023-10-10 09:36:36] testing.ERROR: Call to undefined function now() {"exception":"[object] (Error(code: 0): Call to undefined function now() at /var/www/html/vendor/illuminate/cache/ArrayStore.php:191)
[stacktrace]
#0 /var/www/html/vendor/illuminate/cache/ArrayStore.php(180): Illuminate\Cache\ArrayStore->toTimestamp(10)
#1 /var/www/html/vendor/illuminate/cache/ArrayStore.php(81): Illuminate\Cache\ArrayStore->calculateExpiration(10)
#2 /var/www/html/vendor/illuminate/cache/Repository.php(217): Illuminate\Cache\ArrayStore->put('api 1pressrelea...', Object(Illuminate\Http\JsonResponse), 10)
#3 /var/www/html/vendor/illuminate/cache/CacheManager.php(429): Illuminate\Cache\Repository->put('api 1pressrelea...', Object(Illuminate\Http\JsonResponse), 10)
#4 /var/www/html/vendor/illuminate/support/Facades/Facade.php(353): Illuminate\Cache\CacheManager->__call('put', Array)
#5 /var/www/html/app/Http/Controllers/ServicesApi.php(361): Illuminate\Support\Facades\Facade::__callStatic('put', Array)
#6 /var/www/html/vendor/illuminate/container/BoundMethod.php(36): App\Http\Controllers\ServicesApi->getPressReleases(Object(Laravel\Lumen\Http\Request))
#7 /var/www/html/vendor/illuminate/container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#8 /var/www/html/vendor/illuminate/container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#9 /var/www/html/vendor/illuminate/container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Laravel\Lumen\Application), Array, Object(Closure))
#10 /var/www/html/vendor/illuminate/container/Container.php(662): Illuminate\Container\BoundMethod::call(Object(Laravel\Lumen\Application), Array, Array, NULL)
#11 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(391): Illuminate\Container\Container->call(Array, Array)
#12 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(357): Laravel\Lumen\Application->callControllerCallable(Array, Array)
#13 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(331): Laravel\Lumen\Application->callLumenController(Object(App\Http\Controllers\ServicesApi), 'getPressRelease...', Array)
#14 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(284): Laravel\Lumen\Application->callControllerAction(Array)
#15 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(264): Laravel\Lumen\Application->callActionOnArrayBasedRoute(Array)
#16 /var/www/html/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(48): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}(Object(Laravel\Lumen\Http\Request))
#17 /var/www/html/app/Http/Middleware/Authenticate.php(47): Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}(Object(Laravel\Lumen\Http\Request))
#18 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(180): App\Http\Middleware\Authenticate->handle(Object(Laravel\Lumen\Http\Request), Object(Closure))
#19 /var/www/html/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(30): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Laravel\Lumen\Http\Request))
#20 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(116): Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}(Object(Laravel\Lumen\Http\Request))
#21 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(428): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#22 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(265): Laravel\Lumen\Application->sendThroughPipeline(Array, Object(Closure))
#23 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(171): Laravel\Lumen\Application->handleFoundRoute(Array)
#24 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(431): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}(Object(Laravel\Lumen\Http\Request))
#25 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(177): Laravel\Lumen\Application->sendThroughPipeline(Array, Object(Closure))
#26 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(95): Laravel\Lumen\Application->dispatch(Object(Laravel\Lumen\Http\Request))
#27 /var/www/html/vendor/laravel/lumen-framework/src/Testing/Concerns/MakesHttpRequests.php(361): Laravel\Lumen\Application->handle(Object(Laravel\Lumen\Http\Request))
#28 /var/www/html/vendor/laravel/lumen-framework/src/Testing/Concerns/MakesHttpRequests.php(66): Laravel\Lumen\Testing\TestCase->call('GET', '/1.0/pressrelea...', Array, Array, Array, Array)
#29 /var/www/html/tests/PressReleasesTest.php(13): Laravel\Lumen\Testing\TestCase->get('/1.0/pressrelea...')
#30 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php(1114): PressReleasesTest->testPressReleases()
#31 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php(653): PHPUnit\Framework\TestCase->runTest()
#32 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestRunner.php(103): PHPUnit\Framework\TestCase->runBare()
#33 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php(489): PHPUnit\Framework\TestRunner->run(Object(PressReleasesTest))
#34 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php(340): PHPUnit\Framework\TestCase->run()
#35 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php(340): PHPUnit\Framework\TestSuite->run()
#36 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php(340): PHPUnit\Framework\TestSuite->run()
#37 /var/www/html/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(63): PHPUnit\Framework\TestSuite->run()
#38 /var/www/html/vendor/phpunit/phpunit/src/TextUI/Application.php(190): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\Runner\ResultCache\DefaultResultCache), Object(PHPUnit\Framework\TestSuite))
#39 /var/www/html/vendor/phpunit/phpunit/phpunit(99): PHPUnit\TextUI\Application->run(Array)
#40 /var/www/html/vendor/bin/phpunit(122): include('/var/www/html/v...')
#41 {main}
"}
[2023-10-10 09:40:08] testing.ERROR: Call to undefined function Illuminate\Cache\now() {"exception":"[object] (Error(code: 0): Call to undefined function Illuminate\Cache\now() at /var/www/html/vendor/illuminate/cache/ArrayStore.php:60)
[stacktrace]
#0 /var/www/html/vendor/illuminate/cache/Repository.php(99): Illuminate\Cache\ArrayStore->get('api 1pressrelea...')
#1 /var/www/html/vendor/illuminate/cache/Repository.php(70): Illuminate\Cache\Repository->get('api 1pressrelea...')
#2 /var/www/html/vendor/illuminate/cache/CacheManager.php(429): Illuminate\Cache\Repository->has('api 1pressrelea...')
#3 /var/www/html/vendor/illuminate/support/Facades/Facade.php(353): Illuminate\Cache\CacheManager->__call('has', Array)
#4 /var/www/html/app/Http/Controllers/ServicesApi.php(344): Illuminate\Support\Facades\Facade::__callStatic('has', Array)
#5 /var/www/html/vendor/illuminate/container/BoundMethod.php(36): App\Http\Controllers\ServicesApi->getPressReleases(Object(Laravel\Lumen\Http\Request))
#6 /var/www/html/vendor/illuminate/container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#7 /var/www/html/vendor/illuminate/container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#8 /var/www/html/vendor/illuminate/container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Laravel\Lumen\Application), Array, Object(Closure))
#9 /var/www/html/vendor/illuminate/container/Container.php(662): Illuminate\Container\BoundMethod::call(Object(Laravel\Lumen\Application), Array, Array, NULL)
#10 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(391): Illuminate\Container\Container->call(Array, Array)
#11 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(357): Laravel\Lumen\Application->callControllerCallable(Array, Array)
#12 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(331): Laravel\Lumen\Application->callLumenController(Object(App\Http\Controllers\ServicesApi), 'getPressRelease...', Array)
#13 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(284): Laravel\Lumen\Application->callControllerAction(Array)
#14 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(264): Laravel\Lumen\Application->callActionOnArrayBasedRoute(Array)
#15 /var/www/html/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(48): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}(Object(Laravel\Lumen\Http\Request))
#16 /var/www/html/app/Http/Middleware/Authenticate.php(47): Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}(Object(Laravel\Lumen\Http\Request))
#17 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(180): App\Http\Middleware\Authenticate->handle(Object(Laravel\Lumen\Http\Request), Object(Closure))
#18 /var/www/html/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(30): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Laravel\Lumen\Http\Request))
#19 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(116): Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}(Object(Laravel\Lumen\Http\Request))
#20 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(428): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#21 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(265): Laravel\Lumen\Application->sendThroughPipeline(Array, Object(Closure))
#22 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(171): Laravel\Lumen\Application->handleFoundRoute(Array)
#23 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(431): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}(Object(Laravel\Lumen\Http\Request))
#24 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(177): Laravel\Lumen\Application->sendThroughPipeline(Array, Object(Closure))
#25 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(95): Laravel\Lumen\Application->dispatch(Object(Laravel\Lumen\Http\Request))
#26 /var/www/html/vendor/laravel/lumen-framework/src/Testing/Concerns/MakesHttpRequests.php(361): Laravel\Lumen\Application->handle(Object(Laravel\Lumen\Http\Request))
#27 /var/www/html/vendor/laravel/lumen-framework/src/Testing/Concerns/MakesHttpRequests.php(66): Laravel\Lumen\Testing\TestCase->call('GET', '/1.0/pressrelea...', Array, Array, Array, Array)
#28 /var/www/html/tests/PressReleasesTest.php(30): Laravel\Lumen\Testing\TestCase->get('/1.0/pressrelea...')
#29 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php(1114): PressReleasesTest->testPressReleaseDateFilter()
#30 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php(653): PHPUnit\Framework\TestCase->runTest()
#31 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestRunner.php(103): PHPUnit\Framework\TestCase->runBare()
#32 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php(489): PHPUnit\Framework\TestRunner->run(Object(PressReleasesTest))
#33 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php(340): PHPUnit\Framework\TestCase->run()
#34 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php(340): PHPUnit\Framework\TestSuite->run()
#35 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php(340): PHPUnit\Framework\TestSuite->run()
#36 /var/www/html/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(63): PHPUnit\Framework\TestSuite->run()
#37 /var/www/html/vendor/phpunit/phpunit/src/TextUI/Application.php(190): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\Runner\ResultCache\DefaultResultCache), Object(PHPUnit\Framework\TestSuite))
#38 /var/www/html/vendor/phpunit/phpunit/phpunit(99): PHPUnit\TextUI\Application->run(Array)
#39 /var/www/html/vendor/bin/phpunit(122): include('/var/www/html/v...')
#40 {main}
"}
The text was updated successfully, but these errors were encountered: