ExampleTest.php 556 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace Tests\Unit;
  3. use PHPUnit\Framework\TestCase;
  4. use Redis;
  5. class ExampleTest extends TestCase {
  6. /**
  7. * A basic test example.
  8. *
  9. * @return void
  10. */
  11. public function testBasicTest() {
  12. try{
  13. //create redis instance
  14. $redis = new Redis();
  15. //connect with server and port
  16. $redis->connect('localhost', 6379);
  17. //set value
  18. $redis->set('website', 'www.phpflow.com');
  19. //get value
  20. $website = $redis->get('website');
  21. //print www.phpflow.com
  22. echo $website;
  23. }catch(Exception $ex){
  24. echo $ex->getMessage();
  25. }
  26. }
  27. }