Skip to content

Commit ffe6d2f

Browse files
add test
1 parent f7e5495 commit ffe6d2f

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { rte } from '../../../../helpers/constants';
2+
import { populateHashWithFields } from '../../../../helpers/keys';
3+
import { Common, DatabaseHelper } from '../../../../helpers';
4+
import { BrowserPage } from '../../../../pageObjects';
5+
import {
6+
commonUrl,
7+
ossStandaloneV8Config
8+
} from '../../../../helpers/conf';
9+
import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';
10+
import { APIKeyRequests } from '../../../../helpers/api/api-keys';
11+
const apiKeyRequests = new APIKeyRequests();
12+
13+
14+
const browserPage = new BrowserPage();
15+
const databaseHelper = new DatabaseHelper();
16+
const databaseAPIRequests = new DatabaseAPIRequests();
17+
18+
const keyName = `TestHashKey-${ Common.generateWord(10) }`;
19+
const keyToAddParameters = { fieldsCount: 1, keyName, fieldStartWith: 'hashField', fieldValueStartWith: 'hashValue' };
20+
21+
fixture `Formatters`
22+
.meta({
23+
type: 'regression',
24+
rte: rte.standalone
25+
})
26+
.page(commonUrl)
27+
.beforeEach(async() => {
28+
await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneV8Config);
29+
30+
await populateHashWithFields(ossStandaloneV8Config.host, ossStandaloneV8Config.port, keyToAddParameters);
31+
})
32+
.afterEach(async() => {
33+
// Clear keys and database
34+
await apiKeyRequests.deleteKeyByNameApi(keyName, ossStandaloneV8Config.databaseName);
35+
await databaseAPIRequests.deleteStandaloneDatabaseApi(ossStandaloneV8Config);
36+
});
37+
38+
test.before(async t => {
39+
await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneV8Config);
40+
41+
})('Verify that UTF8 in PHP serialized', async t => {
42+
const phpValueChinese = '测试';
43+
const phpValueCRussian = 'Привет мир!';
44+
const setValue =`SET ${keyName} "a:3:{s:4:\\"name\\";s:6:\\"${phpValueChinese}\\";s:3:\\"age\\";i:30;s:7:\\"message\\";s:20:\\"${phpValueCRussian}\\";}"\n`;
45+
46+
await browserPage.Cli.sendCommandInCli(setValue);
47+
await t.click(browserPage.refreshKeysButton);
48+
49+
await browserPage.openKeyDetailsByKeyName(keyName);
50+
await browserPage.selectFormatter('PHP serialized');
51+
await t.expect(await browserPage.getStringKeyValue()).contains(phpValueChinese, 'data is not serialized in php');
52+
await t.expect(await browserPage.getStringKeyValue()).contains(phpValueCRussian, 'data is not serialized in php');
53+
});

0 commit comments

Comments
 (0)