Assert::assertXmlStringNotEqualsXmlString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PHPKitchen\CodeSpecsCore\Expectation\Internal;
4
5
use ArrayAccess;
6
use Codeception\TestInterface;
0 ignored issues
show
Bug introduced by
The type Codeception\TestInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use PHPKitchen\CodeSpecsCore\Module\CodeSpecs;
0 ignored issues
show
Bug introduced by
The type PHPKitchen\CodeSpecsCore\Module\CodeSpecs was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use PHPUnit\Framework\Test;
9
10
/**
11
 * Represents PHPUnit Assert facade.
12
 *
13
 * Goal of this class is prepare assert messages according
14
 *
15
 * @codeCoverageIgnore
16
 *
17
 * @package PHPKitchen\CodeSpecsCore\Expectation\Internal
18
 * @author Dmitry Kolodko <[email protected]>
19
 */
20
class Assert {
21
    const IN_TIME_EXECUTION_STRATEGY = 1;
22
    const DELAYED_EXECUTION_STRATEGY = 2;
23
    /**
24
     * @var mixed actual value or variable that will be matched to expectations.
25
     */
26
    protected $actual;
27
    /**
28
     * @var StepsList list of steps that was made prior current assert.
29
     */
30
    protected $stepsList;
31
    /**
32
     * @var Test the test object.
33
     */
34
    protected $test;
35
    /**
36
     * @var string description of expectation. If expectation fails this description will be displayed in console.
37
     */
38
    protected $description;
39
    /**
40
     * @var \SplQueue list of steps that was delayed to be executed after definition.
41
     */
42
    protected $delayedAssertSteps;
43
    /**
44
     * @var int execution strategy. Either {@link DELAYED_EXECUTION_STRATEGY} or {@link IN_TIME_EXECUTION_STRATEGY}.
45
     * Identifies whether to run assert methods when they called or later(runtime matchers functionality)
46
     */
47
    protected $strategy;
48
    /**
49
     * @var string internal value that identifies current step name that would be added to {@link stepsList}
50
     */
51
    private $currentStepName = '';
52
53
    public function __construct(StepsList $stepsList, Test $test, $actual, $description = '', $strategy = self::IN_TIME_EXECUTION_STRATEGY) {
54
        $this->stepsList = $stepsList;
55
        $this->test = $test;
56
        $this->actual = $actual;
57
        $this->description = $description;
58
        $this->delayedAssertSteps = new \SplQueue();
59
        $this->strategy = $strategy;
60
    }
61
62
    public function __clone() {
63
        $this->delayedAssertSteps = clone $this->delayedAssertSteps;
64
    }
65
66
    //region --------------------------- OWN METHODS ----------------------------//
67
68
    public function getActualValue() {
69
        return $this->actual;
70
    }
71
72
    public function changeDescriptionTo($newDescription) {
73
        $this->description = $newDescription;
74
    }
75
76
    public function changeCurrentStepTo($stepName) {
77
        $this->currentStepName = $stepName;
78
    }
79
80
    public function switchToInTimeExecutionStrategy() {
81
        $this->strategy = self::IN_TIME_EXECUTION_STRATEGY;
82
    }
83
84
    public function switchToDelayedExecutionStrategy() {
85
        $this->strategy = self::DELAYED_EXECUTION_STRATEGY;
86
    }
87
88
    public function runStepsWithActualValue($actualValue) {
89
        if ($this->strategy === self::DELAYED_EXECUTION_STRATEGY) {
90
            return;
91
        }
92
        $this->actual = $actualValue;
93
        while (!$this->delayedAssertSteps->isEmpty()) {
94
            $step = $this->delayedAssertSteps->dequeue();
95
            array_push($step[1], $this->getMessageForAssert());
96
            array_unshift($step[1], $this->actual);
97
            $this->executeAssertMethod($step[0], $step[1], $step[2]);
98
        }
99
    }
100
101
    protected function callAssertMethod($method, $config = []) {
102
        $stepName = $this->currentStepName;
103
        if ($this->strategy === self::IN_TIME_EXECUTION_STRATEGY) {
104
            $this->executeAssertMethod($method, $config, $stepName);
105
        } else {
106
            $this->delayedAssertSteps->enqueue([$method, $config, $stepName]);
107
        }
108
    }
109
110
    protected function executeAssertMethod($method, $config, $stepName) {
111
        $this->registerExpectation($stepName);
112
        if (is_callable([$this->test, $method])) {
113
            call_user_func_array([$this->test, $method], $this->buildAssertMethodParamsFromConfig($config));
114
        } elseif (method_exists($this, $method)) {
115
            call_user_func_array([$this, $method], $this->buildAssertMethodParamsFromConfig($config));
116
        } else {
117
            throw new \InvalidArgumentException("Assert method '{$method}' does not exist");
118
        }
119
    }
120
121
    protected function buildAssertMethodParamsFromConfig($config) {
122
        $params = [];
123
        if (array_key_exists('expected', $config)) {
124
            $params[] = $config['expected'];
125
        }
126
        $params[] = $this->actual;
127
        if (isset($config['options'])) {
128
            $params = array_merge($params, $config['options']);
129
        }
130
131
        $params[] = $this->getMessageForAssert();
132
133
        if (isset($config['additionalParams'])) {
134
            $params = array_merge($params, $config['additionalParams']);
135
        }
136
137
        return $params;
138
    }
139
140
    protected function registerExpectation($message) {
141
        $this->stepsList->add("$this->description {$message}.");
142
    }
143
144
    protected function getMessageForAssert() {
145
        return $this->stepsList->convertToString();
146
    }
147
148
    //endregion
149
150
    /**
151
     * @param string $exception
152
     */
153
    public function expectException($exception) {
154
        $this->callAssertMethod(__FUNCTION__, [
155
            'expected' => $exception,
156
        ]);
157
    }
158
159
    /**
160
     * @param int|string $code
161
     *
162
     * @throws \Exception
163
     */
164
    public function expectExceptionCode($code) {
165
        $this->callAssertMethod(__FUNCTION__, [
166
            'expected' => $code,
167
        ]);
168
    }
169
170
    /**
171
     * @param string $message
172
     *
173
     * @throws \Exception
174
     */
175
    public function expectExceptionMessage($message) {
176
        $this->callAssertMethod(__FUNCTION__, [
177
            'expected' => $message,
178
        ]);
179
    }
180
181
    /**
182
     * @param string $messageRegExp
183
     *
184
     * @throws \Exception
185
     */
186
    public function expectExceptionMessageRegExp($messageRegExp) {
187
        $this->callAssertMethod(__FUNCTION__, [
188
            'expected' => $messageRegExp,
189
        ]);
190
    }
191
192
    /**
193
     * Asserts that an array has a specified key.
194
     *
195
     * @param mixed $key
196
     */
197
    public function assertArrayHasKey($key) {
198
        $this->callAssertMethod(__FUNCTION__, [
199
            'expected' => $key,
200
        ]);
201
    }
202
203
    /**
204
     * Asserts that an array has a specified subset.
205
     *
206
     * @param array|ArrayAccess $subset
207
     */
208
    public function assertArraySubset($subset, $useStrictMatch) {
209
        $this->callAssertMethod(__FUNCTION__, [
210
            'expected' => $subset,
211
            'options' => [
212
                $useStrictMatch,
213
            ],
214
        ]);
215
    }
216
217
    /**
218
     * Asserts that an array does not have a specified key.
219
     *
220
     * @param mixed $key
221
     * @param array|ArrayAccess $array
222
     * @param string $message
223
     */
224
    public function assertArrayNotHasKey($key) {
225
        $this->callAssertMethod(__FUNCTION__, [
226
            'expected' => $key,
227
        ]);
228
    }
229
230
    /**
231
     * Asserts that a haystack contains a needle.
232
     *
233
     * @param mixed $needle
234
     * @param bool $ignoreCase
235
     * @param bool $checkForObjectIdentity
236
     * @param bool $checkForNonObjectIdentity
237
     */
238 View Code Duplication
    public function assertContains($needle, $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
239
        $this->callAssertMethod(__FUNCTION__, [
240
            'expected' => $needle,
241
            'additionalParams' => [
242
                $ignoreCase,
243
                $checkForObjectIdentity,
244
                $checkForNonObjectIdentity,
245
            ],
246
        ]);
247
    }
248
249
    /**
250
     * Asserts that a haystack does not contain a needle.
251
     *
252
     * @param mixed $needle
253
     * @param bool $ignoreCase
254
     * @param bool $checkForObjectIdentity
255
     * @param bool $checkForNonObjectIdentity
256
     */
257 View Code Duplication
    public function assertNotContains($needle, $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
258
        $this->callAssertMethod(__FUNCTION__, [
259
            'expected' => $needle,
260
            'additionalParams' => [
261
                $ignoreCase,
262
                $checkForObjectIdentity,
263
                $checkForNonObjectIdentity,
264
            ],
265
        ]);
266
    }
267
268
    /**
269
     * Asserts that a haystack contains only values of a given type.
270
     *
271
     * @param string $type
272
     * @param bool $isNativeType
273
     */
274
    public function assertContainsOnly($type, $isNativeType = null) {
275
        $this->callAssertMethod(__FUNCTION__, [
276
            'expected' => $type,
277
            'options' => [
278
                $isNativeType,
279
            ],
280
        ]);
281
    }
282
283
    /**
284
     * Asserts that a haystack does not contain only values of a given type.
285
     *
286
     * @param string $type
287
     * @param bool $isNativeType
288
     */
289
    public function assertNotContainsOnly($type, $isNativeType = null) {
290
        $this->callAssertMethod(__FUNCTION__, [
291
            'expected' => $type,
292
            'options' => [
293
                $isNativeType,
294
            ],
295
        ]);
296
    }
297
298
    /**
299
     * Asserts that a haystack that is stored in a static attribute of a class
300
     * or an attribute of an object contains a needle.
301
     *
302
     * @param mixed $needle
303
     * @param string $haystackAttributeName
304
     * @param string|object $haystackClassOrObject
305
     * @param string $message
306
     * @param bool $ignoreCase
307
     * @param bool $checkForObjectIdentity
308
     * @param bool $checkForNonObjectIdentity
309
     */
310
    public function assertAttributeContains($needle, $haystackAttributeName, $haystackClassOrObject, $message = '', $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false) {
311
        $this->callAssertMethod(__FUNCTION__, [
312
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
313
        ]);
314
    }
315
316
    /**
317
     * Asserts that a haystack that is stored in a static attribute of a class
318
     * or an attribute of an object does not contain a needle.
319
     *
320
     * @param mixed $needle
321
     * @param string $haystackAttributeName
322
     * @param string|object $haystackClassOrObject
323
     * @param string $message
324
     * @param bool $ignoreCase
325
     * @param bool $checkForObjectIdentity
326
     * @param bool $checkForNonObjectIdentity
327
     */
328
    public function assertAttributeNotContains($needle, $haystackAttributeName, $haystackClassOrObject, $message = '', $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false) {
329
        $this->callAssertMethod(__FUNCTION__, [
330
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
331
        ]);
332
    }
333
334
    /**
335
     * Asserts that a haystack contains only instances of a given classname
336
     *
337
     * @param string $className
338
     */
339
    public function assertContainsOnlyInstancesOf($className) {
340
        $this->callAssertMethod(__FUNCTION__, [
341
            'expected' => $className,
342
        ]);
343
    }
344
345
    /**
346
     * Asserts that a haystack that is stored in a static attribute of a class
347
     * or an attribute of an object contains only values of a given type.
348
     *
349
     * @param string $type
350
     * @param string $haystackAttributeName
351
     * @param string|object $haystackClassOrObject
352
     * @param bool $isNativeType
353
     * @param string $message
354
     */
355
    public function assertAttributeContainsOnly($type, $haystackAttributeName, $haystackClassOrObject, $isNativeType = null) {
356
        $this->callAssertMethod(__FUNCTION__, [
357
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
358
        ]);
359
    }
360
361
    /**
362
     * Asserts that a haystack that is stored in a static attribute of a class
363
     * or an attribute of an object does not contain only values of a given
364
     * type.
365
     *
366
     * @param string $type
367
     * @param string $haystackAttributeName
368
     * @param string|object $haystackClassOrObject
369
     * @param bool $isNativeType
370
     * @param string $message
371
     */
372
    public function assertAttributeNotContainsOnly($type, $haystackAttributeName, $haystackClassOrObject, $isNativeType = null) {
373
        $this->callAssertMethod(__FUNCTION__, [
374
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
375
        ]);
376
    }
377
378
    /**
379
     * Asserts the number of elements of an array, \Countable or \Traversable.
380
     *
381
     * @param int $expectedCount
382
     */
383
    public function assertCount($expectedCount) {
384
        $this->callAssertMethod(__FUNCTION__, [
385
            'expected' => $expectedCount,
386
        ]);
387
    }
388
389
    /**
390
     * Asserts the number of elements of an array, \Countable or \Traversable
391
     * that is stored in an attribute.
392
     *
393
     * @param int $expectedCount
394
     * @param string $haystackAttributeName
395
     * @param string|object $haystackClassOrObject
396
     * @param string $message
397
     */
398
    public function assertAttributeCount($expectedCount, $haystackAttributeName, $haystackClassOrObject) {
399
        $this->callAssertMethod(__FUNCTION__, [
400
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
401
        ]);
402
    }
403
404
    /**
405
     * Asserts the number of elements of an array, \Countable or \Traversable.
406
     *
407
     * @param int $expectedCount
408
     * @param mixed $haystack
409
     * @param string $message
410
     */
411
    public function assertNotCount($expectedCount) {
412
        $this->callAssertMethod(__FUNCTION__, [
413
            'expected' => $expectedCount,
414
        ]);
415
    }
416
417
    /**
418
     * Asserts the number of elements of an array, \Countable or \Traversable
419
     * that is stored in an attribute.
420
     *
421
     * @param int $expectedCount
422
     * @param string $haystackAttributeName
423
     * @param string|object $haystackClassOrObject
424
     * @param string $message
425
     */
426
    public function assertAttributeNotCount($expectedCount, $haystackAttributeName, $haystackClassOrObject) {
427
        $this->callAssertMethod(__FUNCTION__, [
428
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
429
        ]);
430
    }
431
432
    /**
433
     * Asserts that two variables are equal.
434
     *
435
     * @param mixed $expected
436
     * @param float $delta
437
     * @param int $maxDepth
438
     * @param bool $canonicalize
439
     * @param bool $ignoreCase
440
     */
441 View Code Duplication
    public function assertEquals($expected, $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
442
        $this->callAssertMethod(__FUNCTION__, [
443
            'expected' => $expected,
444
            'additionalParams' => [
445
                $delta,
446
                $maxDepth,
447
                $canonicalize,
448
                $ignoreCase,
449
            ],
450
        ]);
451
    }
452
453
    /**
454
     * Asserts that a variable is equal to an attribute of an object.
455
     *
456
     * @param mixed $expected
457
     * @param string $actualAttributeName
458
     * @param string|object $actualClassOrObject
459
     * @param string $message
460
     * @param float $delta
461
     * @param int $maxDepth
462
     * @param bool $canonicalize
463
     * @param bool $ignoreCase
464
     */
465
    public function assertAttributeEquals($expected, $actualAttributeName, $actualClassOrObject, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) {
466
        $this->callAssertMethod(__FUNCTION__, [
467
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
468
        ]);
469
    }
470
471
    /**
472
     * Asserts that two variables are not equal.
473
     *
474
     * @param mixed $expected
475
     * @param float $delta
476
     * @param int $maxDepth
477
     * @param bool $canonicalize
478
     * @param bool $ignoreCase
479
     */
480 View Code Duplication
    public function assertNotEquals($expected, $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
481
        $this->callAssertMethod(__FUNCTION__, [
482
            'expected' => $expected,
483
            'additionalParams' => [
484
                $delta,
485
                $maxDepth,
486
                $canonicalize,
487
                $ignoreCase,
488
            ],
489
        ]);
490
    }
491
492
    /**
493
     * Asserts that a variable is not equal to an attribute of an object.
494
     *
495
     * @param mixed $expected
496
     * @param string $actualAttributeName
497
     * @param string|object $actualClassOrObject
498
     * @param string $message
499
     * @param float $delta
500
     * @param int $maxDepth
501
     * @param bool $canonicalize
502
     * @param bool $ignoreCase
503
     */
504
    public function assertAttributeNotEquals($expected, $actualAttributeName, $actualClassOrObject, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) {
505
        $this->callAssertMethod(__FUNCTION__, [
506
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
507
        ]);
508
    }
509
510
    /**
511
     * Asserts that a variable is empty.
512
     *
513
     *
514
     * @throws AssertionFailedError
515
     */
516
    public function assertEmpty() {
517
        $this->callAssertMethod(__FUNCTION__);
518
    }
519
520
    /**
521
     * Asserts that a static attribute of a class or an attribute of an object
522
     * is empty.
523
     *
524
     * @param string $haystackAttributeName
525
     * @param string|object $haystackClassOrObject
526
     * @param string $message
527
     */
528
    public function assertAttributeEmpty($haystackAttributeName, $haystackClassOrObject) {
529
        $this->callAssertMethod(__FUNCTION__, [
530
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
531
        ]);
532
    }
533
534
    /**
535
     * Asserts that a variable is not empty.
536
     *
537
     * @param mixed $actual
538
     * @param string $message
539
     *
540
     * @throws AssertionFailedError
541
     */
542
    public function assertNotEmpty() {
543
        $this->callAssertMethod(__FUNCTION__, []);
544
    }
545
546
    /**
547
     * Asserts that a static attribute of a class or an attribute of an object
548
     * is not empty.
549
     *
550
     * @param string $haystackAttributeName
551
     * @param string|object $haystackClassOrObject
552
     * @param string $message
553
     */
554
    public function assertAttributeNotEmpty($haystackAttributeName, $haystackClassOrObject) {
555
        $this->callAssertMethod(__FUNCTION__, [
556
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
557
        ]);
558
    }
559
560
    /**
561
     * Asserts that a value is greater than another value.
562
     *
563
     * @param mixed $expected
564
     */
565
    public function assertGreaterThan($expected) {
566
        $this->callAssertMethod(__FUNCTION__, [
567
            'expected' => $expected,
568
        ]);
569
    }
570
571
    /**
572
     * Asserts that an attribute is greater than another value.
573
     *
574
     * @param mixed $expected
575
     * @param string $actualAttributeName
576
     * @param string|object $actualClassOrObject
577
     * @param string $message
578
     */
579
    public function assertAttributeGreaterThan($expected, $actualAttributeName, $actualClassOrObject) {
580
        $this->callAssertMethod(__FUNCTION__, [
581
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
582
        ]);
583
    }
584
585
    /**
586
     * Asserts that a value is greater than or equal to another value.
587
     *
588
     * @param mixed $expected
589
     */
590
    public function assertGreaterThanOrEqual($expected) {
591
        $this->callAssertMethod(__FUNCTION__, [
592
            'expected' => $expected,
593
        ]);
594
    }
595
596
    /**
597
     * Asserts that an attribute is greater than or equal to another value.
598
     *
599
     * @param mixed $expected
600
     * @param string $actualAttributeName
601
     * @param string|object $actualClassOrObject
602
     * @param string $message
603
     */
604
    public function assertAttributeGreaterThanOrEqual($expected, $actualAttributeName, $actualClassOrObject) {
605
        $this->callAssertMethod(__FUNCTION__, [
606
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
607
        ]);
608
    }
609
610
    /**
611
     * Asserts that a value is smaller than another value.
612
     *
613
     * @param mixed $expected
614
     */
615
    public function assertLessThan($expected) {
616
        $this->callAssertMethod(__FUNCTION__, [
617
            'expected' => $expected,
618
        ]);
619
    }
620
621
    /**
622
     * Asserts that an attribute is smaller than another value.
623
     *
624
     * @param mixed $expected
625
     * @param string $actualAttributeName
626
     * @param string|object $actualClassOrObject
627
     * @param string $message
628
     */
629
    public function assertAttributeLessThan($expected, $actualAttributeName, $actualClassOrObject) {
630
        $this->callAssertMethod(__FUNCTION__, [
631
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
632
        ]);
633
    }
634
635
    /**
636
     * Asserts that a value is smaller than or equal to another value.
637
     *
638
     * @param mixed $expected
639
     */
640
    public function assertLessThanOrEqual($expected) {
641
        $this->callAssertMethod(__FUNCTION__, [
642
            'expected' => $expected,
643
        ]);
644
    }
645
646
    /**
647
     * Asserts that an attribute is smaller than or equal to another value.
648
     *
649
     * @param mixed $expected
650
     * @param string $actualAttributeName
651
     * @param string|object $actualClassOrObject
652
     * @param string $message
653
     */
654
    public function assertAttributeLessThanOrEqual($expected, $actualAttributeName, $actualClassOrObject) {
655
        $this->callAssertMethod(__FUNCTION__, [
656
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
657
        ]);
658
    }
659
660
    /**
661
     * Asserts that the contents of one file is equal to the contents of another
662
     * file.
663
     *
664
     * @param string $expected
665
     * @param bool $canonicalize
666
     * @param bool $ignoreCase
667
     */
668 View Code Duplication
    public function assertFileEquals($expected, $canonicalize = false, $ignoreCase = false) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
669
        $this->callAssertMethod(__FUNCTION__, [
670
            'expected' => $expected,
671
            'additionalParams' => [
672
                $canonicalize,
673
                $ignoreCase,
674
            ],
675
        ]);
676
    }
