File tree 1 file changed +43
-0
lines changed 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -2783,6 +2783,49 @@ Reports an error identified by ``$message`` if the two variables ``$expected`` a
2783
2783
FAILURES!
2784
2784
Tests: 1, Assertions: 1, Failures: 1.
2785
2785
2786
+ assertSameSize()
2787
+ ######################
2788
+
2789
+ ``assertSameSize($expected, $actual, string $message = '') ``
2790
+
2791
+ Reports an error identified by ``$message `` if the size of ``$actual `` and ``$expected `` is not the same.
2792
+
2793
+ ``assertNotSameSize() `` is the inverse of this assertion and takes the same arguments.
2794
+
2795
+ .. code-block :: php
2796
+ :caption: Usage of assertSameSize()
2797
+ :name: appendixes.assertions.assertSameSize.example
2798
+
2799
+ <?php declare(strict_types=1);
2800
+ use PHPUnit\Framework\TestCase;
2801
+
2802
+ final class SameSizeTest extends TestCase
2803
+ {
2804
+ public function testFailure(): void
2805
+ {
2806
+ $this->assertSameSize([1, 2], [1]);
2807
+ }
2808
+ }
2809
+
2810
+ .. parsed-literal ::
2811
+
2812
+ $ phpunit StringEndsWithTest
2813
+ PHPUnit |version |.0 by Sebastian Bergmann and contributors.
2814
+
2815
+ F
2816
+
2817
+ Time: 0 second, Memory: 4.00Mb
2818
+
2819
+ There was 1 failure:
2820
+
2821
+ 1) SameSizeTest::testFailure
2822
+ Failed asserting that actual size 1 matches expected size 2.
2823
+
2824
+ /home/sb/SameSizeTest.php:8
2825
+
2826
+ FAILURES!
2827
+ Tests: 1, Assertions: 1, Failures: 1.
2828
+
2786
2829
.. _appendixes.assertions.assertStringEndsWith :
2787
2830
2788
2831
assertStringEndsWith()
You can’t perform that action at this time.
0 commit comments