Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit 3741bfb

Browse files
committed
Trigger a deprecated error for setAttribs method
1 parent 5523511 commit 3741bfb

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/Helper/Gravatar.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ public function getImgTag()
186186
*/
187187
public function setAttribs(array $attribs)
188188
{
189+
trigger_error(sprintf(
190+
'%s is deprecated; please use %s::setAttributes',
191+
__METHOD__,
192+
__CLASS__
193+
), E_USER_DEPRECATED);
194+
189195
$this->attribs = $attribs;
190196
return $this;
191197
}

test/Helper/GravatarTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99

1010
namespace ZendTest\View\Helper;
1111

12+
use PHPUnit\Framework\Error\Deprecated as DeprecatedError;
1213
use PHPUnit\Framework\TestCase;
1314
use Zend\View\Exception;
14-
use Zend\View\Renderer\PhpRenderer as View;
1515
use Zend\View\Helper\Gravatar;
16+
use Zend\View\Renderer\PhpRenderer as View;
1617

1718
/**
1819
* @group Zendview
@@ -285,4 +286,11 @@ public function testEmailIsProperlyNormalized()
285286
$this->helper->__invoke('[email protected] ')->getEmail()
286287
);
287288
}
289+
290+
public function testSetAttribsIsDeprecated()
291+
{
292+
$this->expectException(DeprecatedError::class);
293+
294+
$this->helper->setAttribs([]);
295+
}
288296
}

0 commit comments

Comments
 (0)