Psr6InterfaceImplements.test.php 1.1 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * @author Khoa Bui (khoaofgod) <khoaofgod@gmail.com> http://www.phpfastcache.com
  4. * @author Georges.L (Geolim4) <contact@geolim4.com>
  5. */
  6. use phpFastCache\CacheManager;
  7. use phpFastCache\Helper\TestHelper;
  8. use Psr\Cache\CacheItemPoolInterface;
  9. chdir(__DIR__);
  10. require_once __DIR__ . '/../vendor/autoload.php';
  11. $testHelper = new TestHelper('PSR6 Interface Implements');
  12. $defaultDriver = (!empty($argv[1]) ? ucfirst($argv[1]) : 'Files');
  13. /**
  14. * Testing memcached as it is declared in .travis.yml
  15. */
  16. $driverInstance = CacheManager::getInstance($defaultDriver);
  17. if (!is_object($driverInstance)) {
  18. $testHelper->printFailText('CacheManager::getInstance() returned an invalid variable type:' . gettype($driverInstance));
  19. }else if(!($driverInstance instanceof CacheItemPoolInterface)){
  20. $testHelper->printFailText('CacheManager::getInstance() returned an invalid class:' . get_class($driverInstance));
  21. }else{
  22. $testHelper->printPassText('CacheManager::getInstance() returned a valid CacheItemPoolInterface object: ' . get_class($driverInstance));
  23. }
  24. $testHelper->terminateTest();