677
678
    /**
679
     * Asserts that the contents of one file is not equal to the contents of
680
     * another file.
681
     *
682
     * @param string $expected
683
     * @param bool $canonicalize
684
     * @param bool $ignoreCase
685
     */
686 View Code Duplication
    public function assertFileNotEquals($expected, $canonicalize = false, $ignoreCase = false) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
687
        $this->callAssertMethod(__FUNCTION__, [
688
            'expected' => $expected,
689
            'additionalParams' => [
690
                $canonicalize,
691
                $ignoreCase,
692
            ],
693
        ]);
694
    }
695
696
    /**
697
     * Asserts that the contents of a string is equal
698
     * to the contents of a file.
699
     *
700
     * @param string $expectedFile
701
     * @param bool $canonicalize
702
     * @param bool $ignoreCase
703
     */
704 View Code Duplication
    public function assertStringEqualsFile($expectedFile, $canonicalize = false, $ignoreCase = false) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
705
        $this->callAssertMethod(__FUNCTION__, [
706
            'expected' => $expectedFile,
707
            'additionalParams' => [
708
                $canonicalize,
709
                $ignoreCase,
710
            ],
711
        ]);
712
    }
713
714
    /**
715
     * Asserts that the contents of a string is not equal
716
     * to the contents of a file.
717
     *
718
     * @param string $expectedFile
719
     * @param bool $canonicalize
720
     * @param bool $ignoreCase
721
     */
