Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / symfony / var-dumper / Tests / Caster / RedisCasterTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\VarDumper\Tests\Caster;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
16
17 /**
18  * @author Nicolas Grekas <p@tchwork.com>
19  * @requires extension redis
20  */
21 class RedisCasterTest extends TestCase
22 {
23     use VarDumperTestTrait;
24
25     public function testNotConnected()
26     {
27         $redis = new \Redis();
28
29         if (\defined('HHVM_VERSION_ID')) {
30             $xCast = <<<'EODUMP'
31 Redis {
32   #host: ""
33 %A
34 }
35 EODUMP;
36         } else {
37             $xCast = <<<'EODUMP'
38 Redis {
39   isConnected: false
40 }
41 EODUMP;
42         }
43
44         $this->assertDumpMatchesFormat($xCast, $redis);
45     }
46
47     public function testConnected()
48     {
49         $redis = new \Redis();
50         if (!@$redis->connect('127.0.0.1')) {
51             $e = error_get_last();
52             self::markTestSkipped($e['message']);
53         }
54
55         if (\defined('HHVM_VERSION_ID')) {
56             $xCast = <<<'EODUMP'
57 Redis {
58   #host: "127.0.0.1"
59 %A
60 }
61 EODUMP;
62         } else {
63             $xCast = <<<'EODUMP'
64 Redis {%A
65   isConnected: true
66   host: "127.0.0.1"
67   port: 6379
68   auth: null
69   dbNum: 0
70   timeout: 0.0
71   persistentId: null
72   options: {
73     READ_TIMEOUT: 0.0
74     SERIALIZER: NONE
75     PREFIX: null
76     SCAN: NORETRY
77   }
78 }
79 EODUMP;
80         }
81
82         $this->assertDumpMatchesFormat($xCast, $redis);
83     }
84 }