mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-21 20:34:57 +09:00
Integration tests for sign up form custom inut fields added
This commit is contained in:
1 parent
43bfbb55aa
commit
43bf54bf13
1 file changed
+88
@@ -8,6 +8,11 @@ class Api_Guest_ClientTest extends BBDbApiTestCase
|
||||
|
||||
public function testCreate()
|
||||
{
|
||||
$this->api_admin->extension_config_save(array(
|
||||
'ext' => 'mod_client',
|
||||
'required' => array(),
|
||||
));
|
||||
|
||||
$e = rand(5, 56666).'@gmail.com';
|
||||
$pass = 'testA1sssss';
|
||||
|
||||
@@ -103,4 +108,87 @@ class Api_Guest_ClientTest extends BBDbApiTestCase
|
||||
$array = $this->api_guest->client_required();
|
||||
$this->assertInternalType('array', $array);
|
||||
}
|
||||
|
||||
public function testCreateWithCustom()
|
||||
{
|
||||
$this->api_admin->extension_config_save(array(
|
||||
'ext' => 'mod_client',
|
||||
'required' => array(
|
||||
'last_name'
|
||||
),
|
||||
'custom_fields' => array(
|
||||
'custom_5' => array(
|
||||
'active' => true,
|
||||
'required' => true,
|
||||
'title' => 'Your username'
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
$e = rand(5, 56666) . '@gmail.com';
|
||||
$pass = 'testA1sssss';
|
||||
|
||||
$data = array(
|
||||
'aid' => '2',
|
||||
'email' => $e,
|
||||
'first_name' => 'John',
|
||||
'last_name' => 'Doe',
|
||||
'address_1' => 'Palo Alto',
|
||||
'country' => 'USA',
|
||||
'company_vat' => 'LS-2qwddwqdsd12',
|
||||
'city' => 'California',
|
||||
'tel_cc' => '211',
|
||||
'phone' => '11212156485451',
|
||||
'password' => $pass,
|
||||
'password_confirm' => $pass,
|
||||
'custom_5' => 'JohnUsername'
|
||||
|
||||
);
|
||||
$id = $this->api_guest->client_create($data);
|
||||
$this->assertInternalType('int', $id);
|
||||
$client = $this->di['db']->load('Client', $id);
|
||||
|
||||
$this->assertEquals($data['custom_5'], $client->custom_5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCreateWithCustomRequiredException()
|
||||
{
|
||||
$this->api_admin->extension_config_save(array(
|
||||
'ext' => 'mod_client',
|
||||
'required' => array(
|
||||
'last_name'
|
||||
),
|
||||
'custom_fields' => array(
|
||||
'custom_5' => array(
|
||||
'active' => true,
|
||||
'required' => true,
|
||||
'title' => 'Your username'
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
$e = rand(5, 56666) . '@gmail.com';
|
||||
$pass = 'testA1sssss';
|
||||
|
||||
$data = array(
|
||||
'aid' => '2',
|
||||
'email' => $e,
|
||||
'first_name' => 'John',
|
||||
'last_name' => 'Doe',
|
||||
'address_1' => 'Palo Alto',
|
||||
'country' => 'USA',
|
||||
'company_vat' => 'LS-2qwddwqdsd12',
|
||||
'city' => 'California',
|
||||
'tel_cc' => '211',
|
||||
'phone' => '11212156485451',
|
||||
'password' => $pass,
|
||||
'password_confirm' => $pass,
|
||||
|
||||
);
|
||||
$id = $this->api_guest->client_create($data);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user