summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2022-06-18 19:53:46 +0200
committerHarald Eilertsen <haraldei@anduin.net>2022-06-18 19:53:46 +0200
commit745ed40d46c18c683322b19939455deed52e94df (patch)
treea967df65a843d430630686cacaabfc87b50121c8
parent1fa1654de0527440d057c5ed05891bed6cc0b69c (diff)
downloadgigologadmin-745ed40d46c18c683322b19939455deed52e94df.tar.gz
gigologadmin-745ed40d46c18c683322b19939455deed52e94df.tar.bz2
gigologadmin-745ed40d46c18c683322b19939455deed52e94df.zip
Fix ConcertTable tests and markup.
-rw-r--r--includes/admin/views/_concerts_table.php8
-rw-r--r--tests/ConcertsTableTest.php13
2 files changed, 11 insertions, 10 deletions
diff --git a/includes/admin/views/_concerts_table.php b/includes/admin/views/_concerts_table.php
index ad7aebc..4f9b3c9 100644
--- a/includes/admin/views/_concerts_table.php
+++ b/includes/admin/views/_concerts_table.php
@@ -310,7 +310,7 @@ if ( ! class_exists( 'GiglogAdmin_ConcertsTable' ) ) {
$content .= '<td><a target="_blank" href="' . esc_url( $concert->tickets() ) . '">Tickets</a></td>';
}
- $content .= '<td> <a href="' . get_admin_url() . 'admin-ajax.php?action=giglog_export_ical&evid=' . $concert->id() . '">iCal</td>';
+ $content .= '<td><a href="' . get_admin_url() . 'admin-ajax.php?action=giglog_export_ical&amp;evid=' . $concert->id() . '">iCal</a></td>';
$content .= '</tr>';
$last_city = $concert->venue()->city();
}
@@ -320,7 +320,7 @@ if ( ! class_exists( 'GiglogAdmin_ConcertsTable' ) ) {
$content .= $this->render_pagination();
// from main form that includes filters
- $content .= '</div></form></p>';
+ $content .= '</div></form>';
// return the table
return $content;
@@ -329,7 +329,7 @@ if ( ! class_exists( 'GiglogAdmin_ConcertsTable' ) ) {
private function render_filters() : string {
global $wp_locale;
- $select = '<p><form method="GET" action="" class="filterclass">FILTER DATA: ';
+ $select = '<form method="GET" action="" class="filterclass">FILTER DATA: ';
foreach ( $_GET as $name => $val ) {
if ( in_array( $name, self::FILTER_KEYS ) ) {
@@ -372,8 +372,6 @@ if ( ! class_exists( 'GiglogAdmin_ConcertsTable' ) ) {
'Select month...'
);
- $select .= '</select>';
-
if ( is_admin() ) {
// option to select own concerts only
$select .= '<input name="only_mine" class="ownconc" type="checkbox" value="1"'
diff --git a/tests/ConcertsTableTest.php b/tests/ConcertsTableTest.php
index 6f9d9d2..f6ee3cd 100644
--- a/tests/ConcertsTableTest.php
+++ b/tests/ConcertsTableTest.php
@@ -34,7 +34,7 @@ class ConcertsTableTest extends WP_UnitTestCase
$created_venues[] = GiglogAdmin_Venue::find_or_create($venue[0], $venue[1]);
}
- $today = date("Y-m-d");
+ $today = new DateTime();
foreach (self::CONCERTS as $concert) {
for ($i = 0; $i < $concert[2]; $i++) {
@@ -45,10 +45,13 @@ class ConcertsTableTest extends WP_UnitTestCase
$concert_name = $concert[0];
}
+ $offset = rand(1, 13);
+ $concert_date = $today->modify( "+$offset days" );
+
self::$concerts[] = GiglogAdmin_Concert::create(
$concert_name,
$created_venues[$concert[1]]->id(),
- $today,
+ $concert_date->format( 'Y-m-d' ),
"https://example.com/tickets/42",
"https://example.com/events/93");
}
@@ -104,8 +107,8 @@ class ConcertsTableTest extends WP_UnitTestCase
}
}
- $this->assertEquals(64, $assignit_count); // four for each gig
- $this->assertEquals(16, $adminactions_count); // once for each gig
+ $this->assertEquals(60, $assignit_count); // four for each gig
+ $this->assertEquals(15, $adminactions_count); // once for each gig
}
function testDontShowAdminOnlyControlsToNonAdminsOnAdminPage() {
@@ -138,7 +141,7 @@ class ConcertsTableTest extends WP_UnitTestCase
}
}
- $this->assertEquals(64, $assignit_count); // four for each gig
+ $this->assertEquals(60, $assignit_count); // four for each gig
$this->assertEquals(0, $adminactions_count); // once for each gig
}