Beispiel #1
0
 /**
  * Test Web API User CRUD
  */
 public function testCRUD()
 {
     $role = $this->_roleFactory->create()->load('test_role', 'role_name');
     $this->_model->setApiKey('Test User Name')->setContactEmail('*****@*****.**')->setSecret('*****@*****.**')->setRoleId($role->getId());
     $crud = new Magento_Test_Entity($this->_model, array('api_key' => '_User_Name_'));
     $crud->testCrud();
 }
Beispiel #2
0
 /**
  * Test method Mage_Webapi_Model_Acl_Rule::saveResources()
  */
 public function testSaveResources()
 {
     $role = $this->_roleFactory->create()->load('test_role', 'role_name');
     $resources = array('customer/create', 'customer/update');
     $this->_model->setRoleId($role->getId())->setResources($resources)->saveResources();
     /** @var $rulesSet Mage_Webapi_Model_Resource_Acl_Rule_Collection */
     $rulesSet = $this->_objectManager->get('Mage_Webapi_Model_Resource_Acl_Rule_Collection')->getByRole($role->getRoleId())->load();
     $this->assertCount(2, $rulesSet);
 }
Beispiel #3
0
 /**
  * Test create method
  */
 public function testCreate()
 {
     $arguments = array('property' => 'value');
     $this->_objectManager->expects($this->once())->method('create')->with('Mage_Webapi_Model_Acl_Role', $arguments)->will($this->returnValue($this->_expectedObject));
     $this->assertEquals($this->_expectedObject, $this->_model->create($arguments));
 }