Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertIntegrationTokensPopup.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Integration\Test\Page\Adminhtml\IntegrationIndex;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 
15 class AssertIntegrationTokensPopup extends AbstractConstraint
16 {
17  /* tags */
18  const SEVERITY = 'high';
19  /* end tags */
20 
26  protected $fields = [
27  'key',
28  'consumer_secret',
29  'token',
30  'token_secret',
31  ];
32 
45  public function processAssert(IntegrationIndex $integrationIndex)
46  {
47  $errors = [];
48  $tokensData = $integrationIndex->getIntegrationGrid()->getTokensPopup()->getData();
49  $tokensKeys = array_keys($tokensData);
50  $diff = array_diff($this->fields, $tokensKeys);
51  if (!empty($diff)) {
52  $errors[] = 'Field(s) "' . implode(', ', $diff) . '" is absent in integration tokens.';
53  }
54  foreach ($tokensData as $key => $value) {
55  if (empty($value)) {
56  $errors[] = 'Field with key: ' . $key . '" is empty in integration tokens.';
57  }
58  }
59  \PHPUnit\Framework\Assert::assertEmpty(
60  $errors,
61  "Integration tokens is not correct.\nLog:\n" . implode(";\n", $errors)
62  );
63  $integrationIndex->getIntegrationGrid()->getTokensPopup()->clickDoneButton();
64  }
65 
71  public function toString()
72  {
73  return 'Tokens is shown and not empty.';
74  }
75 }
$value
Definition: gender.phtml:16
$errors
Definition: overview.phtml:9