722 View Code Duplication
    public function assertStringNotEqualsFile($expectedFile, $canonicalize = false, $ignoreCase = false) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
723
        $this->callAssertMethod(__FUNCTION__, [
724
            'expected' => $expectedFile,
725
            'additionalParams' => [
726
                $canonicalize,
727
                $ignoreCase,
728
            ],
729
        ]);
730
    }
731
732
    /**
733
     * Asserts that a file/dir is readable.
734
     */
735
    public function assertIsReadable() {
736
        $this->callAssertMethod(__FUNCTION__);
737
    }
738
739
    /**
740
     * Asserts that a file/dir exists and is not readable.
741
     */
742
    public function assertNotIsReadable() {
743
        $this->callAssertMethod(__FUNCTION__);
744
    }
745
746
    /**
747
     * Asserts that a file/dir exists and is writable.
748
     */
749
    public function assertIsWritable() {
750
        $this->callAssertMethod(__FUNCTION__);
751
    }
752
753
    /**
754
     * Asserts that a file/dir exists and is not writable.
755
     */
756
    public function assertNotIsWritable() {
757
        $this->callAssertMethod(__FUNCTION__);
758
    }
759
760
    /**
761
     * Asserts that a directory exists.
762
     */
763
    public function assertDirectoryExists() {
764
        $this->callAssertMethod(__FUNCTION__);
765
    }
