Skip to content

Commit 8553c7f

Browse files
authored
Fix PHPUnit deprecation warnings (#68)
Co-authored-by: simonhammes <[email protected]>
1 parent bce3418 commit 8553c7f

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

test/ZammadAPIClient/Resource/AbstractBaseTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PHPUnit\Framework\TestCase;
66

77
use ZammadAPIClient\Client;
8+
use ZammadAPIClient\Exception\AlreadyFetchedObjectException;
89

910
abstract class AbstractBaseTest extends TestCase
1011
{
@@ -190,11 +191,12 @@ public function testGet()
190191
}
191192

192193
/**
193-
* @expectedException \ZammadAPIClient\Exception\AlreadyFetchedObjectException
194194
* @depends testCreate
195195
*/
196196
public function testGetOnFilledObjects()
197197
{
198+
$this->expectException(AlreadyFetchedObjectException::class);
199+
198200
foreach ( self::$created_objects as $created_object ) {
199201
$created_object_id = $created_object->getID();
200202
if ( empty( $created_object_id) ) {
@@ -328,11 +330,12 @@ public function testAllPagination()
328330
}
329331

330332
/**
331-
* @expectedException \ZammadAPIClient\Exception\AlreadyFetchedObjectException
332333
* @depends testCreate
333334
*/
334335
public function testAllOnFilledObjects()
335336
{
337+
$this->expectException(AlreadyFetchedObjectException::class);
338+
336339
foreach ( self::$created_objects as $created_object ) {
337340
$created_object_id = $created_object->getID();
338341
if ( empty( $created_object_id) ) {

test/ZammadAPIClient/Resource/TicketTest.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace ZammadAPIClient\Resource;
44

5+
use ZammadAPIClient\Exception\AlreadyFetchedObjectException;
56
use ZammadAPIClient\ResourceType;
67

78
class TicketTest extends AbstractBaseTest
@@ -189,11 +190,7 @@ public function testCreate( $values, $expected_success, $expected_article_count
189190

190191
// Compare article data.
191192
$articles = $object->getTicketArticles();
192-
$this->assertInternalType(
193-
'array',
194-
$articles,
195-
'Articles of ticket object must be returned as array.'
196-
);
193+
$this->assertIsArray($articles);
197194

198195
$this->assertCount(
199196
$expected_article_count,
@@ -226,11 +223,12 @@ public function testGet()
226223
}
227224

228225
/**
229-
* @expectedException \ZammadAPIClient\Exception\AlreadyFetchedObjectException
230226
* @depends testCreate
231227
*/
232228
public function testGetOnFilledObjects()
233229
{
230+
$this->expectException(AlreadyFetchedObjectException::class);
231+
234232
return parent::testGetOnFilledObjects();
235233
}
236234

@@ -259,11 +257,12 @@ public function testAllPagination()
259257
}
260258

261259
/**
262-
* @expectedException \ZammadAPIClient\Exception\AlreadyFetchedObjectException
263260
* @depends testCreate
264261
*/
265262
public function testAllOnFilledObjects()
266263
{
264+
$this->expectException(AlreadyFetchedObjectException::class);
265+
267266
return parent::testAllOnFilledObjects();
268267
}
269268

0 commit comments

Comments
 (0)