Passed
Push — master ( 383493...d29574 )
by Chito
02:01
created

TestCase::assertSqlEquals()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 2
c 1
b 1
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Lampager\Cake\Test\TestCase;
4
5
use Cake\TestSuite\TestCase as BaseTestCase;
6
use NilPortugues\Sql\QueryFormatter\Formatter;
7
8
abstract class TestCase extends BaseTestCase
9
{
10
    /**
11
     * Asserts that two given JSON encoded objects or arrays are equal.
12
     *
13
     * @param  mixed                                                        $expected
14
     * @param  mixed                                                        $actual
15
     * @param  string                                                       $message
16
     * @return void
17
     * @throws \PHPUnit\Framework\ExpectationFailedException
18
     * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
19
     */
20
    public function assertJsonEquals($expected, $actual, $message = '')
21
    {
22
        $this->assertJsonStringEqualsJsonString(json_encode($expected), json_encode($actual), $message);
23
    }
24
25
    /**
26
     * Asserts that two given SQL query statements are equal.
27
     *
28
     * @param  string $expected
29
     * @param  string $actual
30
     * @param  string $message
31
     * @return void
32
     */
33
    public function assertSqlEquals($expected, $actual, $message = '')
34
    {
35
        $formatter = new Formatter();
36
        $this->assertSame($formatter->format($expected), $formatter->format($actual), $message);
37
    }
38
}
39