From e3fd2912b7f6d8b11956ecec49e9cb70ab9230b7 Mon Sep 17 00:00:00 2001 From: Suraj Dadral Date: Fri, 21 Jun 2024 11:32:47 +0530 Subject: [PATCH] fix(nsec3): fixes unset nsec3param not working Tested with: php: 8.2 powerdns version: 4.9.1-1pdns.buster --- src/Resources/Zone.php | 2 +- tests/Resources/ZoneTest.php | 2 +- tests/ZoneTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Resources/Zone.php b/src/Resources/Zone.php index 2540c81..c3248f0 100644 --- a/src/Resources/Zone.php +++ b/src/Resources/Zone.php @@ -353,7 +353,7 @@ public function setNsec3param(?string $nsec3param): self { // If set to null, return, if (is_null($nsec3param)) { - $this->nsec3param = null; + $this->nsec3param = ""; return $this; } diff --git a/tests/Resources/ZoneTest.php b/tests/Resources/ZoneTest.php index 8bdafff..79c0cfc 100644 --- a/tests/Resources/ZoneTest.php +++ b/tests/Resources/ZoneTest.php @@ -116,7 +116,7 @@ public function testSetEmptyNsec3param(): void { $zone = new Zone(); $zone->setNsec3param(null); - $this->assertNull($zone->getNsec3param()); + $this->assertEmpty($zone->getNsec3param()); } public function testSetNsec3paramInvalidAlgorithm(): void diff --git a/tests/ZoneTest.php b/tests/ZoneTest.php index 1956791..a3b5522 100644 --- a/tests/ZoneTest.php +++ b/tests/ZoneTest.php @@ -271,7 +271,7 @@ public function testSetEmptyNsec3param(): void $connector = Mockery::mock(Connector::class); $connector->shouldReceive('put')->withArgs(['zones/test.nl.', Mockery::on(function ($transformer) { $transformed = $transformer->transform(); - $this->assertNull($transformed->nsec3param); + $this->assertEmpty($transformed->nsec3param); return true; })])->once()->andReturn([]);