/** * @test */ public function shouldFailToEditUserWhenNoDataIsSupplied() { $this->setExpectedException(NothingToModifyException::class); $handler = HandlerStack::create(); $this->client = ProvisioningClientCreator::createProvisioningClient($handler); $editUserCommand = new EditUser('username'); $this->client->editUser($editUserCommand); }
/** * @test */ public function shouldFailToGetUserWhenInvalidDataIsSupplied() { $mock = new MockHandler([new Response(200, [], '<?xml version="1.0"?><ocs><meta><statuscode>101</statuscode><status>ok</status></meta></ocs>')]); $handler = HandlerStack::create($mock); $this->client = ProvisioningClientCreator::createProvisioningClient($handler); $findGroupOfUser = new FindGroupsOfUser('frank'); $findUsersResult = $this->client->findGroupOfUsers($findGroupOfUser); $this->assertEquals(101, $findUsersResult->statusCode); }
/** * @test */ public function shouldFailToGetUserWhenInvalidDataIsSupplied() { $mock = new MockHandler([new Response(200, [], '<?xml version="1.0"?><ocs><meta><statuscode>101</statuscode><status>ok</status></meta></ocs>')]); $handler = HandlerStack::create($mock); $this->client = ProvisioningClientCreator::createProvisioningClient($handler); $getUserCommand = new FindUser('username'); /** @var User $getUserResult */ $getUserResult = $this->client->findUser($getUserCommand); $this->assertInstanceOf(User::class, $getUserResult); $this->assertEquals(101, $getUserResult->statusCode); }