public function test_User_Can_Be_Edited_By_Customer_And_Admin() { $post = array('userId' => 10, 'title' => 'Mr', 'firstname' => 'keith', 'lastname' => 'pope', 'email' => '*****@*****.**'); // Guest try { $edit = $this->_model->saveUser($post); $this->fail('Guest should not be able to edit user'); } catch (SF_Acl_Exception $e) { } // Customer try { $this->_model->setIdentity(array('role' => 'Customer')); $edit = $this->_model->saveUser($post); } catch (SF_Acl_Exception $e) { $this->fail('Customer should be able to edit user'); } // Admin try { $this->_model->setIdentity(array('role' => 'Admin')); $edit = $this->_model->saveUser($post); } catch (SF_Acl_Exception $e) { $this->fail('Admin should be able to edit user'); } $this->assertEquals(10, $edit); }
public function test_Cart_Should_Remove_Item_If_Added_With_Zero_Qty() { $product = $this->getProductMock(); $cartItem = $this->_model->addItem($product, 1); $cartItem = $this->_model->addItem($product, 0); $this->assertEquals(0, count($this->_model)); }
public function test_Catalog_Can_Get_Category_Parents() { $category = $this->_model->getCategoryByIdent('Category-8'); $cats = $this->_model->getParentCategories($category); $this->assertEquals(4, count($cats)); $category = $this->_model->getCategoryByIdent('Category-1'); $cats = $this->_model->getParentCategories($category); $this->assertEquals(1, count($cats)); }
public function test_GetMethods_Inflect_As_Expected() { $this->assertType('My_Form_Test_Me', $this->_model->getForm('testMe')); $this->assertType('My_Resource_Test_Me', $this->_model->getResource('testMe')); }