コード例 #1
0
 function it_applies_a_sort_on_in_group_products(ProductDatasource $datasource, ProductQueryBuilderInterface $pqb, $params)
 {
     $datasource->getProductQueryBuilder()->willReturn($pqb);
     $params->get('currentGroup', null)->willReturn(12);
     $pqb->addSorter('in_group_12', 'ASC')->shouldBeCalled();
     $this->apply($datasource, 'in_group', 'ASC');
 }
コード例 #2
0
 function it_applies_a_sort_on_product_completeness(ProductDatasource $datasource, $repository, ProductQueryBuilderInterface $pqb, QueryBuilder $qb)
 {
     $datasource->getQueryBuilder()->willReturn($qb);
     $repository->getProductQueryBuilder($qb)->willReturn($pqb);
     $pqb->addFieldSorter('completeness', 'ASC')->shouldBeCalled();
     $this->apply($datasource, 'completeness', 'ASC');
 }
コード例 #3
0
 function it_applies_a_sort_on_product_sku(ProductDatasource $datasource, $repository, ProductQueryBuilderInterface $pqb, QueryBuilder $qb, CustomAttributeRepository $attributeRepository, AbstractAttribute $sku)
 {
     // TODO : how to mock the following magic method ?
     $attributeRepository->findOneByCode('sku')->willReturn($sku);
     $sku->getCode()->willReturn('sku');
     $sku->__toString()->willReturn('sku');
     $datasource->getQueryBuilder()->willReturn($qb);
     $repository->getProductQueryBuilder($qb)->willReturn($pqb);
     $pqb->addAttributeSorter($sku, 'ASC')->shouldBeCalled();
     $this->apply($datasource, $sku, 'ASC');
 }
コード例 #4
0
 function it_applies_a_sort_on_product_family(ProductDatasource $datasource, ProductQueryBuilderInterface $pqb)
 {
     $datasource->getProductQueryBuilder()->willReturn($pqb);
     $pqb->addSorter('family', 'ASC')->shouldBeCalled();
     $this->apply($datasource, 'family', 'ASC');
 }