Commit 5f15df59 authored by Peter Tönnies's avatar Peter Tönnies

Merge branch 'master' into Feature/PT-FunkOff

parents ce293945 79a90e9d
Pipeline #48975426 canceled with stages
in 6 minutes and 45 seconds
......@@ -6,6 +6,9 @@ insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
[{*.yaml,*.yml}]
insert_final_newline = false
[*.php]
indent_style = tab
......
......@@ -36,3 +36,4 @@ client/dist
client/test/_compiled.js
c3.php
/images/
/nbproject/
\ No newline at end of file
......@@ -11,3 +11,4 @@ David Edler
Heinrich Riebler
Daniel Niesel
Stefan Osorio
Tobias Kienzler
......@@ -13,6 +13,9 @@
- getBezirk in region admin tool fails for all regions that have stores in them #495 !777 @NerdyProjects
- Properly escape store names in request popups !778 @NerdyProjects
- Fix forum "Antworten" button !786 @nicksellen
- Clarify that PLZ/Ort have to be selected in the map and cannot be modified manually #497 !790 @zommuter
- Fix truncation of messages when using emojis by using utf8mb4 charset #338 !792 @nicksellen
- Non-followers can comment on Fairteilers again #457 !691 @janopae
## Refactoring
- removed the geoClean and LostRegion modules !756 #103 @peter.toennies
......@@ -29,6 +32,8 @@
- Add php-cs-fixer to `./scripts/lint-php`, remove `./scripts/fix-codestyle` in favour of `./scripts/fix` !781 @NerdyProjects
- Remove `./scripts/build-assets` as they are continuosly built by webpack-dev-server !781 @NerdyProjects
- Make sure old CI containers are removed in test stage !787 @NerdyProjects
- added /nbProject to .gitinore !791 @k.miklobusec
# 2019-02-21
......
......@@ -26,24 +26,24 @@ modules:
config:
Db:
# http://codeception.com/docs/modules/Db
dsn: mysql:host=db;dbname=foodsharing
dsn: mysql:host=db;dbname=foodsharing;charset=utf8mb4
user: root
password: root
cleanup: true
populator: 'mysql -u$user -h$host -p$password $dbname < migrations/_reload_data.sql'
\Helper\Foodsharing:
# custom module that inherits from Db so also needs db config
dsn: mysql:host=db;dbname=foodsharing
dsn: mysql:host=db;dbname=foodsharing;charset=utf8mb4
user: root
password: root
\Helper\FoodsharingUrl:
# custom module that inherits from Db so also needs db config
dsn: mysql:host=db;dbname=foodsharing
dsn: mysql:host=db;dbname=foodsharing;charset=utf8mb4
user: root
password: root
\Helper\Container:
# custom module that inherits from Db so also needs db config
dsn: mysql:host=db;dbname=foodsharing
dsn: mysql:host=db;dbname=foodsharing;charset=utf8mb4
user: root
password: root
host: db
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "3563e50e601a905e795ebca148bebcd7",
"content-hash": "b4c06d100b67386d859f16559cd5cd30",
"packages": [
{
"name": "ddeboer/imap",
......@@ -973,6 +973,47 @@
],
"time": "2018-10-23T09:00:00+00:00"
},
{
"name": "flow/jsonpath",
"version": "0.4.0",
"source": {
"type": "git",
"url": "https://github.com/FlowCommunications/JSONPath.git",
"reference": "f0222818d5c938e4ab668ab2e2c079bd51a27112"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FlowCommunications/JSONPath/zipball/f0222818d5c938e4ab668ab2e2c079bd51a27112",
"reference": "f0222818d5c938e4ab668ab2e2c079bd51a27112",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"peekmo/jsonpath": "dev-master",
"phpunit/phpunit": "^4.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Flow\\JSONPath": "src/",
"Flow\\JSONPath\\Test": "tests/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Stephen Frank",
"email": "stephen@flowsa.com"
}
],
"description": "JSONPath implementation for parsing, searching and flattening arrays",
"time": "2018-03-04T16:39:47+00:00"
},
{
"name": "friendsofsymfony/rest-bundle",
"version": "2.5.0",
......
......@@ -60,4 +60,4 @@ define('CNT_BOTTOM', 3);
define('CNT_LEFT', 4);
define('CNT_OVERTOP', 5);
define('DSN', 'mysql:host=' . DB_HOST . ';dbname=' . DB_DB . ';charset=utf8');
define('DSN', 'mysql:host=' . DB_HOST . ';dbname=' . DB_DB . ';charset=utf8mb4');
......@@ -128,7 +128,8 @@ services:
- !php/const DB_PASS
- !php/const DB_DB
calls:
- [query, ['SET NAMES "utf8"']]
- [query, ['SET NAMES "utf8mb4"']]
PDO:
class: PDO
arguments:
......@@ -138,7 +139,6 @@ services:
calls:
- [ setAttribute, [!php/const PDO::ATTR_EMULATE_PREPARES, false]]
- [ setAttribute, [!php/const PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION]]
- [ setAttribute, [!php/const PDO::MYSQL_ATTR_INIT_COMMAND, 'SET NAMES "utf8"']]
InfluxDB\Database:
factory: ['InfluxDB\Client', 'fromdsn']
......
......@@ -11,6 +11,7 @@
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set = utf8mb4
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
......@@ -40,8 +41,9 @@ console=1
general_log=1
general_log_file=/dev/stdout
log_error=/dev/stderr
collation-server=utf8_unicode_ci
character-set-server=utf8
collation-server=utf8mb4_unicode_ci
character-set-server=utf8mb4
character-set-client-handshake = FALSE
sync_frm=0
innodb-flush-log-at-trx-commit=0
......@@ -57,6 +59,7 @@ quote-names
max_allowed_packet = 16M
[mysql]
default-character-set = utf8mb4
[isamchk]
key_buffer = 16M
......
......@@ -107,7 +107,7 @@ services:
db:
container_name: foodsharing_dev_db
image: registry.gitlab.com/foodsharing-dev/images/db/dev:1.0
image: registry.gitlab.com/foodsharing-dev/images/db/dev:1.1
# so we can mount tmpfs inside container
privileged: true
expose:
......
......@@ -100,7 +100,7 @@ services:
db:
container_name: foodsharing_test_db
image: registry.gitlab.com/foodsharing-dev/images/db/test:1.0
image: registry.gitlab.com/foodsharing-dev/images/db/test:1.1
# so we can mount tmpfs inside container
privileged: true
expose:
......
......@@ -4,7 +4,6 @@ $g_lang['already_in_bezirk'] = 'In diesem Bezirk bist Du schon aktiv';
$g_lang['request_already_send'] = 'An diesen Bezirk hast Du schon eine Anfrage gesendet.';
$g_lang['bezirk_request_successfull'] = 'Die Anfrage wurde erfolgreich versendet. Du wirst benachrichtigt sobald Du freigeschaltet wurdest.';
$g_lang['position_search'] = 'Positionssuche';
$g_lang['ort'] = 'Stadt/Gemeinde';
$g_lang['team_status_0'] = 'Dieses Team ist voll. Daher werden z.<span style="white-space:nowrap">&thinsp;</span>Z. keine weiteren Helfer gesucht.';
$g_lang['team_status_1'] = '<strong>Es werden noch Helfer gesucht</strong>';
$g_lang['team_status_2'] = '<strong>Es werden dringend noch Helfer gesucht</strong>';
......
<?php
global $g_lang;
$g_lang['ort'] = 'Stadt/Gemeinde';
$g_lang['new_fairteiler'] = 'Neuer Fair-Teiler';
$g_lang['new_fairteiler_in'] = 'Neuer Fair-Teiler in {var}';
$g_lang['list_fairteiler'] = 'Alle Fair-Teiler in {var}';
......
......@@ -15,7 +15,6 @@ $g_lang['foodsavertyp_id'] = 'foodsavertyp';
$g_lang['abholen_und_kuehlen_id'] = 'abholen_und_kuehlen';
$g_lang['land_id'] = 'land';
$g_lang['bezirk_id'] = 'bezirk';
$g_lang['plz_id'] = 'Postleitzahl';
$g_lang['passwd'] = 'Passwort';
$g_lang['admin'] = 'admin';
$g_lang['geb_datum'] = 'Geburtsdatum';
......
......@@ -2,7 +2,6 @@
global $g_lang;
$g_lang['betrieb_status_id'] = 'Status';
$g_lang['betrieb'] = 'Betrieb';
$g_lang['plz_id'] = 'PLZ';
$g_lang['bezirk_id'] = 'Bezirk';
$g_lang['kette_id'] = 'Betriebskette';
$g_lang['betrieb_kategorie_id'] = 'Kategorie';
......
......@@ -4,7 +4,6 @@ $g_lang['already_in_bezirk'] = 'In diesem Bezirk bist Du schon aktiv.';
$g_lang['request_already_send'] = 'An diesen Bezirk hast Du schon eine Anfrage gesendet.';
$g_lang['bezirk_request_successfull'] = 'Die Anfrage wurde erfolgreich versandt. Du wirst benachrichtigt, sobald Du freigeschaltet wurdest.';
$g_lang['position_search'] = 'Positionssuche';
$g_lang['ort'] = 'Stadt/Gemeinde';
$g_lang['team_status_0'] = 'Dieses Team ist voll. Daher werden z.<span style="white-space:nowrap">&thinsp;</span>Z. keine weiteren Helfer gesucht.';
$g_lang['team_status_1'] = '<strong>Es werden noch Helfer gesucht.</strong>';
$g_lang['team_status_2'] = '<strong>Es werden dringend noch Helfer gesucht.</strong>';
......@@ -16,7 +15,6 @@ $g_lang['pubbtime_3'] = 'abends';
$g_lang['pubbtime_4'] = 'nachts';
$g_lang['datetime'] = 'Zeitpunkt';
$g_lang['betrieb_status_id'] = 'Status';
$g_lang['plz_id'] = 'plz';
$g_lang['bezirk_id'] = 'Bezirk';
$g_lang['kette_id'] = 'Betriebskette';
$g_lang['betrieb_kategorie_id'] = 'Kategorie';
......
......@@ -33,7 +33,7 @@ $g_lang['sure'] = 'Ja, ich bin mir sicher.';
$g_lang['pass_generator'] = 'Foodsaver-Ausweisgenerator';
$g_lang['choose_foodsaver'] = 'W&auml;hle die Foodsaver aus, denen Du einen Ausweis drucken willst';
$g_lang['back_to_overview'] = 'zur&uuml;ck zur &Uuml;bersicht';
$g_lang['plz'] = 'Postleitzahl';
$g_lang['plz'] = 'Postleitzahl (automatisch aus Karte oben!)';
$g_lang['settings'] = 'Deine Daten/Einstellungen';
$g_lang['email'] = 'E-Mail-Adresse';
$g_lang['attachement'] = 'Anhang';
......@@ -43,7 +43,7 @@ $g_lang['about_me_public'] = 'Kurzbeschreibung von Dir';
$g_lang['autokennzeichen_id'] = 'Autokennzeichen Deiner Stadt/Region';
$g_lang['telefon'] = 'Festnetznummer';
$g_lang['handy'] = 'Handynummer';
$g_lang['anschrift'] = 'Straße und Hausnummer';
$g_lang['anschrift'] = 'Straße und Hausnummer (automatisch aus Karte oben, ggf. anschließend korrigieren!)';
$g_lang['geschlecht'] = 'Geschlecht';
$g_lang['recip_all'] = 'Alle Foodsaver weltweit';
$g_lang['recip_choose_bezirk'] = 'Bezirke einzeln ausw&auml;hlen';
......@@ -185,7 +185,7 @@ $g_lang['already_in_bezirk'] = 'In diesem Bezirk bist Du schon aktiv.';
$g_lang['request_already_send'] = 'An diesen Bezirk hast Du schon eine Anfrage gesendet.';
$g_lang['bezirk_request_successfull'] = 'Die Anfrage wurde erfolgreich versandt. Du wirst benachrichtigt sobald Du freigeschaltet wurdest.';
$g_lang['position_search'] = 'Positionssuche';
$g_lang['ort'] = 'Stadt/Gemeinde';
$g_lang['ort'] = 'Stadt/Gemeinde (automatisch aus Karte oben!)';
$g_lang['team_status_0'] = 'Dieses Team ist voll. Daher werden z.<span style="white-space:nowrap">&thinsp;</span>Z. keine weiteren Helfer gesucht.';
$g_lang['team_status_1'] = '<strong>Es werden noch Helfer gesucht</strong>';
......
-- Also need to run this at the database level
-- ALTER DATABASE lmr_prod CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
-- afterwards running this migation also run
-- $ mysqlcheck -u root -p --auto-repair --optimize lmr_prod
ALTER TABLE fs_abholer CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_abholzeiten CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_application_has_wallpost CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_basket_has_wallpost CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_bell CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_betrieb CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_betrieb_has_lebensmittel CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_betrieb_kategorie CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_betrieb_notiz CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_betrieb_status CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_betrieb_team CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_bezirk CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_bezirk_has_theme CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_bezirk_has_wallpost CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_blog_entry CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_botschafter CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_buddy CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_contact CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_content CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_conversation CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_email_status CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_event CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_event_has_wallpost CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_fairteiler CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_fairteiler_follower CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_fairteiler_has_wallpost CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_faq CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_faq_category CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_foodsaver CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_foodsaver_archive CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_foodsaver_archive2 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_foodsaver_archive4 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_foodsaver_archive5 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_foodsaver_has_bell CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_foodsaver_has_bezirk CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_foodsaver_has_contact CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_foodsaver_has_conversation CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_foodsaver_has_event CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_foodsaver_has_wallpost CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_fsreport_has_wallpost CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_ipblock CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_kette CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_lebensmittel CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_location CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_mailbox CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_mailbox_member CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_mailbox_message CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_message_tpl CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_msg CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_pass_gen CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_pass_request CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_question_has_wallpost CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_rating CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_report CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_send_email CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_theme CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_theme_follower CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_theme_post CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_usernotes_has_wallpost CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_wallpost CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_foodsaver_change_history CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_post_reaction CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE fs_verify_history CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
......@@ -102,7 +102,10 @@ function dropdb() {
function createdb() {
local database=$1;
echo "Creating database $FS_ENV/$database"
sql-query mysql "create database if not exists $database"
sql-query mysql "\
create database if not exists $database; \
alter database $database character set = utf8mb4 collate = utf8mb4_unicode_ci; \
"
}
function recreatedb() {
......
......@@ -194,14 +194,6 @@ class FairTeilerGateway extends BaseGateway
return [];
}
public function getFairteilerIds($fsId)
{
return $this->db->fetchAllValues(
'SELECT fairteiler_id FROM fs_fairteiler_follower WHERE foodsaver_id = :id',
[':id' => $fsId]
);
}
public function follow($ft_id, $fs_id, $infotype)
{
$this->db->insertIgnore(
......@@ -386,11 +378,4 @@ class FairTeilerGateway extends BaseGateway
}
$this->bellGateway->delBellsByIdentifier($identifier);
}
public function mayFairteiler(int $foodsaverId, int $fairteilerId): bool
{
$ids = $this->getFairteilerIds($foodsaverId);
return $ids && in_array($fairteilerId, $ids, true);
}
}
......@@ -58,8 +58,6 @@ class WallPostPermissions
return $fsId == $targetId;
case 'question':
return $fsId > 0;
case 'fairteiler':
return $this->fairteilerGateway->mayFairteiler($fsId, $targetId);
default:
return $fsId > 0 && $this->mayReadWall($fsId, $target, $targetId);
}
......
......@@ -2,18 +2,26 @@
class ForumApiCest
{
private $tester;
private $user;
private $region;
private $thread;
private $faker;
public function _before(\ApiTester $I)
{
$this->tester = $I;
$this->user = $I->createFoodsaver();
$this->region = $I->createRegion();
$I->addBezirkMember($this->region['id'], $this->user['id']);
$this->thread = $I->addForumTheme($this->region['id'], $this->user['id']);
$this->faker = Faker\Factory::create('de_DE');
}
/**
* @param ApiTester $I
*/
public function deleteNonExistingForumPostIs404(\ApiTester $I)
public function deleteNonExistingForumPostIs404(\ApiTester $I): void
{
$I->login($this->user['email']);
$I->sendDELETE('api/forum/post/9999999');
......@@ -24,7 +32,7 @@ class ForumApiCest
/**
* @param ApiTester $I
*/
public function deleteOwnPostSucceeds(\ApiTester $I)
public function deleteOwnPostSucceeds(\ApiTester $I): void
{
$I->login($this->user['email']);
$I->sendDELETE('api/forum/post/' . $this->thread['post']['id']);
......@@ -35,7 +43,7 @@ class ForumApiCest
/**
* @param ApiTester $I
*/
public function deleteForeignPostFails403(\ApiTester $I)
public function deleteForeignPostFails403(\ApiTester $I): void
{
$foreigner = $I->createFoodsaver();
$I->login($foreigner['email']);
......@@ -43,4 +51,27 @@ class ForumApiCest
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::FORBIDDEN);
$I->seeResponseIsJson();
}
/**
* @param ApiTester $I
*
* @throws Exception
*/
public function canUseEmojis(\ApiTester $I): void
{
$I->login($this->user['email']);
$body = 'I am so 😂 for you! ' . $this->faker->text(50);
$threadPath = 'api/forum/thread/' . $this->thread['id'];
$I->sendPOST($threadPath . '/posts', [
'body' => $body
]);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::NO_CONTENT);
$I->seeInDatabase('fs_theme_post', ['body' => $body]);
$I->sendGET($threadPath);
$I->seeResponseIsJson();
$I->assertEquals(
'<p>' . $body . '</p>',
$I->grabDataFromResponseByJsonPath('$.data.posts[1].body')[0]
);
}
}
<?php
class EmojiTest extends \Codeception\Test\Unit
{
/**
* @var \UnitTester
*/
protected $tester;
/**
* @var \Foodsharing\Modules\Core\Database
*/
private $db;
/**
* @var \Foodsharing\Lib\Db\Db
*/
private $db2;
private $user1;
private $user2;
private $conversation;
private $messageBody;
private $messageId;
protected function _before()
{
$this->db = $this->tester->get(\Foodsharing\Modules\Core\Database::class);
$this->db2 = $this->tester->get(\Foodsharing\Lib\Db\Db::class);
$this->user1 = $this->tester->createFoodsharer();
$this->user2 = $this->tester->createFoodsharer();
$this->conversation = $this->tester->createConversation([
$this->user1['id'],
$this->user2['id']
]);
$this->messageBody = 'Hey dude 😂! You are such a ★ :)';
$this->messageId = $this->db->insert('fs_msg', [
'conversation_id' => $this->conversation['id'],
'foodsaver_id' => $this->user1['id'],
'body' => $this->messageBody,
'time' => $this->db->now()
]);
}
public function testEmojiHandlingWithPDO()
{
$body = $this->db->fetchValueByCriteria('fs_msg', 'body', ['id' => $this->messageId]);
$this->assertEquals($this->messageBody, $body);
}
public function testEmojiHandlingWithMysqli()
{
$body = $this->db2->qOne('select body from fs_msg where id = ' . $this->messageId);
$this->assertEquals($this->messageBody, $body);
}
public function testEmojiHandlingWithCodeceptionDB()
{
$body = $this->tester->grabColumnFromDatabase('fs_msg', 'body', ['id' => $this->messageId])[0];
$this->assertEquals($this->messageBody, $body);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment