Commits

Anonymous committed dbdd33a

Walkthrought Test Changes

  • Participants
  • Parent commits 7e862b2

Comments (0)

Files changed (1)

File app/protected/modules/accounts/tests/unit/walkthrough/AccountsSuperUserWalkthroughTest.php

                 'selectedIds' => $superAccountId2 . ',' . $superAccountId3, // Not Coding Standard
                 'selectAll' => '',
                 'Account_page' => 1));
-            $this->setPostArray(array('selectedIds' => '5'));
+            $this->setPostArray(array('selectedRecordCount' => '5'));
             $this->runControllerWithRedirectExceptionAndGetContent('accounts/default/massDelete');
+            
+        }
+        
+         /**
+         * @Test Bug with mass delete and multiple pages when using select all
+         */
+        public function testMassDeletePagesProperlyAndRemovesAllSelected()
+        {
+            $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
 
+            //MassDelete for selected Record Count
+            $accounts = Account::getAll();
+            $this->assertEquals(10, count($accounts));
+            
+            $superAccountId  = self::getModelIdByModelNameAndName('Account', 'superAccount');
+            $superAccountId4  = self::getModelIdByModelNameAndName('Account', 'superAccount4');
+            $superAccountId5  = self::getModelIdByModelNameAndName('Account', 'superAccount5');
+            $superAccountId6  = self::getModelIdByModelNameAndName('Account', 'superAccount6');
+            $superAccountId7  = self::getModelIdByModelNameAndName('Account', 'superAccount7');
+            $superAccountId8  = self::getModelIdByModelNameAndName('Account', 'superAccount8');
+            $superAccountId9  = self::getModelIdByModelNameAndName('Account', 'superAccount9');
+            $superAccountId10 = self::getModelIdByModelNameAndName('Account', 'superAccount10');
+            $superAccountId11 = self::getModelIdByModelNameAndName('Account', 'superAccount11');
+            $superAccountId12 = self::getModelIdByModelNameAndName('Account', 'superAccount12');
+
+            //save Model MassDelete for entire search result
+            $this->setGetArray(array(                                        
+                'selectAll' => '1',           // Not Coding Standard
+                'Account_page' => 1));
+            $this->setPostArray(array('selectedRecordCount' => 8));
             //Run Mass Delete using progress save.
             $pageSize = Yii::app()->pagination->getForCurrentUserByType('massDeleteProgressPageSize');
             $this->assertEquals(5, $pageSize);
-            //save Modal MassDelete using progress load for page 2.
-            $this->setGetArray(array('selectAll' => '1', 'Account_page' => 2));
-            $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/default/massDeleteProgress');
-            $this->assertFalse(strpos($content, '"value":100') === false);
-
+            Yii::app()->pagination->setForCurrentUserByType('massDeleteProgressPageSize', 20);
  1. Jason Green

    why are you setting this to 20? This means it will not utilize a paged delete.... but do it all at once which is not where the bug is. please explain.

+            $this->runControllerWithNoExceptionsAndGetContent('accounts/default/massDeleteProgress');
             //Set page size back to old value.
             Yii::app()->pagination->setForCurrentUserByType('massDeleteProgressPageSize', $pageSize);
-            //save Model MassDelete for entire search result
-            $this->setGetArray(array(
-                'selectAll' => '1',
-                'Account_page' => 1));
-            $this->setPostArray(array('selectedIds' => '5'));
-            $pageSize = Yii::app()->pagination->getForCurrentUserByType('massDeleteProgressPageSize');
-            $this->assertEquals(5, $pageSize);
-            Yii::app()->pagination->setForCurrentUserByType('massDeleteProgressPageSize', 20);
-            $this->runControllerWithRedirectExceptionAndGetContent('accounts/default/massDelete');
-            Yii::app()->pagination->setForCurrentUserByType('massDeleteProgressPageSize', $pageSize);
-        }
-        
-         /**
-         * @deletes all accounts. This should always be last function
-         */
-        public function testMassDeletesSelectAllActions()
-        {
-            $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
-            
-            //Setup test data owned by the super user.
-            AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
-            AccountTestHelper::createAccountByNameForOwner('superAccount2', $super);
 
-
-            $accounts = Account::getAll();
-            $this->assertEquals(2, count($accounts));
-            
-            $superAccountId  = self::getModelIdByModelNameAndName('Account', 'superAccount');
-            $superAccountId2  = self::getModelIdByModelNameAndName('Account', 'superAccount2');
-
-
-            
-            $this->setGetArray(array(                                        
-                'selectAll' => '1',           // Not Coding Standard
-                'Account_page' => 1));
-            $this->setPostArray(array('selectedIds' => '2'));
-            $pageSize = Yii::app()->pagination->getForCurrentUserByType('massDeleteProgressPageSize');
-            $this->assertEquals(5, $pageSize);
-            Yii::app()->pagination->setForCurrentUserByType('massDeleteProgressPageSize', 2);
-            $this->runControllerWithRedirectExceptionAndGetContent('accounts/default/massDelete');
-            Yii::app()->pagination->setForCurrentUserByType('massDeleteProgressPageSize', $pageSize);
-            
+            //calculating account's count
             $accounts = Account::getAll();
             $this->assertEquals(0, count($accounts));