22
33namespace 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