Result example


    public function getDailyVisitors(?DateTimeInterface $from = null, ?DateTimeInterface $to = null)
    {
        $builder = $this->createDailyVisitorsBuilder($from$to);

        $builder = $this->eventManager->filter('Shopware_Analytics_DailyVisitors', $builder[
            'subject' => $this,
        ]);

        return new Result(
            $builder,
            PDO::FETCH_GROUP | PDO::FETCH_ASSOC,
            false
        );
    }

    /** * Returns a dbal result object which displays the total visits of each * day for the passed date range. * If shop ids passed, the data result contains additionally for each shop id * a data result column like "visits1" for "visits" + shop id. * * The data array is indexed by the order date. To remove the useless array level * execute the following code: * $visitors = $repository->getDailyShopVisitors(... , ...); * $visitors = array_map('reset', $visitors->getData()); * * @param int[] $shopIds * * @return Result */
parent::setUp();

    $storage = $this->prophesize(View::class);
    $storage->label()->willReturn('ResultTest');
    $storage->set(Argument::cetera())->willReturn(NULL);

    $user = $this->prophesize(AccountInterface::class)->reveal();
    $views_data = $this->prophesize(ViewsData::class)->reveal();
    $route_provider = $this->prophesize(RouteProviderInterface::class)->reveal();
    $this->view = new ViewExecutable($storage->reveal()$user$views_data$route_provider);

    $this->resultHandler = new Result([], 'result', []);
    $this->resultHandler->view = $this->view;
  }

  /** * Tests the query method. */
  public function testQuery() {
    $this->assertNull($this->view->get_total_rows);
    // @total should set get_total_rows.     $this->resultHandler->options['content'] = '@total';
    $this->resultHandler->query();
    
Home | Imprint | This part of the site doesn't use cookies.