/** * Test remove() and removeByEmail * * @dataProvider dataProviderRemove * * @param array $data DataProvider data * * @return void */ public function testRemove(array $data) { $baseUri = 'https://example.com/'; $accountType = new AccountType(); $accountType->email = $data['email']; $mockedClient = $this->getMock('\\Seafile\\Client\\Http\\Client', ['delete', 'getConfig']); $mockedClient->expects(self::any())->method('delete')->with($baseUri . 'accounts/' . $accountType->email . '/')->willReturn(new Response(200)); $mockedClient->expects(self::any())->method('getConfig')->with('base_uri')->willReturn($baseUri); /** * @var Client $mockedClient */ $accountResource = new Account($mockedClient); self::assertSame($data['result'], $accountResource->remove($accountType)); // test removeByEmail() in one go self::assertSame($data['result'], $accountResource->removeByEmail($accountType->email)); }
} } else { $logger->log(Logger::ALERT, 'Could not create account ' . $newAccountType->email); } $logger->log(Logger::INFO, "#################### Update account"); $changedAccountType = (new AccountType())->fromArray(['email' => $newAccountType->email, 'name' => 'Divine Hugh Jazz']); $result = $accountResource->update($changedAccountType); if ($success) { $logger->log(Logger::INFO, "#################### Account updated"); } else { $logger->log(Logger::ALERT, '#################### Could not update account'); } $logger->log(Logger::INFO, "#################### Sleeping 10s before deleting the account... zzzzzz...."); sleep(10); $logger->log(Logger::INFO, "#################### Delete account " . $newAccountType->email); $success = $accountResource->remove($newAccountType); if ($success) { $logger->log(Logger::INFO, "#################### Deleted account " . $newAccountType->email); } else { $logger->log(Logger::ALERT, "#################### Could not delete account " . $newAccountType->email); } // //$logger->log(Logger::INFO, "#################### Migrating test@example.com to test1@example.com"); // //$fromAccount = (new AccountType)->fromArray([ // 'email' => '*****@*****.**' //]); // //$toAccount = (new AccountType)->fromArray([ // 'email' => '*****@*****.**' //]);