MemcachedIntegrationTestCase.php 730 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Illuminate\Tests\Integration\Cache;
  3. use Memcached;
  4. use Orchestra\Testbench\TestCase;
  5. abstract class MemcachedIntegrationTestCase extends TestCase
  6. {
  7. protected function setUp(): void
  8. {
  9. parent::setUp();
  10. // Determine whether there is a running Memcached instance
  11. $testConnection = new Memcached;
  12. $testConnection->addServer(
  13. env('MEMCACHED_HOST', '127.0.0.1'),
  14. env('MEMCACHED_PORT', 11211)
  15. );
  16. $testConnection->getVersion();
  17. if ($testConnection->getResultCode() > Memcached::RES_SUCCESS) {
  18. $this->markTestSkipped('Memcached could not establish a connection.');
  19. }
  20. $testConnection->quit();
  21. }
  22. }