Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 7b60c47

Browse files
committed
MAGETWO-62833: Integration test for Guarantee cancelation flow
1 parent 363d4b5 commit 7b60c47

File tree

1 file changed

+42
-4
lines changed

1 file changed

+42
-4
lines changed

Block/Adminhtml/CaseInfoTest.php

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ class CaseInfoTest extends \PHPUnit_Framework_TestCase
3131
*/
3232
private $layout;
3333

34+
/**
35+
* @var string
36+
*/
37+
private static $submitButton = 'Submit Guarantee Request';
38+
39+
/**
40+
* @var string
41+
*/
42+
private static $cancelButton = 'Cancel Guarantee Request';
43+
3444
/**
3545
* @inheritdoc
3646
*/
@@ -91,18 +101,21 @@ public function testCaseEntityExists()
91101
}
92102

93103
/**
94-
* Checks that guarantee action buttons is available on order page.
104+
* Checks state of Guarantee action buttons on order page.
95105
*
96106
* @covers \Magento\Signifyd\Block\Adminhtml\CaseInfo::getButtons
97107
* @magentoConfigFixture current_store fraud_protection/signifyd/active 1
98108
* @magentoDataFixture Magento/Signifyd/_files/case.php
99109
* @magentoAppArea adminhtml
100110
*/
101-
public function testButtonsAvailable()
111+
public function testSubmitButtonAvailable()
102112
{
103113
$this->order->loadByIncrementId('100000001');
104114

105-
static::assertContains('Submit Guarantee Request', $this->getBlockContents());
115+
$blockContents = $this->getBlockContents();
116+
117+
static::assertContains(self::$submitButton, $blockContents);
118+
static::assertNotContains(self::$cancelButton, $blockContents);
106119
}
107120

108121
/**
@@ -122,7 +135,32 @@ public function testButtonsUnavailable()
122135
$orderRepository = $this->objectManager->get(OrderRepository::class);
123136
$orderRepository->save($this->order);
124137

125-
static::assertNotContains('Submit Guarantee request', $this->getBlockContents());
138+
$blockContents = $this->getBlockContents();
139+
140+
static::assertNotContains(self::$submitButton, $blockContents);
141+
static::assertNotContains(self::$cancelButton, $blockContents);
142+
}
143+
144+
/**
145+
* Checks action buttons for case entity with Guarantee submitted.
146+
*
147+
* @covers \Magento\Signifyd\Block\Adminhtml\CaseInfo::getButtons
148+
* @magentoConfigFixture current_store fraud_protection/signifyd/active 1
149+
* @magentoDataFixture Magento/Signifyd/_files/approved_case.php
150+
* @magentoAppArea adminhtml
151+
*/
152+
public function testButtonsForApprovedCase()
153+
{
154+
$this->order->loadByIncrementId('100000001');
155+
156+
/** @var OrderRepository $orderRepository */
157+
$orderRepository = $this->objectManager->get(OrderRepository::class);
158+
$orderRepository->save($this->order);
159+
160+
$blockContents = $this->getBlockContents();
161+
162+
static::assertNotContains(self::$submitButton, $blockContents);
163+
static::assertContains(self::$cancelButton, $blockContents);
126164
}
127165

128166
/**

0 commit comments

Comments
 (0)