callCount = 0; } public function testSuccess(): void { $trait = new class { use RetryingClientTrait { retryingFailRequest as public; // make the method public } }; $result = $trait->retryingFailRequest(2, 0, [\RuntimeException::class], $this->getLogger(), function () { $this->callCount = $this->callCount + 1; return 'foo'; }); $this->assertEquals(1, $this->callCount); $this->assertEquals('foo', $result); } public function testRetyingFail(): void { $trait = new class { use RetryingClientTrait { retryingFailRequest as public; // make the method public } }; try { $trait->retryingFailRequest(2, 0, [\RuntimeException::class], $this->getLogger(), function () { $this->callCount = $this->callCount + 1; throw new \RuntimeException("test"); }); } catch (\RuntimeException) { // do nothing } $this->assertEquals(3, $this->callCount); } // extra attributes muzeme safe ignorovat }