public function testSaveSelectedOptionsAsStickyData() { $testData = array('optionForModel' => 'aaaaa', 'filteredBy' => 'bbbbb', 'searchTerm' => 'ccccc'); $mashableInboxForm = new MashableInboxForm(); $mashableInboxForm->setAttributes($testData); $key = MashableUtil::resolveKeyByModuleAndModel('MashableInboxModule', 'testClassName'); MashableUtil::saveSelectedOptionsAsStickyData($mashableInboxForm, 'testClassName'); $this->assertEquals($testData, StickyUtil::getDataByKey($key)); $testData2 = array('optionForModel' => 'aaaaa', 'filteredBy' => 'bbbbb', 'searchTerm' => 'ccccc', 'selectedIds' => 'ddddd', 'massAction' => 'eeeee'); $mashableInboxForm = new MashableInboxForm(); $mashableInboxForm->setAttributes($testData); StickyUtil::clearDataByKey($key); MashableUtil::saveSelectedOptionsAsStickyData($mashableInboxForm, 'testClassName'); $this->assertEquals($testData, StickyUtil::getDataByKey($key)); }
public static function saveSelectedOptionsAsStickyData(MashableInboxForm $mashableInboxForm, $modelClassName) { assert('strlen($modelClassName) > 0 || ($modelClassName === null)'); $key = self::resolveKeyByModuleAndModel('MashableInboxModule', $modelClassName); StickyUtil::setDataByKeyAndData($key, $mashableInboxForm->getAttributes(array('optionForModel', 'filteredBy', 'searchTerm'))); }