mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Updated db column name test for various languages
This commit is contained in:
parent
11810ae9ad
commit
34ab78ef99
|
@ -5,6 +5,11 @@ use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test strings for db column names gathered from
|
||||||
|
* http://www.omniglot.com/language/phrases/hovercraft.htm
|
||||||
|
*/
|
||||||
class CustomFieldTest extends \Codeception\TestCase\Test
|
class CustomFieldTest extends \Codeception\TestCase\Test
|
||||||
{
|
{
|
||||||
protected $tester;
|
protected $tester;
|
||||||
|
@ -26,31 +31,67 @@ class CustomFieldTest extends \Codeception\TestCase\Test
|
||||||
$this->assertEquals($customfield->format,"IP");
|
$this->assertEquals($customfield->format,"IP");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDbName() {
|
public function testDbNameAscii() {
|
||||||
$customfield=new CustomField();
|
$customfield = new CustomField();
|
||||||
$customfield->name="An Example Name";
|
$customfield->name="My hovercraft is full of eels";
|
||||||
$this->assertEquals($customfield->db_column_name(),"_snipeit_an_example_name");
|
$customfield->id = 1337;
|
||||||
|
$this->assertEquals($customfield->convertUnicodeDbSlug(),"_snipeit_my_hovercraft_is_full_of_eels_1337");
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function testValidation() {
|
// Western Europe
|
||||||
// // $f=new CustomField();
|
public function testDbNameLatin() {
|
||||||
// // $f->name='Id';
|
$customfield=new CustomField();
|
||||||
// // $f->format='IP';
|
$customfield->name="My hovercraft is full of eels";
|
||||||
// // $f->element="text";
|
$customfield->id = 1337;
|
||||||
// // /*$this->assertDoesntThrow(function () {
|
$this->assertEquals($customfield->convertUnicodeDbSlug(),"_snipeit_my_hovercraft_is_full_of_eels_1337");
|
||||||
// // $f->save();
|
}
|
||||||
// // });*/
|
|
||||||
// // $this->assertNull(CustomField::saving($f)); //horrible hacky workaround to even problems
|
|
||||||
// // //for Laravel testing. Blech.
|
// Asian
|
||||||
//
|
public function testDbNameChinese() {
|
||||||
// $g=new CustomField();
|
$customfield=new CustomField();
|
||||||
// $g->name='totally_unique_name';
|
$customfield->name="我的氣墊船裝滿了鱔魚";
|
||||||
// $g->format='IP';
|
$customfield->id = 1337;
|
||||||
// $g->element="text";
|
$this->assertEquals($customfield->convertUnicodeDbSlug(),"_snipeit_wo_de_qi_dian_chuan_zhuang_man_le_shan_yu_1337");
|
||||||
// //$this->assertTrue($g->validate($g->toArray()));
|
}
|
||||||
// $this->assertTrue(CustomField::saving($g));
|
|
||||||
// /*$this->assertThrows(function () {
|
public function testDbNameJapanese() {
|
||||||
// $f->save();
|
$customfield=new CustomField();
|
||||||
// });*/
|
$customfield->name="私のホバークラフトは鰻でいっぱいです";
|
||||||
// }
|
$customfield->id = 1337;
|
||||||
|
$this->assertEquals($customfield->convertUnicodeDbSlug(),"_snipeit_sinohohakurafutoha_manteihhaitesu_1337");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDbNameKorean() {
|
||||||
|
$customfield=new CustomField();
|
||||||
|
$customfield->name="내 호버크라프트는 장어로 가득 차 있어요";
|
||||||
|
$customfield->id = 1337;
|
||||||
|
$this->assertEquals($customfield->convertUnicodeDbSlug(),"_snipeit_nae_hobeokeulapeuteuneun_jang_eolo_gadeug_1337");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nordic languages
|
||||||
|
public function testDbNameNonLatinEuro() {
|
||||||
|
$customfield=new CustomField();
|
||||||
|
$customfield->name="Mój poduszkowiec jest pełen węgorzy";
|
||||||
|
$customfield->id = 1337;
|
||||||
|
$this->assertEquals($customfield->convertUnicodeDbSlug(),"_snipeit_moj_poduszkowiec_jest_pelen_wegorzy_1337");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
public function testDbNameTurkish() {
|
||||||
|
$customfield=new CustomField();
|
||||||
|
$customfield->name="Hoverkraftım yılan balığı dolu";
|
||||||
|
$customfield->id = 1337;
|
||||||
|
$this->assertEquals($customfield->convertUnicodeDbSlug(),"_snipeit_hoverkraftim_yilan_baligi_dolu_1337");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDbNameArabic() {
|
||||||
|
$customfield=new CustomField();
|
||||||
|
$customfield->name="حَوّامتي مُمْتِلئة بِأَنْقَلَيْسون";
|
||||||
|
$customfield->id = 1337;
|
||||||
|
$this->assertEquals($customfield->convertUnicodeDbSlug(),"_snipeit_hwamty_mmtlyt_banqlyswn_1337");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue