tp6混合easyswoole DLL 多应用模式 修改版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1020 B

5 years ago
  1. <?php
  2. use League\Flysystem\Cached\Storage\Memcached;
  3. use PHPUnit\Framework\TestCase;
  4. class MemcachedTests extends TestCase
  5. {
  6. public function testLoadFail()
  7. {
  8. $client = Mockery::mock('Memcached');
  9. $client->shouldReceive('get')->once()->andReturn(false);
  10. $cache = new Memcached($client);
  11. $cache->load();
  12. $this->assertFalse($cache->isComplete('', false));
  13. }
  14. public function testLoadSuccess()
  15. {
  16. $response = json_encode([[], ['' => true]]);
  17. $client = Mockery::mock('Memcached');
  18. $client->shouldReceive('get')->once()->andReturn($response);
  19. $cache = new Memcached($client);
  20. $cache->load();
  21. $this->assertTrue($cache->isComplete('', false));
  22. }
  23. public function testSave()
  24. {
  25. $response = json_encode([[], []]);
  26. $client = Mockery::mock('Memcached');
  27. $client->shouldReceive('set')->once()->andReturn($response);
  28. $cache = new Memcached($client);
  29. $cache->save();
  30. }
  31. }