public function testSendAction()
 {
     Session::shouldReceive('getId')->once()->andReturn(self::SESSION_ID);
     $this->easyrec->sendAction(self::ITEM_ID, self::ITEM_DESCRIPTION, self::ITEM_URL, self::CUSTOM_ACTION);
     // Test required keys
     $requiredKeys = ['itemid', 'itemdescription', 'itemurl', 'actiontype', 'sessionid'];
     $queryParams = $this->easyrec->getQueryParams();
     foreach ($requiredKeys as $key) {
         $this->assertArrayHasKey($key, $queryParams);
     }
     // Test values in the request
     $this->assertEquals($queryParams["apikey"], "mock-key");
     $this->assertEquals($queryParams["tenantid"], "mock-tenant");
     $this->assertEquals($queryParams["sessionid"], self::SESSION_ID);
     $this->assertEquals($queryParams["itemid"], self::ITEM_ID);
     $this->assertEquals($queryParams["itemdescription"], self::ITEM_DESCRIPTION);
     $this->assertEquals($queryParams["itemurl"], self::ITEM_URL);
     $this->assertEquals($queryParams["actiontype"], self::CUSTOM_ACTION);
     // Test the endpoint name
     $this->assertEquals('sendaction', $this->easyrec->getEndpoint());
 }
 public function testClear()
 {
     Session::shouldReceive('forget')->once()->with($this->prefix . 'code')->andReturn(true);
     $this->storage->clear('code');
 }
Пример #3
0
 public function test_allowed_extensions_to_json()
 {
     Session::shouldReceive('get')->once()->with('formFields')->andReturn(array('media' => array('type' => 'media', 'allowed' => Browser::TYPE_AUDIO)));
     $json = $this->browser->allowedExtensionsToJSON('media');
     $this->assertEquals('["mp3","wav"]', $json);
 }