summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2021-04-22 23:13:15 +0200
committerHarald Eilertsen <haraldei@anduin.net>2021-04-22 23:13:15 +0200
commit6076d8ae50cc43b7722fcc63e6eba38117f91206 (patch)
treebb193c644e7aba9f5de9100e56f6930e6ec240a6 /tests
parent38c6e2ce8badf6446789bbacbcbea75e75bea41b (diff)
downloadgigologadmin-6076d8ae50cc43b7722fcc63e6eba38117f91206.tar.gz
gigologadmin-6076d8ae50cc43b7722fcc63e6eba38117f91206.tar.bz2
gigologadmin-6076d8ae50cc43b7722fcc63e6eba38117f91206.zip
Add some tests for Concert class.
Diffstat (limited to 'tests')
-rw-r--r--tests/ConcertTest.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/ConcertTest.php b/tests/ConcertTest.php
new file mode 100644
index 0000000..19267ee
--- /dev/null
+++ b/tests/ConcertTest.php
@@ -0,0 +1,49 @@
+<?php declare(strict_types=1);
+// SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
+// SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+final class ConcertTest extends WP_UnitTestCase
+{
+ public function testCreateConcert() : void
+ {
+ $venue = GiglogAdmin_Venue::create("a venue");
+ $today = date("Y-m-d");
+
+ $concert = GiglogAdmin_Concert::create(
+ "a concert",
+ $venue->id(),
+ $today,
+ "https://example.com/tickets/42",
+ "https://example.com/events/93");
+
+ $this->assertEquals("a concert", $concert->cname());
+ $this->assertEquals($venue->id(), $concert->venue());
+ $this->assertEquals($today, $concert->cdate());
+ $this->assertEquals("https://example.com/tickets/42", $concert->tickets());
+ $this->assertEquals("https://example.com/events/93", $concert->eventlink());
+ }
+
+ public function testCreateExistingConcert() : void
+ {
+ $venue = GiglogAdmin_Venue::create("a venue");
+ $today = date("Y-m-d");
+
+ GiglogAdmin_Concert::create(
+ "a concert",
+ $venue->id(),
+ $today,
+ "https://example.com/tickets/42",
+ "https://example.com/events/93");
+
+ $new = GiglogAdmin_Concert::create(
+ "a concert",
+ $venue->id(),
+ $today,
+ "https://example.com/tickets/42",
+ "https://example.com/events/93");
+
+ $this->assertEquals("dup", $new);
+ }
+}