-
Notifications
You must be signed in to change notification settings - Fork 252
Expand file tree
/
Copy pathOrderAdminActivityTest.php
More file actions
70 lines (60 loc) · 1.68 KB
/
OrderAdminActivityTest.php
File metadata and controls
70 lines (60 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
namespace Drupal\Tests\commerce_log\Functional;
use Drupal\Tests\commerce\Functional\CommerceBrowserTestBase;
/**
* Tests the order activity on order admin view.
*
* @group commerce
*/
class OrderAdminActivityTest extends CommerceBrowserTestBase {
/**
* The order to test against.
*
* @var \Drupal\commerce_order\Entity\OrderInterface
*/
protected $order;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = [
'commerce_order',
'commerce_log',
];
/**
* {@inheritdoc}
*/
protected function getAdministratorPermissions() {
return array_merge([
'administer commerce_order',
], parent::getAdministratorPermissions());
}
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
/** @var \Drupal\commerce_order\Entity\OrderInterface $order */
$this->order = $this->createEntity('commerce_order', [
'type' => 'default',
'mail' => $this->loggedInUser->getEmail(),
'uid' => $this->loggedInUser->id(),
'store_id' => $this->store,
]);
}
/**
* Tests order activity on Order admin view.
*/
public function testOrderAdminActivity() {
$this->drupalGet($this->order->toUrl());
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains(t('Order activity'));
$transition = $this->order->getState()->getTransitions();
$this->order->getState()->applyTransition($transition['cancel']);
$this->order->save();
$this->drupalGet($this->order->toUrl());
$this->assertSession()->pageTextContains(t('Order activity'));
$this->assertSession()->pageTextContains(t('The order was canceled.'));
}
}