Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust event card test #739

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Stanford Profile

11.0.6
-------------------------------------------------------------------------------
- Fixed event day display with timezones.

11.0.4
-------------------------------------------------------------------------------
- D8CORE-7051 Use display field copy instead of token fields
Expand Down
2 changes: 1 addition & 1 deletion config/sync/smart_date.smart_date_format.day.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ separator: ' - '
join: ', '
ampm_reduce: '1'
date_first: '1'
site_time_toggle: '1'
site_time_toggle: '0'
2 changes: 1 addition & 1 deletion config/sync/smart_date.smart_date_format.short_month.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ separator: ' - '
join: ', '
ampm_reduce: '1'
date_first: '1'
site_time_toggle: '1'
site_time_toggle: '0'
2 changes: 1 addition & 1 deletion stanford_profile.info.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'Stanford Profile'
description: 'Jumpstart Website Profile'
version: 11.0.4
version: 11.0.6
type: profile
project: Stanford
core_version_requirement: ^9 || ^10
Expand Down
17 changes: 13 additions & 4 deletions tests/codeception/acceptance/Content/EventsCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ public function testClone(AcceptanceTester $I) {

/**
* Test event card markup.
*
* @group eventcard
*/
public function testEventCard(AcceptanceTester $I) {
$event = $this->createEventNode($I);
Expand All @@ -357,19 +359,26 @@ public function testEventCard(AcceptanceTester $I) {

$month = $xpath->query('//span[@class="su-event-start-month"]');
$I->assertNotEmpty($month);
$I->assertEquals(date('M', time()), $month->item(0)->nodeValue, 'Start Month does not match');
$I->assertEquals(self::getDateTimeString('M', time()), preg_replace('/(\r\n|\n|\r)/', '', $month->item(0)->nodeValue), 'Start Month does not match');

$day = $xpath->query('//span[@class="su-event-start-date"]');
$I->assertNotEmpty($day);
$I->assertEquals(date('j', time()), $day->item(0)->nodeValue, 'Start Date does not match');
$I->assertEquals(self::getDateTimeString('j', time()), preg_replace('/(\r\n|\n|\r)/', '', $day->item(0)->nodeValue), 'Start Date does not match');

$month = $xpath->query('//span[@class="su-event-end-month"]');
$I->assertNotEmpty($month);
$I->assertEquals(date('M', time() + (60 * 60 * 24)), $month->item(0)->nodeValue, 'End Month does not match');
$I->assertEquals(self::getDateTimeString('M', time() + (60 * 60 * 24)), preg_replace('/(\r\n|\n|\r)/', '', $month->item(0)->nodeValue), 'End Month does not match');

$day = $xpath->query('//span[@class="su-event-end-date"]');
$I->assertNotEmpty($day);
$I->assertEquals(date('j', time() + (60 * 60 * 24)), $day->item(0)->nodeValue, 'End Date does not match');
$I->assertEquals(self::getDateTimeString('j', time() + (60 * 60 * 24)), preg_replace('/(\r\n|\n|\r)/', '', $day->item(0)->nodeValue), 'End Date does not match');
}

protected static function getDateTimeString($format, $time) {
$timezone = \Drupal::config('system.date')
->get('timezone.default') ?: @date_default_timezone_get();
return \Drupal::service('date.formatter')
->format($time, 'custom', $format, $timezone);
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/codeception/acceptance/SystemCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class SystemCest {
* Test the site status report.
*/
public function testSiteStatus(AcceptanceTester $I) {
$I->runDrush('xmlsitemap:rebuild');
$I->logInWithRole('administrator');
$I->amOnPage('/admin/reports/status');
$I->canSee('10.1', '.system-status-general-info');
Expand Down
Loading