Skip to content

Commit

Permalink
11.0.6
Browse files Browse the repository at this point in the history
* Adjust event card test

* only 1 test

* 11.0.6
  • Loading branch information
pookmish authored Oct 25, 2023
1 parent 78a15a5 commit b525263
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
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

0 comments on commit b525263

Please sign in to comment.