Beispiel #1
0
 /**
  * @group           DataModel
  * @group           CollectionCall
  * @covers          FOF30\Model\DataModel\Collection::__call
  * @dataProvider    CollectionDataprovider::getTest__call
  */
 public function test__call($test, $check)
 {
     $checkCall = null;
     $items = array();
     $msg = 'Collection::__call %s - Case: ' . $check['case'];
     $config = array('idFieldName' => 'foftest_bare_id', 'tableName' => '#__foftest_bares');
     if ($test['load']) {
         $model = $this->getMock('\\FOF30\\Tests\\Stubs\\Model\\DataModelStub', array('getState'), array(static::$container, $config));
         $items = $model->getItemsArray(0, 1);
     }
     $collection = new Collection($items);
     switch ($test['arguments']) {
         case 0:
             $collection->dynamicCall();
             break;
         case 1:
             $collection->dynamicCall(1);
             break;
         case 2:
             $collection->dynamicCall(1, 1);
             break;
         case 3:
             $collection->dynamicCall(1, 1, 1);
             break;
         case 4:
             $collection->dynamicCall(1, 1, 1, 1);
             break;
         case 5:
             $collection->dynamicCall(1, 1, 1, 1, 1);
             break;
         case 6:
             $collection->dynamicCall(1, 1, 1, 1, 1, 1);
             break;
         case 7:
             $collection->dynamicCall(1, 1, 1, 1, 1, 1, 1);
             break;
     }
     if ($item = $collection->first()) {
         $checkCall = $item->dynamicCall;
     }
     $this->assertEquals($check['call'], $checkCall, sprintf($msg, 'Failed to correctly invoke DataModel methods'));
 }