forked from GNUsocial/gnu-social
[TESTS][Forms] Respect new naming conventions
This commit is contained in:
parent
9067bd8785
commit
aa8412f607
@ -38,15 +38,15 @@ class AdminTest extends GNUsocialTestCase
|
||||
$value = $get_value();
|
||||
$client->request('GET', '/panel');
|
||||
$crawler = $client->submitForm('Set site setting', [
|
||||
'save[setting]' => implode(':', $setting),
|
||||
'save_admin[setting]' => implode(':', $setting),
|
||||
// False gets converted to "", which HTTP doesn't send, so we get null on the other side
|
||||
'save[value]' => $value == false ? 'fAlse' : Formatting::toString($value),
|
||||
'save_admin[value]' => $value == false ? 'false' : Formatting::toString($value),
|
||||
]);
|
||||
static::assertSame($value, Common::config(...$setting));
|
||||
// $client->request('GET', '/panel');
|
||||
$crawler = $client->submitForm('Set site setting', [
|
||||
'save[setting]' => implode(':', $setting),
|
||||
'save[value]' => Formatting::toString($old),
|
||||
'save_admin[setting]' => implode(':', $setting),
|
||||
'save_admin[value]' => Formatting::toString($old),
|
||||
]);
|
||||
static::assertSame($old, Common::config(...$setting));
|
||||
rename(INSTALLDIR . '/social.local.yaml.back', INSTALLDIR . '/social.local.yaml');
|
||||
@ -83,8 +83,8 @@ class AdminTest extends GNUsocialTestCase
|
||||
$client->request('GET', '/panel');
|
||||
$this->assertThrows(\InvalidArgumentException::class,
|
||||
fn () => $client->submitForm('Set site setting', [
|
||||
'save[setting]' => 'invalid:section',
|
||||
'save[value]' => 'false',
|
||||
'save_admin[setting]' => 'invalid:section',
|
||||
'save_admin[value]' => 'false',
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
@ -43,12 +43,12 @@ class UserPanelTest extends GNUsocialTestCase
|
||||
$client->request('GET', '/settings');
|
||||
$this->assertResponseIsSuccessful();
|
||||
$crawler = $client->submitForm('Save personal info', [
|
||||
'save[nickname]' => 'form_test_user_new_nickname',
|
||||
'save[full_name]' => 'Form User',
|
||||
'save[homepage]' => 'https://gnu.org',
|
||||
'save[bio]' => 'I was born at a very young age',
|
||||
'save[location]' => 'right here',
|
||||
'save[self_tags]' => 'foo bar',
|
||||
'save_personal_info[nickname]' => 'form_test_user_new_nickname',
|
||||
'save_personal_info[full_name]' => 'Form User',
|
||||
'save_personal_info[homepage]' => 'https://gnu.org',
|
||||
'save_personal_info[bio]' => 'I was born at a very young age',
|
||||
'save_personal_info[location]' => 'right here',
|
||||
'save_personal_info[self_tags]' => 'foo bar',
|
||||
]);
|
||||
$changed_user = DB::findOneBy('local_user', ['id' => $user->getId()]);
|
||||
$actor = $changed_user->getActor();
|
||||
@ -76,13 +76,13 @@ class UserPanelTest extends GNUsocialTestCase
|
||||
$client->request('GET', '/settings');
|
||||
$this->assertResponseIsSuccessful();
|
||||
$crawler = $client->submitForm('Save account info', [
|
||||
'save[outgoing_email]' => 'outgoing@provider',
|
||||
'save[incoming_email]' => 'incoming@provider',
|
||||
'save[old_password]' => 'some password',
|
||||
'save[password][first]' => 'this is some test password',
|
||||
'save[password][second]' => 'this is some test password',
|
||||
'save[language]' => 'pt',
|
||||
'save[phone_number]' => '+351908555842', // from fakenumber.net
|
||||
'save_account_info[outgoing_email]' => 'outgoing@provider',
|
||||
'save_account_info[incoming_email]' => 'incoming@provider',
|
||||
'save_account_info[old_password]' => 'some password',
|
||||
'save_account_info[password][first]' => 'this is some test password',
|
||||
'save_account_info[password][second]' => 'this is some test password',
|
||||
'save_account_info[language]' => 'pt',
|
||||
'save_account_info[phone_number]' => '+351908555842', // from fakenumber.net
|
||||
]);
|
||||
|
||||
$changed_user = DB::findOneBy('local_user', ['id' => $user->getId()]);
|
||||
@ -106,9 +106,9 @@ class UserPanelTest extends GNUsocialTestCase
|
||||
$client->request('GET', '/settings');
|
||||
$this->assertResponseIsSuccessful();
|
||||
$crawler = $client->submitForm('Save account info', [
|
||||
'save[old_password]' => 'some wrong password',
|
||||
'save[password][first]' => 'this is some test password',
|
||||
'save[password][second]' => 'this is some test password',
|
||||
'save_account_info[old_password]' => 'some wrong password',
|
||||
'save_account_info[password][first]' => 'this is some test password',
|
||||
'save_account_info[password][second]' => 'this is some test password',
|
||||
]);
|
||||
$this->assertResponseStatusCodeSame(500); // 401 in future
|
||||
$this->assertSelectorTextContains('.stacktrace', 'AuthenticationException');
|
||||
|
@ -39,11 +39,11 @@ class FormTest extends GNUsocialTestCase
|
||||
$form = Form::create($form_array = [
|
||||
['content', TextareaType::class, ['label' => ' ', 'data' => '', 'attr' => ['placeholder' => 'placeholder']]],
|
||||
['array_trans', TextareaType::class, ['data' => ['foo', 'bar'], 'transformer' => ArrayTransformer::class]],
|
||||
['post', SubmitType::class, ['label' => 'Post']],
|
||||
['testpost', SubmitType::class, ['label' => 'Post']],
|
||||
]);
|
||||
static::assertSame(get_class($form), 'Symfony\\Component\\Form\\Form');
|
||||
foreach ($form as $name => $f) {
|
||||
if ($name == 'post') {
|
||||
if ($name == 'testpost') {
|
||||
static::assertSame(get_class($f), 'Symfony\Component\Form\SubmitButton');
|
||||
} else {
|
||||
static::assertSame(get_class($f), 'Symfony\Component\Form\Form');
|
||||
@ -84,7 +84,7 @@ class FormTest extends GNUsocialTestCase
|
||||
$form = Form::create([
|
||||
['nickname', TextareaType::class, []],
|
||||
['normalized_nickname', TextareaType::class, []],
|
||||
['post', SubmitType::class, []],
|
||||
['testpost', SubmitType::class, []],
|
||||
], target: $user);
|
||||
$options = $form['nickname']->getConfig()->getOptions();
|
||||
static::assertSame($nick, $options['data']);
|
||||
|
Loading…
Reference in New Issue
Block a user