comparison vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 129ea1e6d783
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
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 }