swist's avatar
Level 11

Can I attach a parameter to the test class (globally)

Hi,

I have couple test classes, I am wondering can I somehow attach to every get methods a parameter to the class - f.ex. in constructor.

I use $this->get($url)->assertSee('blabla'); can I put in constructor a modification that every such request will be sent with ['foo'=>'bar'] ?

0 likes
1 reply
Borisu's avatar
Borisu
Best Answer
Level 37

Just create a method in your Test Class:

// in TestCase.php
public function getCustom($url)
{
    return $this->get($url, ['foo' => 'bar']);
}
2 likes

Please or to participate in this conversation.