cleanup tests and use @covers more

This commit is contained in:
Dennis Eichhorn 2019-11-10 22:40:27 +01:00
parent 79c9ceef0f
commit ae02a0e4b3
2 changed files with 21 additions and 15 deletions

View File

@ -66,7 +66,9 @@ class Installer extends InstallerAbstract
$query = new Builder($con);
$query->insert('country_name', 'country_native', 'country_code2', 'country_code3', 'country_codenum')->into('country');
$countries = $query->select('*')->from('country')->execute();
$querySqlite = new Builder($sqlite);
$countries = $querySqlite->select('*')->from('country')->execute();
foreach ($countries as $country) {
$query->values(
$country['country_name'],
@ -97,7 +99,9 @@ class Installer extends InstallerAbstract
$query = new Builder($con);
$query->insert('language_name', 'language_native', 'language_639_2T', 'language_639_2B', 'language_639_3')->into('language');
$languages = $query->select('*')->from('language')->execute();
$querySqlite = new Builder($sqlite);
$languages = $querySqlite->select('*')->from('language')->execute();
foreach ($languages as $language) {
$query->values(
$language['language_name'],

View File

@ -430,21 +430,23 @@ final class ApiController extends Controller
*/
private function createProfileForAccount(Account $account, RequestAbstract $request) : void
{
if (((string) ($request->getData('password') ?? '')) !== ''
&& ((string) ($request->getData('login') ?? '')) !== ''
if (((string) ($request->getData('password') ?? '')) === ''
|| ((string) ($request->getData('login') ?? '')) === ''
) {
$old = clone $account;
$this->app->moduleManager->get('Profile')->apiProfileCreateDbEntry(
new \Modules\Profile\Models\Profile($account),
$request
);
$this->updateModel($request, $old, $account, function() use($account) : void {
$account->setLoginTries((int) $this->app->appSettings->get(Settings::LOGIN_TRIES));
AccountMapper::update($account);
}, 'account');
return;
}
$old = clone $account;
$this->app->moduleManager->get('Profile')->apiProfileCreateDbEntry(
new \Modules\Profile\Models\Profile($account),
$request
);
$this->updateModel($request, $old, $account, function() use($account) : void {
$account->setLoginTries((int) $this->app->appSettings->get(Settings::LOGIN_TRIES));
AccountMapper::update($account);
}, 'account');
}
/**