I'm trying to understand the Unit Testing for Magento2.

public function getPostUrl()
    $ticketId = $this->getRequest()->getParam('ticket_id');
    $params   = ['ticket_id' => $ticketId];

    $url = $this->backendUrl->getUrl(self::QUOTE_MERGE_URL, $params);

    return $url;

Now i want to write a Unit Test for this code. But i have no clue how to proceed.

I have a unit test for

public function getTest()
    return 'Test';

and in the test page:

public function testGetTest()
    $this->assertEquals('Test', $this->block->getTest());

This works.

But how do i check the post url if that is how i expect?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.