public function testSetAndGetMetadata()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $user = UserTestHelper::createBasicUser('Billy');
     $opportunity = new Opportunity();
     $view = new OpportunityEditAndDetailsView('Details', 'whatever', 'whatever', $opportunity);
     $originalMetadata = OpportunityEditAndDetailsView::getMetadata($user);
     $metadataIn = $originalMetadata;
     $metadataIn['perUser']['junk1'] = 'stuff1';
     $metadataIn['global']['junk2'] = 'stuff2';
     $view->setMetadata($metadataIn, $user);
     $metadataOut = OpportunityEditAndDetailsView::getMetadata($user);
     $this->assertNotEquals($originalMetadata, $metadataOut);
     $this->assertEquals($metadataIn, $metadataOut);
 }
 public function __construct($viewData, $params, $uniqueLayoutId)
 {
     assert('isset($params["controllerId"])');
     assert('isset($params["relationModuleId"])');
     assert('$params["relationModel"] instanceof RedBeanModel || $params["relationModel"] instanceof ModelForm');
     assert('isset($params["portletId"])');
     assert('isset($params["redirectUrl"])');
     $this->modelClassName = $this->getModelClassName();
     $this->viewData = $viewData;
     $this->params = $params;
     $this->uniqueLayoutId = $uniqueLayoutId;
     $this->gridIdSuffix = $uniqueLayoutId;
     $this->rowsAreSelectable = false;
     $this->gridId = 'list-view';
     $this->controllerId = $this->resolveControllerId();
     $this->moduleId = $this->resolveModuleId();
     parent::__construct('Details', $this->controllerId, $this->moduleId, $params["relationModel"]);
 }
 /**
  * Override to add a starring link to the title
  * @return string
  */
 public function getTitle()
 {
     $starLink = StarredUtil::getToggleStarStatusLink($this->model, null);
     return parent::getTitle() . $starLink;
 }