Fix whitespace in Tests output (#7364)

* Fix whitespace in Tests output

* Fix artifacts path

* Fix whitespace in Tests output

* Remove old code comment

* Fix test
This commit is contained in:
Yuriy Bakhtin 2024-12-23 22:20:27 +01:00 committed by GitHub
parent 90a09a78f4
commit 64d4a1d881
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 9 deletions

View File

@ -103,4 +103,40 @@ class Formatter extends \yii\i18n\Formatter
return Yii::t('base', '{nFormatted}B', $params, $this->language); // Billion return Yii::t('base', '{nFormatted}B', $params, $this->language); // Billion
} }
} }
/**
* Fix unicode chars
*
* @param string $value
* @return string
*/
private function fixUnicodeChars($value): string
{
// Replace newly introduced Unicode separator whitespace, which a standard one, to sway backward compatible.
return str_replace('', ' ', $value);
}
/**
* @inheritdoc
*/
public function asDate($value, $format = null)
{
return $this->fixUnicodeChars(parent::asDate($value, $format));
}
/**
* @inheritdoc
*/
public function asTime($value, $format = null)
{
return $this->fixUnicodeChars(parent::asTime($value, $format));
}
/**
* @inheritdoc
*/
public function asDatetime($value, $format = null)
{
return $this->fixUnicodeChars(parent::asDatetime($value, $format));
}
} }

View File

@ -78,7 +78,7 @@ class RequestMembershipCest
$I->waitForText('Members', null, '.controls-header'); $I->waitForText('Members', null, '.controls-header');
$I->click('Members', '.controls-header'); $I->click('Members', '.controls-header');
$I->waitForText('Manage members'); $I->waitForText('Member since');
$I->see('Pending Approvals'); $I->see('Pending Approvals');
$I->click('Pending Approvals'); $I->click('Pending Approvals');

View File

@ -88,10 +88,6 @@ class TimeAgoWidgetTest extends HumHubDbTestCase
// TS outside of default 172800 but default deactivated // TS outside of default 172800 but default deactivated
$ts = (new DateTime())->setTime(12, 00, 00)->getTimestamp(); $ts = (new DateTime())->setTime(12, 00, 00)->getTimestamp();
$result = TimeAgo::widget(['timestamp' => $ts, 'timeAgoBefore' => 1]); $result = TimeAgo::widget(['timestamp' => $ts, 'timeAgoBefore' => 1]);
// Replace newly introduced Unicode separator whitespace, which a standard one, to sway backward compatible.
$result = str_replace('', ' ', $result);
$this->assertStringContainsString('12:00 PM</time>', $result); $this->assertStringContainsString('12:00 PM</time>', $result);
} }
@ -100,10 +96,6 @@ class TimeAgoWidgetTest extends HumHubDbTestCase
// TS outside of default 172800 but default deactivated // TS outside of default 172800 but default deactivated
$ts = DateTime::createFromFormat('Y-m-d H:i:s', '2018-10-12 12:00:00')->getTimestamp(); $ts = DateTime::createFromFormat('Y-m-d H:i:s', '2018-10-12 12:00:00')->getTimestamp();
$result = TimeAgo::widget(['timestamp' => $ts, 'hideTimeAfter' => false]); $result = TimeAgo::widget(['timestamp' => $ts, 'hideTimeAfter' => false]);
// Replace newly introduced Unicode separator whitespace, which a standard one, to sway backward compatible.
$result = str_replace('', ' ', $result);
$this->assertStringContainsString('Oct 12, 2018 - 12:00 PM</time>', $result); $this->assertStringContainsString('Oct 12, 2018 - 12:00 PM</time>', $result);
} }