Example #1
0
 /**
  * Test JViewLegacy::getModel()
  *
  * @since   11.3
  *
  * @return  void
  */
 public function testGetModel()
 {
     // Prepare variable to compare against and a bunch of models
     $models = array();
     $model1 = new ModelMockupJView();
     $models['model'] = $model1;
     $model2 = new ModelMockupJView();
     $model2->name = 'test';
     $models['test'] = $model2;
     $model3 = new ModelMockupJView();
     $model3->name = 'defaulttest';
     $models['defaulttest'] = $model3;
     // Prepare JView object
     TestReflection::setValue($this->class, '_models', $models);
     TestReflection::setValue($this->class, '_defaultModel', 'defaulttest');
     // Assert that the function returns the model with the specific key
     $this->assertThat($this->class->getModel('test'), $this->equalTo($model2));
     // Assert that the function returns the model with an unspecific key
     $this->assertThat($this->class->getModel('Model'), $this->equalTo($model1));
     // Assert that the function returns the default model
     $this->assertThat($this->class->getModel(), $this->equalTo($model3));
 }