<?php

namespace KupShop\HeurekaCartBundle\Tests;

use KupShop\HeurekaCartBundle\Util\HeurekaUtil;

class HeurekaUtilTest extends \DatabaseTestCase
{
    /**
     * @dataProvider dataSet_testURLGeneration
     */
    public function testURLGeneration(int $orderId, string $requestUrl): void
    {
        $heurekaUtil = $this->get(HeurekaUtil::class);
        $order = new \Order($orderId);
        $apiUtilDropship = $heurekaUtil->getHeurekaAPIUtil($order);

        $this->assertEquals($requestUrl, $apiUtilDropship->getRequestUrl());
    }

    public function dataSet_testURLGeneration(): array
    {
        return [
            [1, 'https://api.heureka.cz/cart/validate/1/'],
            [2, 'https://api.heureka.sk/cart/validate/1/'],
            [3, 'https://ssl.heureka.cz/api/cart/wpj_test_key/1/'],
            [4, 'https://ssl.heureka.sk/api/cart/wpj_test_key/1/'],
        ];
    }

    public function getDataSet()
    {
        return $this->getJsonDataSetFromFile('HeurekaCartTest.json');
    }
}
