Exemplo n.º 1
0
 /**
  * @group           DataModel
  * @group           DataModelAddBehaviour
  * @covers          FOF30\Model\DataModel::addBehaviour
  * @dataProvider    DataModelGenericDataprovider::getTestAddBehaviour
  */
 public function testAddBehaviour($test, $check)
 {
     $msg = 'DataModel::addBehaviour %s - Case: ' . $check['case'];
     $config = array('idFieldName' => 'foftest_bare_id', 'tableName' => '#__foftest_bares');
     $model = new DataModelStub(static::$container, $config);
     $result = $model->addBehaviour($test['class']);
     $dispatcher = $model->getBehavioursDispatcher();
     $attached = $dispatcher->hasObserverClass($check['class']);
     $this->assertInstanceOf('\\FOF30\\Model\\DataModel', $result, sprintf($msg, 'Should return and instance of itself'));
     $this->assertEquals($check['attached'], $attached, sprintf($msg, 'Failed to properly attach the behaviour'));
 }