/** * test success() method * * @test */ public function success() { $this->generateComponent(); $this->Api->success(); $this->assertSame(['success' => true, 'code' => 200], $this->Api->getResponse()); // with data $this->generateComponent(); $this->Api->success(['user' => ['id' => 1]]); $this->assertSame(['success' => true, 'code' => 200, 'data' => ['user' => ['id' => 1]]], $this->Api->getResponse()); }