766
767
    /**
768
     * Asserts that a directory does not exist.
769
     */
770
    public function assertDirectoryNotExists() {
771
        $this->callAssertMethod(__FUNCTION__);
772
    }
773
774
    /**
775
     * Asserts that a directory exists and is readable.
776
     *
777
     * @param string $directory
778
     * @param string $message
779
     */
780
    public function assertDirectoryIsReadable($directory) {
781
        $this->callAssertMethod(__FUNCTION__, [
782
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
783
        ]);
784
    }
785
786
    /**
787
     * Asserts that a directory exists and is not readable.
788
     *
789
     * @param string $directory
790
     * @param string $message
791
     */
792
    public function assertDirectoryNotIsReadable($directory) {
793
        $this->callAssertMethod(__FUNCTION__, [
794
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
795
        ]);
796
    }
797
798
    /**
799
     * Asserts that a directory exists and is writable.
800
     *
801
     * @param string $directory
802
     * @param string $message
803
     */
804
    public function assertDirectoryIsWritable($directory) {
805
        $this->callAssertMethod(__FUNCTION__, [
806
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
807
        ]);
808
    }
809
810
    /**
811
     * Asserts that a directory exists and is not writable.
812
     *
813
     * @param string $directory
814
     * @param string $message
815
     */
816
    public function assertDirectoryNotIsWritable($directory) {
817
        $this->callAssertMethod(__FUNCTION__, [
818
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
819
        ]);
820
    }
