<commit_before><?php

namespace Locastic\Test;


use Locastic\Handler\ProductHandler;
use Locastic\Helpers\ApiData;
use Locastic\Reader\XmlReader;
use Locastic\Settings\ApiSettings;
use Locastic\Settings\CurlSettings;

class ProductsTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var ProductHandler
     */
    protected $productXmlHandler;

    public function testProductsListValidOutputXml()
    {
        /**
         * @var ApiData
         */
        $apiData = $this->productXmlHandler->getProductsCategories();

        $this->assertEquals(200, $apiData->getApiResponse()->getStatusCode());
        $this->assertInstanceOf('SimpleXMLElement', $apiData->getData());

    }

    public function testProductListDataStructure()
    {
        /**
         * @var ApiData
         */
        $apiData = $this->productXmlHandler->getProductsList(array('ProductType' => 'Procesor'));

        $this->assertObjectHasAttribute('ProductCode', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('ProductName', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('ProductType', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('Brand', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('Model', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('PartNo', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('Warranty', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('PackageWeight', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('PackageDimensionLength', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('PackageDimensionWidth', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('PackageDimensionHeight', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('TechnicalDescription', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('MarketingDescription', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('ProductImageurl', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('IsComputerComponent', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('ChangeDateTime', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('BrojPovratnihNaknada', $apiData->getData()->Table[0]);
    }

    public function testProductCategoriesDataStructure()
    {
        /**
         * @var ApiData
         */
        $apiData = $this->productXmlHandler->getProductsCategories();


        $this->assertObjectHasAttribute('CategoryID', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('CategoryName', $apiData->getData()->Table[0]);
    }

    protected function setUp()
    {
        $this->productXmlHandler = new ProductHandler(new CurlSettings(), new ApiSettings(), new XmlReader());<commit_msg>Code clean<commit_after><?php

namespace Locastic\Test;


use Locastic\Handler\ProductHandler;
use Locastic\Helpers\ApiData;
use Locastic\Reader\XmlReader;
use Locastic\Settings\ApiSettings;
use Locastic\Settings\CurlSettings;

class ProductsTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var ProductHandler
     */
    protected $productXmlHandler;

    public function testProductsListValidOutputXml()
    {
        /**
         * @var ApiData
         */
        $apiData = $this->productXmlHandler->getProductsCategories();

        $this->assertEquals(200, $apiData->getApiResponse()->getStatusCode());
        $this->assertInstanceOf('SimpleXMLElement', $apiData->getData());

    }

    public function testProductListDataStructure()
    {
        /**
         * @var ApiData
         */
        $apiData = $this->productXmlHandler->getProductsList(array('ProductType' => 'Procesor'));

        $this->assertObjectHasAttribute('ProductCode', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('ProductName', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('ProductType', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('Brand', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('Model', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('PartNo', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('Warranty', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('PackageWeight', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('PackageDimensionLength', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('PackageDimensionWidth', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('PackageDimensionHeight', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('TechnicalDescription', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('MarketingDescription', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('ProductImageurl', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('IsComputerComponent', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('ChangeDateTime', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('BrojPovratnihNaknada', $apiData->getData()->Table[0]);
    }

    public function testProductCategoriesDataStructure()
    {
        /**
         * @var ApiData
         */
        $apiData = $this->productXmlHandler->getProductsCategories();

        $this->assertObjectHasAttribute('CategoryID', $apiData->getData()->Table[0]);
        $this->assertObjectHasAttribute('CategoryName', $apiData->getData()->Table[0]);
    }

    protected function setUp()
    {
        $this->productXmlHandler = new ProductHandler(new CurlSettings(), new ApiSettings(), new XmlReader());
{'fraction_non_alphanumeric': 0.16689189189189188, 'fraction_numerical': 0.007432432432432433, 'mean_word_length': 4.263111111111111, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 143, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6627087', 'n_tokens_mistral': 1613, 'n_tokens_neox': 1625, 'n_words': 192}