Example #1
0
 public function testSetSystemValue()
 {
     $post = array('somesetting' => 'this is a test');
     $request = new Request(null, $post);
     // create an api mock object
     $api = $this->getAPIMock(array('setSystemValue'));
     // expects to be called once with the method
     // setSystemValue('somesetting', 'this is a test')
     $api->expects($this->once())->method('setSystemValue')->with($this->equalTo('somesetting'), $this->equalTo('this is a test'));
     // we want to return the appname apptemplate_advanced when this method
     // is being called
     $api->expects($this->any())->method('getAppName')->will($this->returnValue('apptemplate_advanced'));
     $controller = new ItemController($api, $request, null);
     $response = $controller->setSystemValue(null);
     // check if the correct parameters of the json response are set
     $this->assertEquals($post, $response->getParams());
 }