From 29474f479da9b7d7fb4e4015497adfe84907a356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Somogyi?= Date: Tue, 27 Aug 2024 19:11:27 +0200 Subject: [PATCH] tests: add more tests --- tests/Matchers/MatcherHeaderAbstractTest.php | 41 +++++++++++++++++++ .../Mocks/MatcherHeaderAbstractMock.php | 13 ++++++ 2 files changed, 54 insertions(+) create mode 100644 tests/Matchers/MatcherHeaderAbstractTest.php create mode 100644 tests/Matchers/Mocks/MatcherHeaderAbstractMock.php diff --git a/tests/Matchers/MatcherHeaderAbstractTest.php b/tests/Matchers/MatcherHeaderAbstractTest.php new file mode 100644 index 0000000..76a6a98 --- /dev/null +++ b/tests/Matchers/MatcherHeaderAbstractTest.php @@ -0,0 +1,41 @@ +headers(['header' => 'value']); + $this->assertSame(['header' => 'value'], $matcher->getHeaders()); + } + + public function testWithHeaders(): void + { + $matcher = new MatcherHeaderAbstractMock(); + $matcher2 = $matcher->withHeaders(['header' => 'value']); + $this->assertSame([], $matcher->getHeaders()); + $this->assertSame(['header' => 'value'], $matcher2->getHeaders()); + } + + public function testResetHeaders(): void + { + $matcher = new MatcherHeaderAbstractMock(); + $matcher->headers(['header' => 'value']); + $matcher->resetHeaders(); + $this->assertSame([], $matcher->getHeaders()); + } + + public function testWithoutHeaders(): void + { + $matcher = new MatcherHeaderAbstractMock(); + $matcher->headers(['header' => 'value']); + $matcher2 = $matcher->withoutHeaders(); + $this->assertSame(['header' => 'value'], $matcher->getHeaders()); + $this->assertSame([], $matcher2->getHeaders()); + } +} \ No newline at end of file diff --git a/tests/Matchers/Mocks/MatcherHeaderAbstractMock.php b/tests/Matchers/Mocks/MatcherHeaderAbstractMock.php new file mode 100644 index 0000000..a7d0b97 --- /dev/null +++ b/tests/Matchers/Mocks/MatcherHeaderAbstractMock.php @@ -0,0 +1,13 @@ +headers; + } +} \ No newline at end of file