Jump to content


User::constructDerived fails to include Person attributes 2.6.3

2.6.3 memcached unit test Account bug User Person

  • Please log in to reply
No replies to this topic

#1 windsor


    Advanced Member

  • Moderators
  • 272 posts
  • LocationTampa, Florida USA

Posted 23 January 2014 - 03:58 PM

Failed in unit test for AccountReadPermssionsOptimizationTest::testOwnedSecurableItemCreated()


Using 2.6.3 'release' branch on Win7 with xampp


Workaround: User::forgetAll(); prior to assigning user for test.  see code snippet below.

public function testOwnedSecurableItemCreated()
            $mungeTableRowsBefore = self::getAccountMungeRowCount();
             * BEGIN CUSTOM CODE
             * Bug with memcached? - @see User::constructDerived($bean, $setDefaults)
             * per Jason?
             * "This is a hack to recover from a bug we cannot figure out how to solve.
             * Rarely the person attributes are not part of the user, memcache needs to be restarted to solve this
             * problem as you can't use the system once this occurs. this check below will clear the specific cache
             * that causes this. Still need to figure out what is setting the cache wrong to begin with"
             * END CUSTOM CODE

            $bobby = User::getByUsername('bobby');
            $benny = User::getByUsername('benny');

            // Benny is a sales person so his manager Bobby should have access
            // to things he creates.
            Yii::app()->user->userModel = $bobby;
            $bobbyBeforeAccounts = Account::getAll();

            Yii::app()->user->userModel = $benny;
            $bennyBeforeAccounts = Account::getAll();

            $account = new Account();
            $account->name = 'Doop de doop';

             * BEGIN CUSTOM CODE
             * Fails here. debug code inserted for testing.
//            $this->assertTrue($account->save());
              echo(PHP_EOL.'Errors on save:\n'.print_r($account->getErrors(),1).PHP_EOL);
             * END CUSTOM CODE

Also tagged with one or more of these keywords: 2.6.3, memcached, unit test, Account, bug, User, Person

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users