821
822
    /**
823
     * Asserts that a file exists.
824
     */
825
    public function assertFileExists() {
826
        $this->callAssertMethod(__FUNCTION__);
827
    }
828
829
    /**
830
     * Asserts that a file does not exist.
831
     */
832
    public function assertFileNotExists() {
833
        $this->callAssertMethod(__FUNCTION__);
834
    }
835
836
    /**
837
     * Asserts that a file exists and is readable.
838
     *
839
     * @param string $file
840
     * @param string $message
841
     */
842
    public function assertFileIsReadable($file) {
843
        $this->callAssertMethod(__FUNCTION__, [
844
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
845
        ]);
846
    }
847
848
    /**
849
     * Asserts that a file exists and is not readable.
850
     *
851
     * @param string $file
852
     * @param string $message
853
     */
854
    public function assertFileNotIsReadable($file) {
855
        $this->callAssertMethod(__FUNCTION__, [
856
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
857
        ]);
858
    }
859
860
    /**
861
     * Asserts that a file exists and is writable.
862
     *
863
     * @param string $file
864
     * @param string $message
865
     */
866
    public function assertFileIsWritable($file) {
867
        $this->callAssertMethod(__FUNCTION__, [
868
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
869
        ]);
870
    }
871
872
    /**
873
     * Asserts that a file exists and is not writable.
874
     */
875
    public function assertFileNotIsWritable() {
876
        $this->callAssertMethod(__FUNCTION__);
877
    }
878
879
    /**
880
     * Asserts that a condition is true.
881
     *
882
     * @throws AssertionFailedError
883
     */
884
    public function assertTrue() {
885
        $this->callAssertMethod(__FUNCTION__);
886
    }
887
888
    /**
889
     * Asserts that a condition is not true.
890
     *
891
     * @throws AssertionFailedError
892
     */
893
    public function assertNotTrue() {
894
        $this->callAssertMethod(__FUNCTION__);
895
    }
896
897
    /**
898
     * Asserts that a condition is false.
899
     *
900
     * @throws AssertionFailedError
901
     */
902
    public function assertFalse() {
903
        $this->callAssertMethod(__FUNCTION__);
904
    }
905
906
    /**
907
     * Asserts that a condition is not false
908
     *
909
     * @throws AssertionFailedError
910
     */
911
    public function assertNotFalse() {
912
        $this->callAssertMethod(__FUNCTION__);
913
    }
914
915
    /**
916
     * Asserts that a variable is null.
917
     *
918
     * @param mixed $actual
919
     */
920
    public function assertNull() {
921
        $this->callAssertMethod(__FUNCTION__);
922
    }
923
924
    /**
925
     * Asserts that a variable is not null.
926
     */
927
    public function assertNotNull() {
928
        $this->callAssertMethod(__FUNCTION__);
929
    }
930
931
    /**
932
     * Asserts that a variable is finite.
933
     */
934
    public function assertFinite() {
935
        $this->callAssertMethod(__FUNCTION__);
936
    }
937
938
    /**
939
     * Asserts that a variable is infinite.
940
     */
941
    public function assertInfinite() {
942
        $this->callAssertMethod(__FUNCTION__);
943
    }
944
945
    /**
946
     * Asserts that a variable is nan.
947
     */
948
    public function assertNan() {
949
        $this->callAssertMethod(__FUNCTION__);
950
    }
951
952
    /**
953
     * Asserts that a class exists
954
     */
955
    public function assertClassExists() {
956
        $this->callAssertMethod('classExists');
957
    }
958
959
    protected function classExists($class, $message) {
960
        $this->test->assertTrue(class_exists($class), $message);
0 ignored issues
show
Bug introduced by
The method assertTrue() does not exist on PHPUnit\Framework\Test. It seems like you code against a sub-type of PHPUnit\Framework\Test such as PHPUnit\Framework\TestCase. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

960
        $this->test->/** @scrutinizer ignore-call */ 
961
                     assertTrue(class_exists($class), $message);
Loading history...
961
    }
