0
これは私の方法GuzzleHttp Clientクラスのオブジェクトを文字列に変換できなかった理由を教えてください。
class MyClass
{
protected client;
public function setCl($clientArg)
{
// check for invalid argument type - client has to be a guzzle client
if ($clientArg.get_class() != $this->client.get_class() ||
!($clientArg instanceof GuzzleHttp\Client))
throw new InvalidArgumentException("Argument type must be of Guzzle client");
$this->client = $clientArg;
}
}
あるテストは、次のような、このメソッドを呼び出した:
class TestClass extends \PHPUnit_Framework_TestCase
{
protected $myClass
public function testSetCl() {
$cl = new Client();
$res = $this->myClass->setCl($cl); // why does a setter need to return something?
$this->assertInstanceOf(Client::class, $res);
}
}
タイトルで掲載エラーは、私がテストを実行したときに、私が受け取るものです。どうして? PHPで
$clientArg.get_class() != $this->client.get_class()
、:これが発生