Skip to content

Commit c06e200

Browse files
committed
Fix two more tests
1 parent 8c051df commit c06e200

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

tests/Model/EnvironmentTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
namespace Platformsh\Client\Tests\Model;
44

5+
use PHPUnit\Framework\TestCase;
56
use Platformsh\Client\Model\Environment;
67

7-
class EnvironmentTest extends \PHPUnit_Framework_TestCase
8+
class EnvironmentTest extends TestCase
89
{
910
public function testGetSshUrl()
1011
{
@@ -91,7 +92,7 @@ public function testGetSshUrl()
9192
try {
9293
$environment->getSshUrl($case['app'], $case['instance']);
9394
} catch (\InvalidArgumentException $e) {
94-
$this->assertContains('SSH URL not found for instance', $e->getMessage(), "case $i");
95+
$this->assertStringContainsString('SSH URL not found for instance', $e->getMessage(), "case $i");
9596
}
9697
continue;
9798
}

tests/ResourceTest.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
namespace Platformsh\Client\Tests;
44

5-
class ResourceTest extends \PHPUnit_Framework_TestCase
5+
use PHPUnit\Framework\TestCase;
6+
7+
class ResourceTest extends TestCase
68
{
79

810
/** @var array */
911
protected $properties;
1012

11-
/** @var \Platformsh\Client\Model\Resource */
13+
/** @var \Platformsh\Client\Model\ApiResourceBase */
1214
protected $resource;
1315

1416
public function setUp()
@@ -30,7 +32,7 @@ public function setUp()
3032
],
3133
],
3234
];
33-
$this->resource = new MockResource($data, null, null, true);
35+
$this->resource = new MockApiResource($data, 'https://api.example.com', null, true);
3436
}
3537

3638
/**
@@ -49,7 +51,7 @@ public function testGetProperty()
4951
{
5052
$this->assertEquals('test-id', $this->resource['id']);
5153
$this->assertEquals('test name', $this->resource->getProperty('name'));
52-
$this->setExpectedException('\InvalidArgumentException');
54+
$this->expectException('\InvalidArgumentException');
5355
$this->resource->getProperty('nonexistent');
5456
}
5557

@@ -69,7 +71,7 @@ public function testGetLink()
6971
{
7072
$this->assertNotEmpty($this->resource->getLink('self'));
7173
$this->assertNotEmpty($this->resource->getLink('#operate'));
72-
$this->setExpectedException('\InvalidArgumentException');
74+
$this->expectException('\InvalidArgumentException');
7375
$this->resource->getLink('nonexistent');
7476
}
7577

@@ -79,17 +81,17 @@ public function testGetLink()
7981
public function testRequiredPropertiesBlockCreation()
8082
{
8183
$mockClient = new MockClient();
82-
$this->setExpectedException('\InvalidArgumentException');
83-
MockResource::create([], '', $mockClient);
84+
$this->expectException('\InvalidArgumentException');
85+
MockApiResource::create([], '', $mockClient);
8486
}
8587

8688
/**
8789
* Test updating resource validation.
8890
*/
8991
public function testInvalidPropertiesBlockUpdate()
9092
{
91-
$resource = new MockResource([]);
92-
$this->setExpectedException('\InvalidArgumentException');
93+
$resource = new MockApiResource([]);
94+
$this->expectException('\InvalidArgumentException');
9395
$resource->update(['testProperty' => 2]);
9496
}
9597
}

0 commit comments

Comments
 (0)