Level 2
For anyone ending up here... It turned out that I auto-included PHPUnit\Framework\TestCase instead of Tests\TestCase... 🤯
6 likes
Summer Sale! All accounts are 50% off this week.
I'm doing a feature test on a function that uses the Cache facade.
public static function getMainCategories()
{
$cacheKey = self::CATEGORY_CACHE_KEY . '_main';
$fromCache = Cache::get($cacheKey, false);
if ($fromCache) {
dd('Cache');
} else {
dd('No cache');
}
}
When running the function all works fine, but running it from a tests results in:
public function testItGetsTheMainCategoryPages()
{
$data = MyClass::getMainCategories();
$this->assertNotEmpty($data);
}
Hopefully someone can point me in the right direction, since Googling didn't bring me much unfortunately
Please or to participate in this conversation.