コード例 #1
0
 function it_gets_random_ids_for_supplied_entities(TableFetcher $tableFetcher, TableHelper $tableHelper)
 {
     $entities = ['sites', 'products', 'images'];
     $idEntities = ['sites', 'products'];
     $columns = ['site_id', 'product_id'];
     $table = 'image_product_site';
     $result = [1, 2];
     $tableFetcher->getRandomColumnEntries($table, $columns)->shouldBeCalled()->willReturn($result);
     $tableHelper->getTable($entities)->shouldBeCalled()->willReturn($table);
     $tableHelper->getIdColumnNames($entities, $idEntities)->willReturn($columns);
     $this->getRandomIds($entities, $idEntities)->shouldReturn($result);
 }
コード例 #2
0
ファイル: Relational.php プロジェクト: larapackage/api
 /**
  * @inheritdoc
  */
 public function table()
 {
     return $this->tableHelper->getTable($this->entities());
 }
コード例 #3
0
ファイル: RelationalSpec.php プロジェクト: larapackage/api
 function it_returns_an_item_name(Request $request, Parser $parser, TableHelper $tableHelper)
 {
     $uri = '/sites/1/products/2/images/1,4,5';
     $entities = ['sites', 'products', 'images'];
     $rawItem = 'images';
     $expected = 'Image';
     $request->getRequestUri()->shouldBeCalled()->willReturn($uri);
     $parser->entities($uri)->shouldBeCalled()->willReturn($entities);
     $tableHelper->singularize($rawItem)->shouldBeCalled()->willReturn($expected);
     $this->itemName()->shouldReturn($expected);
 }