Score:1

How can I use Url::fromRoute() in a test?

cc flag

If I crate the class for test like:

class ReturnHandlerTest extends OrderKernelTestBase {

  protected static $modules = [
    'commerce_payment',
    'commerce_payment_example',
  ];

  protected function setUp(): void {
    parent::setUp();
  }

}

And if I want to use

 Url::fromRoute('commerce_payment.checkout.return', $arguments)
   ->setOptions(['absolute' => true])
   ->toString()

In the test, I get this exception.

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "commerce_payment.checkout.return" does not exist.

What should I do?

Score:1
cc flag

I should include the module "commerce_checkout".

 protected static $modules = [
    'commerce_payment',
    'commerce_payment_example',
    'commerce_checkout',
  ];
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.