first commit
This commit is contained in:
83
tests/functional/UserTest.php
Normal file
83
tests/functional/UserTest.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
class UserTest extends \DatabaseTestCase
|
||||
{
|
||||
public function testCreate()
|
||||
{
|
||||
$this->assertEquals(1, User::createFromId(1)->id);
|
||||
$this->assertEquals(1, User::createFromLogin('petr@wpj.cz')->id);
|
||||
$this->assertEquals(1, User::createFromUserKey('r90p06rftme6v8dg11j6prcc81')->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data_testPhoneNumberProcess
|
||||
*/
|
||||
public function testPhoneNumberProcess($phone, $userData)
|
||||
{
|
||||
$user = new User();
|
||||
$user->updateAddresses(array_merge([
|
||||
'name' => 'Petr',
|
||||
'surname' => 'Jebavý',
|
||||
'email' => 'petr@wpj.cz',
|
||||
'phone' => '',
|
||||
'country' => 'CZ',
|
||||
'currency' => 'CZK', ], $userData), null);
|
||||
|
||||
$this->assertSame($phone, $user->invoice['phone']);
|
||||
}
|
||||
|
||||
public function data_testPhoneNumberProcess()
|
||||
{
|
||||
return [
|
||||
['+420123456789', ['phone' => '123456789']],
|
||||
['+123456789', ['phone' => '00123456789']],
|
||||
['+420123456789', ['phone' => '+420123456789']],
|
||||
['+52123456789', ['phone' => '+52123456789']],
|
||||
['+420739022578', ['phone' => '739022578']],
|
||||
];
|
||||
}
|
||||
|
||||
protected function getDataSet()
|
||||
{
|
||||
return $this->getJsonDataSet(/* @lang JSON */
|
||||
'{
|
||||
"users": [
|
||||
{
|
||||
"id":1,
|
||||
"passw":"79c2b46ce2594ecbcb5b73e928345492",
|
||||
"user_key":"r90p06rftme6v8dg11j6prcc81",
|
||||
"figure":"Y",
|
||||
"name":"Petr",
|
||||
"surname":"Jebavý",
|
||||
"firm":"wpj s.r.o.",
|
||||
"street":"Nádražní 471",
|
||||
"city":"Vrchlabí",
|
||||
"zip":54301,
|
||||
"country":"",
|
||||
"currency":"CZK",
|
||||
"email":"petr@wpj.cz",
|
||||
"ico":"",
|
||||
"dic":"",
|
||||
"phone":775131400,
|
||||
"mobile":"",
|
||||
"fax":"",
|
||||
"delivery_name":"",
|
||||
"delivery_surname":"",
|
||||
"delivery_firm":"",
|
||||
"delivery_street":"",
|
||||
"delivery_city":"",
|
||||
"delivery_zip":"",
|
||||
"delivery_country":"",
|
||||
"account_no":"",
|
||||
"account_bank":"",
|
||||
"account_symbol":"",
|
||||
"get_news":"Y",
|
||||
"prefer_transport":1,
|
||||
"date_reg":"2013-09-30 12:09:05",
|
||||
"date_updated":"2013-09-30 12:12:44",
|
||||
"date_logged":null
|
||||
}
|
||||
]
|
||||
}');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user