962
963
    /**
964
     * Asserts that a class does not exist
965
     */
966
    public function assertClassDoesNotExist() {
967
        $this->callAssertMethod('classDoesNotExist');
968
    }
969
970
    protected function classDoesNotExist($class, $message) {
971
        $this->test->assertFalse(class_exists($class), $message);
0 ignored issues
show
Bug introduced by
The method assertFalse() does not exist on PHPUnit\Framework\Test. It seems like you code against a sub-type of PHPUnit\Framework\Test such as PHPUnit\Framework\TestCase. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

971
        $this->test->/** @scrutinizer ignore-call */ 
972
                     assertFalse(class_exists($class), $message);
Loading history...
972
    }
973
974
    /**
975
     * Asserts that a class does not exist
976
     */
977
    public function assertClassIsInterface() {
978
        $this->callAssertMethod('classIsInterface');
979
    }
980
981
    protected function classIsInterface($class, $message) {
982
        $this->test->assertTrue(interface_exists($class), $message);
983
    }
984
985
    /**
986
     * Asserts that a class does not exist
987
     */
988
    public function assertClassIsNotInterface() {
989
        $this->callAssertMethod('classIsNotInterface');
990
    }
991
992
    protected function classIsNotInterface($class, $message) {
993
        $this->test->assertFalse(interface_exists($class), $message);
994
    }
995
996
    /**
997
     * Asserts that a class has a specified attribute.
998
     *
999
     * @param string $attributeName
1000
     */
1001
    public function assertClassHasAttribute($attributeName) {
1002
        $this->callAssertMethod(__FUNCTION__, [
1003
            'expected' => $attributeName,
1004
        ]);
1005
    }
1006
1007
    /**
1008
     * Asserts that a class does not have a specified attribute.
1009
     *
1010
     * @param string $attributeName
1011
     */
1012
    public function assertClassNotHasAttribute($attributeName) {
1013
        $this->callAssertMethod(__FUNCTION__, [
1014
            'expected' => $attributeName,
1015
        ]);
1016
    }
1017
1018
    /**
1019
     * Asserts that a class has a specified static attribute.
1020
     *
1021
     * @param string $attributeName
1022
     */
1023
    public function assertClassHasStaticAttribute($attributeName) {
1024
        $this->callAssertMethod(__FUNCTION__, [
1025
            'expected' => $attributeName,
1026
        ]);
1027
    }
1028
1029
    /**
1030
     * Asserts that a class does not have a specified static attribute.
1031
     *
1032
     * @param string $attributeName
1033
     */
1034
    public function assertClassNotHasStaticAttribute($attributeName) {
1035
        $this->callAssertMethod(__FUNCTION__, [
1036
            'expected' => $attributeName,
1037
        ]);
1038
    }
1039
1040
    /**
1041
     * Asserts that an object has a specified attribute.
1042
     *
1043
     * @param string $attributeName
1044
     */
1045
    public function assertObjectHasAttribute($attributeName) {
1046
        $this->callAssertMethod(__FUNCTION__, [
1047
            'expected' => $attributeName,
1048
        ]);
1049
    }
1050
1051
    /**
1052
     * Asserts that an object does not have a specified attribute.
1053
     *
1054
     * @param string $attributeName
1055
     */
1056
    public function assertObjectNotHasAttribute($attributeName) {
1057
        $this->callAssertMethod(__FUNCTION__, [
1058
            'expected' => $attributeName,
1059
        ]);
1060
    }
1061
1062
    /**
1063
     * Asserts that two variables have the same type and value.
1064
     * Used on objects, it asserts that two variables reference
1065
     * the same object.
1066
     *
1067
     * @param mixed $expected
1068
     */
1069
    public function assertSame($expected) {
1070
        $this->callAssertMethod(__FUNCTION__, [
1071
            'expected' => $expected,
1072
        ]);
1073
    }
1074
1075
    /**
1076
     * Asserts that a variable and an attribute of an object have the same type
1077
     * and value.
1078
     *
1079
     * @param mixed $expected
1080
     * @param string $actualAttributeName
1081
     * @param string|object $actualClassOrObject
1082
     * @param string $message
1083
     */
1084
    public function assertAttributeSame($expected, $actualAttributeName, $actualClassOrObject) {
1085
        $this->callAssertMethod(__FUNCTION__, [
1086
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
1087
        ]);
1088
    }
1089
1090
    /**
1091
     * Asserts that two variables do not have the same type and value.
1092
     * Used on objects, it asserts that two variables do not reference
1093
     * the same object.
1094
     *
1095
     * @param mixed $expected
1096
     */
1097
    public function assertNotSame($expected) {
1098
        $this->callAssertMethod(__FUNCTION__, [
1099
            'expected' => $expected,
1100
        ]);
1101
    }
1102
1103
    /**
1104
     * Asserts that a variable and an attribute of an object do not have the
1105
     * same type and value.
1106
     *
1107
     * @param mixed $expected
1108
     * @param string $actualAttributeName
1109
     * @param string|object $actualClassOrObject
1110
     * @param string $message
1111
     */
1112
    public function assertAttributeNotSame($expected, $actualAttributeName, $actualClassOrObject) {
1113
        $this->callAssertMethod(__FUNCTION__, [
1114
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
1115
        ]);
1116
    }
1117
1118
    /**
1119
     * Asserts that a variable is of a given type.
1120
     *
1121
     * @param string $expected
1122
     */
1123
    public function assertInstanceOf($expected) {
1124
        $this->callAssertMethod(__FUNCTION__, [
1125
            'expected' => $expected,
1126
        ]);
1127
    }
1128
1129
    /**
1130
     * Asserts that an attribute is of a given type.
1131
     *
1132
     * @param string $expected
1133
     * @param string $attributeName
1134
     * @param string|object $classOrObject
1135
     * @param string $message
1136
     */
1137
    public function assertAttributeInstanceOf($expected, $attributeName, $classOrObject) {
1138
        $this->callAssertMethod(__FUNCTION__, [
1139
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
1140
        ]);
1141
    }
