Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FetchRatesTest.php
Go to the documentation of this file.
1 <?php
8 
13 {
19  public function testFetchRatesActionWithoutService(): void
20  {
21  $request = $this->getRequest();
22  $request->setParam(
23  'rate_services',
24  null
25  );
26  $this->dispatch('backend/admin/system_currency/fetchRates');
27 
28  $this->assertSessionMessages(
29  $this->contains('The Import Service is incorrect. Verify the service and try again.'),
30  \Magento\Framework\Message\MessageInterface::TYPE_ERROR
31  );
32  }
33 
40  {
41  $request = $this->getRequest();
42  $request->setParam(
43  'rate_services',
44  'non-existent-service'
45  );
46  $this->dispatch('backend/admin/system_currency/fetchRates');
47 
48  $this->assertSessionMessages(
49  $this->contains("The import model can't be initialized. Verify the model and try again."),
50  \Magento\Framework\Message\MessageInterface::TYPE_ERROR
51  );
52  }
53 }
dispatch(\Magento\Framework\App\RequestInterface $request)
assertSessionMessages(\PHPUnit\Framework\Constraint\Constraint $constraint, $messageType=null, $messageManagerClass=\Magento\Framework\Message\Manager::class)