Skip to content

Commit

Permalink
Обнови структуру контекста
Browse files Browse the repository at this point in the history
  • Loading branch information
denismosolov committed Oct 9, 2020
1 parent 996cae8 commit 8962cc9
Showing 1 changed file with 23 additions and 25 deletions.
48 changes: 23 additions & 25 deletions tests/Reply/OrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ final class OrderTest extends TestCase

private function assertOrderContext(array $result): void
{
$this->assertContains('order', $result['session_state']['context']);
$this->assertArrayHasKey('order', $result['session_state']['context']);
$this->assertIsArray($result['session_state']['context']['order']);
$this->assertContains('operation', $result['session_state']['context']['order']);
$this->assertContains('type', $result['session_state']['context']['order']);
$this->assertArrayHasKey('operation', $result['session_state']['context']['order']);
$this->assertArrayHasKey('type', $result['session_state']['context']['order']);
// @todo: add market
}

Expand Down Expand Up @@ -155,8 +155,8 @@ public function testBuy1LotUSDRUBConfirmation(): void
$this->assertStructure($result);
$this->assertOrderContext($result);

$this->assertStringContainsStringIgnoringCase('покупка', $result['response']['text']);
$this->assertStringNotContainsStringIgnoringCase('продажа', $result['response']['text']);
$this->assertStringContainsStringIgnoringCase('покупку', $result['response']['text']);
$this->assertStringNotContainsStringIgnoringCase('продажу', $result['response']['text']);
$this->assertStringContainsStringIgnoringCase('доллар сша', $result['response']['text']);
$this->assertStringContainsStringIgnoringCase('количество лотов', $result['response']['text']);
$this->assertStringContainsStringIgnoringCase('по рыночной цене', $result['response']['text']);
Expand Down Expand Up @@ -191,16 +191,15 @@ public function testBuy1LotUSDRUBOrder(): void
'session' => [
'text' => '',
'context' => [
'order',
'order' => [
'operation' => 'buy',
'figi' => self::FIGI_USDRUB,
'type' => 'currency',
'amount' => 1,
'unit' => 'lot',
'name' => 'Доллар США',
],
],
'order_details' => [
'operation' => 'buy',
'figi' => self::FIGI_USDRUB,
'type' => 'currency',
'amount' => 1,
'unit' => 'lot',
'name' => 'Доллар США',
]
],
'user' => []
],
Expand Down Expand Up @@ -311,8 +310,8 @@ public function testSell1LotUSDRUBConfirmation(): void
$result = $newOrder->handle($event);
$this->assertStructure($result);
$this->assertOrderContext($result);
$this->assertStringContainsStringIgnoringCase('продажа', $result['response']['text']);
$this->assertStringNotContainsStringIgnoringCase('покупка', $result['response']['text']);
$this->assertStringContainsStringIgnoringCase('продажу', $result['response']['text']);
$this->assertStringNotContainsStringIgnoringCase('покупку', $result['response']['text']);
$this->assertStringContainsStringIgnoringCase('доллар сша', $result['response']['text']);
$this->assertStringContainsStringIgnoringCase('количество лотов', $result['response']['text']);
$this->assertStringContainsStringIgnoringCase('по рыночной цене', $result['response']['text']);
Expand Down Expand Up @@ -347,16 +346,15 @@ public function testSell1LotUSDRUBOrder(): void
'session' => [
'text' => '',
'context' => [
'order',
'order' => [
'operation' => 'sell',
'figi' => self::FIGI_USDRUB,
'type' => 'currency',
'amount' => 1,
'unit' => 'lot',
'name' => 'Доллар США',
],
],
'order_details' => [
'operation' => 'sell',
'figi' => self::FIGI_USDRUB,
'type' => 'currency',
'amount' => 1,
'unit' => 'lot',
'name' => 'Доллар США',
]
],
'user' => []
],
Expand Down

0 comments on commit 8962cc9

Please sign in to comment.