1142
1143
    /**
1144
     * Asserts that a variable is not of a given type.
1145
     *
1146
     * @param string $expected
1147
     */
1148
    public function assertNotInstanceOf($expected) {
1149
        $this->callAssertMethod(__FUNCTION__, [
1150
            'expected' => $expected,
1151
        ]);
1152
    }
1153
1154
    /**
1155
     * Asserts that an attribute is of a given type.
1156
     *
1157
     * @param string $expected
1158
     * @param string $attributeName
1159
     * @param string|object $classOrObject
1160
     * @param string $message
1161
     */
1162
    public function assertAttributeNotInstanceOf($expected, $attributeName, $classOrObject) {
1163
        $this->callAssertMethod(__FUNCTION__, [
1164
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
1165
        ]);
1166
    }
1167
1168
    /**
1169
     * Asserts that a variable is of a given type.
1170
     *
1171
     * @param string $expected
1172
     */
1173
    public function assertInternalType($expected) {
1174
        $this->callAssertMethod(__FUNCTION__, [
1175
            'expected' => $expected,
1176
        ]);
1177
    }
1178
1179
    /**
1180
     * Asserts that an attribute is of a given type.
1181
     *
1182
     * @param string $expected
1183
     * @param string $attributeName
1184
     * @param string|object $classOrObject
1185
     * @param string $message
1186
     */
1187
    public function assertAttributeInternalType($expected, $attributeName, $classOrObject) {
1188
        $this->callAssertMethod(__FUNCTION__, [
1189
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
1190
        ]);
1191
    }
1192
1193
    /**
1194
     * Asserts that a variable is not of a given type.
1195
     *
1196
     * @param string $expected
1197
     */
1198
    public function assertNotInternalType($expected) {
1199
        $this->callAssertMethod(__FUNCTION__, [
1200
            'expected' => $expected,
1201
        ]);
1202
    }
1203
1204
    /**
1205
     * Asserts that an attribute is of a given type.
1206
     *
1207
     * @param string $expected
1208
     * @param string $attributeName
1209
     * @param string|object $classOrObject
1210
     * @param string $message
1211
     */
1212
    public function assertAttributeNotInternalType($expected, $attributeName, $classOrObject) {
1213
        $this->callAssertMethod(__FUNCTION__, [
1214
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
1215
        ]);
1216
    }
1217
1218
    /**
1219
     * Asserts that a string matches a given regular expression.
1220
     *
1221
     * @param string $pattern
1222
     */
1223
    public function assertRegExp($pattern) {
1224
        $this->callAssertMethod(__FUNCTION__, [
1225
            'expected' => $pattern,
1226
        ]);
1227
    }
1228
1229
    /**
1230
     * Asserts that a string does not match a given regular expression.
1231
     *
1232
     * @param string $pattern
1233
     */
1234
    public function assertNotRegExp($pattern, $string) {
1235
        $this->callAssertMethod(__FUNCTION__, [
1236
            'expected' => $key,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $key seems to be never defined.
Loading history...
1237
        ]);
1238
    }
1239
1240
    /**
1241
     * Assert that the size of two arrays (or `\Countable` or `\Traversable` objects)
1242
     * is the same.
1243
     *
1244
     * @param array|\Countable|\Traversable $expected
1245
     */
1246
    public function assertSameSize($expected) {
1247
        $this->callAssertMethod(__FUNCTION__, [
1248
            'expected' => $expected,
1249
        ]);
1250
    }
1251
1252
    /**
1253
     * Assert that the size of two arrays (or `\Countable` or `\Traversable` objects)
1254
     * is not the same.
1255
     *
1256
     * @param array|\Countable|\Traversable $expected
1257
     * @param array|\Countable|\Traversable $actual
1258
     * @param string $message
1259
     */
1260
    public function assertNotSameSize($expected) {
1261
        $this->callAssertMethod(__FUNCTION__, [
1262
            'expected' => $expected,
1263
        ]);
1264
    }
1265
1266
    /**
1267
     * Asserts that a string matches a given format string.
1268
     *
1269
     * @param string $format
1270
     */
1271
    public function assertStringMatchesFormat($format) {
1272
        $this->callAssertMethod(__FUNCTION__, [
1273
            'expected' => $format,
1274
        ]);
1275
    }
1276
1277
    /**
1278
     * Asserts that a string does not match a given format string.
1279
     *
1280
     * @param string $format
1281
     */
1282
    public function assertStringNotMatchesFormat($format) {
1283
        $this->callAssertMethod(__FUNCTION__, [
1284
            'expected' => $format,
1285
        ]);
1286
    }
1287
1288
    /**
1289
     * Asserts that a string matches a given format file.
1290
     *
1291
     * @param string $formatFile
1292
     */
1293
    public function assertStringMatchesFormatFile($formatFile) {
1294
        $this->callAssertMethod(__FUNCTION__, [
1295
            'expected' => $formatFile,
1296
        ]);
1297
    }
1298
1299
    /**
1300
     * Asserts that a string does not match a given format string.
1301
     *
1302
     * @param string $formatFile
1303
     */
1304
    public function assertStringNotMatchesFormatFile($formatFile) {
1305
        $this->callAssertMethod(__FUNCTION__, [
1306
            'expected' => $formatFile,
1307
        ]);
1308
    }
1309
1310
    /**
1311
     * Asserts that a string starts with a given prefix.
1312
     *
1313
     * @param string $prefix
1314
     */
1315
    public function assertStringStartsWith($prefix) {
1316
        $this->callAssertMethod(__FUNCTION__, [
1317
            'expected' => $prefix,
1318
        ]);
1319
    }
1320
1321
    /**
1322
     * Asserts that a string starts not with a given prefix.
1323
     *
1324
     * @param string $prefix
1325
     */
1326
    public function assertStringStartsNotWith($prefix) {
1327
        $this->callAssertMethod(__FUNCTION__, [
1328
            'expected' => $prefix,
1329
        ]);
1330
    }
