This repository was archived by the owner on Feb 7, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 162
237 serializer test #308
Merged
mesilov
merged 23 commits into
mesilov:306-beta-1
from
KarlsonComplete:237-serializer-test
Oct 31, 2022
Merged
237 serializer test #308
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
0e685c3
-test serializer
KarlsonComplete 76d68d7
-add test serialize and deserialize
ef264a9
-add test normalize
2f5b094
-edit PersonTest.php
179a2ac
-add custom Normalizer(not work)
cce3d06
-edit MixedTest.php
4feb8b4
-update test
ea30810
-edit normalizer(but I don't understand how to use it)
568a508
-add money result in AbstactCrmItem (not work)
385de8e
-add money result in AbstactCrmItem (work?)
67b0b48
-edit money result in AbstactCrmItem (work?)
ea84841
-edit test
53b855f
-add method getSuperSmart for DealProductRows.php method 2in1(crm.dea…
fdcbb21
-теперь в классе AbstarctCrmItem можно обращаться к currency, добился…
22c4e70
-add method getSuperSuperSmart
e42100f
-add method getSuperSuperSmart
e1037c9
- edit composer.json (-delete symfony routing)
3c45698
- removed unnecessary files
5b837e4
- edit method
ba6fbe8
- delete serializer in composer.json and its dependencies
c496fd7
- merging master in 237-serializer-test
a05285e
- fix error phpstan
c75b49e
- поправил работу метода get в объекте DealProductRowItemsResult.php …
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,10 @@ | |
use Bitrix24\SDK\Services\CRM\Deal\Service\Deal; | ||
use Bitrix24\SDK\Services\CRM\Deal\Service\DealProductRows; | ||
use Bitrix24\SDK\Tests\Integration\Fabric; | ||
use Money\Currencies\ISOCurrencies; | ||
use Money\Currency; | ||
use Money\Formatter\DecimalMoneyFormatter; | ||
use Money\Money; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Причеши тесты, оставь тест на get( с двумя вариантами:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @KarlsonComplete а сейчас? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ну тесты я делаю не очень , надеюсь готово) |
||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
|
@@ -28,46 +32,67 @@ class DealProductRowsTest extends TestCase | |
*/ | ||
public function testSet(): void | ||
{ | ||
|
||
$callCosts = new Money(1050, new Currency('USD')); | ||
$currencies = new ISOCurrencies(); | ||
|
||
$moneyFormatter = new DecimalMoneyFormatter($currencies); | ||
$newDealId = $this->dealService->add(['TITLE' => 'test deal'])->getId(); | ||
$this::assertCount(0, $this->dealProductRowsService->get($newDealId)->getProductRows()); | ||
$this::assertCount(5, $this->dealProductRowsService->get($newDealId)->getProductRows()); | ||
$this::assertTrue( | ||
$this->dealProductRowsService->set( | ||
$newDealId, | ||
[ | ||
[ | ||
'PRODUCT_NAME' => 'qqqq', | ||
'PRODUCT_NAME' => 'wine', | ||
'PRICE' => $moneyFormatter->format($callCosts), | ||
], | ||
] | ||
)->isSuccess() | ||
); | ||
$this::assertCount(1, $this->dealProductRowsService->get($newDealId)->getProductRows()); | ||
|
||
|
||
} | ||
|
||
/** | ||
* @throws BaseException | ||
* @throws TransportException | ||
* @covers \Bitrix24\SDK\Services\CRM\Deal\Service\DealProductRows::get | ||
*/ | ||
public function testGet(): void | ||
{ | ||
$newDealId = $this->dealService->add(['TITLE' => 'test deal'])->getId(); | ||
$this::assertCount(0, $this->dealProductRowsService->get($newDealId)->getProductRows()); | ||
$callCosts = new Money(1050, new Currency('USD')); | ||
$currencies = new ISOCurrencies(); | ||
|
||
$moneyFormatter = new DecimalMoneyFormatter($currencies); | ||
$newDealId = $this->dealService->add(['TITLE' => 'test deal', 'CURRENCY_ID' => $callCosts->getCurrency()->getCode()])->getId(); | ||
$this::assertTrue( | ||
$this->dealProductRowsService->set( | ||
$newDealId, | ||
[ | ||
[ | ||
'PRODUCT_NAME' => 'qqqq', | ||
'PRODUCT_NAME' => 'wine', | ||
'PRICE' => $moneyFormatter->format($callCosts), | ||
], | ||
] | ||
)->isSuccess() | ||
); | ||
$this::assertCount(1, $this->dealProductRowsService->get($newDealId)->getProductRows()); | ||
$currency = $callCosts->getCurrency(); | ||
|
||
$resultWithoutAvailableCurrency = $this->dealProductRowsService->get($newDealId); | ||
$resultWithAvailableCurrency = $this->dealProductRowsService->get($newDealId, $currency); | ||
foreach ($resultWithoutAvailableCurrency->getProductRows() as $productRow) { | ||
$this::assertEquals($callCosts, $productRow->PRICE); | ||
} | ||
foreach ($resultWithAvailableCurrency->getProductRows() as $productRow) { | ||
$this::assertEquals($callCosts, $productRow->PRICE); | ||
} | ||
} | ||
|
||
public function setUp(): void | ||
{ | ||
$this->dealService = Fabric::getServiceBuilder()->getCRMScope()->deal(); | ||
$this->dealProductRowsService = Fabric::getServiceBuilder()->getCRMScope()->dealProductRows(); | ||
$this->core = Fabric::getCore(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Добавь остальные поля
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KarlsonComplete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
готово