11<?php
22use Splitice \BuyVM \BuyVMApi ;
33
4- /**
5- * Created by PhpStorm.
6- * User: splitice
7- * Date: 6/4/14
8- * Time: 2:24 PM
9- */
10-
114class ApiMethodsTest extends PHPUnit_Framework_TestCase {
125 const API_CLIENT = '\\Splitice \\BuyVM \\IBuyVMApiClient ' ;
136
@@ -38,10 +31,40 @@ function testBandwidth(){
3831 function testHardDrive (){
3932 //Assert
4033 $ client = $ this ->getMock (self ::API_CLIENT );
41- $ client ->expects ($ this ->once ())->method ('execute_info ' )->with ($ this ->equalTo (array ('hdd ' )))->will ($ this ->returnValue (array ('bw ' =>'total,used,free,percentage ' )));
34+ $ client ->expects ($ this ->once ())->method ('execute_info ' )->with ($ this ->equalTo (array ('hdd ' )))->will ($ this ->returnValue (array ('hdd ' =>'total,used,free,percentage ' )));
4235
4336 //Do
4437 $ api = new BuyVMApi ($ client );
4538 $ api ->get ('hdd ' );
4639 }
40+
41+ function testMemory (){
42+ //Assert
43+ $ client = $ this ->getMock (self ::API_CLIENT );
44+ $ client ->expects ($ this ->once ())->method ('execute_info ' )->with ($ this ->equalTo (array ('mem ' )))->will ($ this ->returnValue (array ('mem ' =>'total,used,free,percentage ' )));
45+
46+ //Do
47+ $ api = new BuyVMApi ($ client );
48+ $ api ->get ('mem ' );
49+ }
50+
51+ function testIpAddresses (){
52+ //Assert
53+ $ client = $ this ->getMock (self ::API_CLIENT );
54+ $ client ->expects ($ this ->once ())->method ('execute_info ' )->with ($ this ->equalTo (array ('ipaddr ' )))->will ($ this ->returnValue (array ('ipaddr ' =>'1.2.3.4,2.3.4.5,4.5.6.7,7.8.9.10 ' )));
55+
56+ //Do
57+ $ api = new BuyVMApi ($ client );
58+ $ api ->get ('ipaddr ' );
59+ }
60+
61+ function testStatus (){
62+ //Assert
63+ $ client = $ this ->getMock (self ::API_CLIENT );
64+ $ client ->expects ($ this ->once ())->method ('execute_info ' )->with ($ this ->equalTo (array ('status ' )))->will ($ this ->returnValue (array ('statusmsg ' =>'online ' )));
65+
66+ //Do
67+ $ api = new BuyVMApi ($ client );
68+ $ api ->get ('status ' );
69+ }
4770}
0 commit comments