1331
1332
    /**
1333
     * Asserts that a string ends with a given suffix.
1334
     *
1335
     * @param string $suffix
1336
     */
1337
    public function assertStringEndsWith($suffix) {
1338
        $this->callAssertMethod(__FUNCTION__, [
1339
            'expected' => $suffix,
1340
        ]);
1341
    }
1342
1343
    /**
1344
     * Asserts that a string ends not with a given suffix.
1345
     *
1346
     * @param string $suffix
1347
     * @param string $string
1348
     * @param string $message
1349
     */
1350
    public function assertStringEndsNotWith($suffix) {
1351
        $this->callAssertMethod(__FUNCTION__, [
1352
            'expected' => $suffix,
1353
        ]);
1354
    }
1355
1356
    /**
1357
     * Asserts that two XML files are equal.
1358
     *
1359
     * @param string $expectedFile
1360
     */
1361
    public function assertXmlFileEqualsXmlFile($expectedFile) {
1362
        $this->callAssertMethod(__FUNCTION__, [
1363
            'expected' => $expectedFile,
1364
        ]);
1365
    }
1366
1367
    /**
1368
     * Asserts that two XML files are not equal.
1369
     *
1370
     * @param string $expectedFile
1371
     * @param string $actualFile
1372
     * @param string $message
1373
     */
1374
    public function assertXmlFileNotEqualsXmlFile($expectedFile) {
1375
        $this->callAssertMethod(__FUNCTION__, [
1376
            'expected' => $expectedFile,
1377
        ]);
1378
    }
1379
1380
    /**
1381
     * Asserts that two XML documents are equal.
1382
     *
1383
     * @param string $expectedFile
1384
     */
1385
    public function assertXmlStringEqualsXmlFile($expectedFile) {
1386
        $this->callAssertMethod(__FUNCTION__, [
1387
            'expected' => $expectedFile,
1388
        ]);
1389
    }
1390
1391
    /**
1392
     * Asserts that two XML documents are not equal.
1393
     *
1394
     * @param string $expectedFile
1395
     */
1396
    public function assertXmlStringNotEqualsXmlFile($expectedFile) {
1397
        $this->callAssertMethod(__FUNCTION__, [
1398
            'expected' => $expectedFile,
1399
        ]);
1400
    }
1401
1402
    /**
1403
     * Asserts that two XML documents are equal.
1404
     *
1405
     * @param string|\DOMDocument $expectedXml
1406
     * @param string $message
1407
     */
1408
    public function assertXmlStringEqualsXmlString($expectedXml) {
1409
        $this->callAssertMethod(__FUNCTION__, [
1410
            'expected' => $expectedXml,
1411
        ]);
1412
    }
1413
1414
    /**
1415
     * Asserts that two XML documents are not equal.
1416
     *
1417
     * @param string|\DOMDocument $expectedXml
1418
     */
1419
    public function assertXmlStringNotEqualsXmlString($expectedXml) {
1420
        $this->callAssertMethod(__FUNCTION__, [
1421
            'expected' => $expectedXml,
1422
        ]);
1423
    }
1424
1425
    /**
1426
     * Asserts that a hierarchy of DOMElements matches.
1427
     *
1428
     * @param \DOMElement $expectedElement
1429
     * @param bool $checkAttributes
1430
     */
1431
    public function assertEqualXMLStructure(\DOMElement $expectedElement, $checkAttributes = false) {
1432
        $this->callAssertMethod(__FUNCTION__, [
1433
            'expected' => $expectedElement,
1434
            'options' => [
1435
                $checkAttributes,
1436
            ],
1437
        ]);
1438
    }
1439
1440
    /**
1441
     * Asserts that a string is a valid JSON string.
1442
     */
1443
    public function assertJson() {
1444
        $this->callAssertMethod(__FUNCTION__);
1445
    }
1446
1447
    /**
1448
     * Asserts that two given JSON encoded objects or arrays are equal.
1449
     *
1450
     * @param string $expectedJson
1451
     */
1452
    public function assertJsonStringEqualsJsonString($expectedJson) {
1453
        $this->callAssertMethod(__FUNCTION__, [
1454
            'expected' => $expectedJson,
1455
        ]);
1456
    }
1457
1458
    /**
1459
     * Asserts that two given JSON encoded objects or arrays are not equal.
1460
     *
1461
     * @param string $expectedJson
1462
     */
1463
    public function assertJsonStringNotEqualsJsonString($expectedJson) {
1464
        $this->callAssertMethod(__FUNCTION__, [
1465
            'expected' => $expectedJson,
1466
        ]);
1467
    }
1468
1469
    /**
1470
     * Asserts that the generated JSON encoded object and the content of the given file are equal.
1471
     *
1472
     * @param string $expectedFile
1473
     */
1474
    public function assertJsonStringEqualsJsonFile($expectedFile) {
1475
        $this->callAssertMethod(__FUNCTION__, [
1476
            'expected' => $expectedFile,
1477
        ]);
1478
    }
1479
1480
    /**
1481
     * Asserts that the generated JSON encoded object and the content of the given file are not equal.
1482
     *
1483
     * @param string $expectedFile
1484
     */
1485
    public function assertJsonStringNotEqualsJsonFile($expectedFile) {
1486
        $this->callAssertMethod(__FUNCTION__, [
1487
            'expected' => $expectedFile,
1488
        ]);
1489
    }
1490
1491
    /**
1492
     * Asserts that two JSON files are equal.
1493
     *
1494
     * @param string $expectedFile
1495
     */
1496
    public function assertJsonFileEqualsJsonFile($expectedFile) {
1497
        $this->callAssertMethod(__FUNCTION__, [
1498
            'expected' => $expectedFile,
1499
        ]);
1500
    }
1501
1502
    /**
1503
     * Asserts that two JSON files are not equal.
1504
     *
1505
     * @param string $expectedFile
1506
     */
1507
    public function assertJsonFileNotEqualsJsonFile($expectedFile) {
1508
        $this->callAssertMethod(__FUNCTION__, [
1509
            'expected' => $expectedFile,
1510
        ]);
1511
    }
1512
}