Skip to content

Request setGlobal not works #3186

Description

@luispastendev

I am trying to perform a test where I pass some data via post, but when using the setGlobal function it does not enter the data to the request, it has tried to debug with $request->getBody() and indeed it does not return anything to me

public function testStoreInvalidData(){
        helper('text');
        $request = Services::request();
        $request->setMethod('post');
	$request->setGlobal('post',[
            'concept' => 'testcoupon',
            'type' => 'FS',
            'code' => random_string('alnum', 8),
            'amount' => random_string('numeric',3),
            'usage_limit' => 99999,
            'expiration' => date('Y-m-d H:i:s')
        ]);

	$result = $this->withRequest($request)
         		    ->controller(Coupons::class)
                            ->execute('store');

        $this->assertEquals(400, $result->response()->getStatusCode());
}

the test should fail because all the data is correct.

greetings!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions