aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/lib/classes/LinkButtonTest.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:07:19 +0200
committerJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:19:12 +0200
commita3da1483a9e689846179159355badfec8073dbec (patch)
tree770dcca6bdf5f6f2a11b0e7fcbbeda6919a3fc52 /tests/unit/lib/classes/LinkButtonTest.php
current code from svn, revision 62608
Diffstat (limited to 'tests/unit/lib/classes/LinkButtonTest.php')
-rw-r--r--tests/unit/lib/classes/LinkButtonTest.php68
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/unit/lib/classes/LinkButtonTest.php b/tests/unit/lib/classes/LinkButtonTest.php
new file mode 100644
index 0000000..a0b8f11
--- /dev/null
+++ b/tests/unit/lib/classes/LinkButtonTest.php
@@ -0,0 +1,68 @@
+<?php
+
+/*
+ * Copyright (C) 2011 - <mlunzena@uos.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+use \Studip\LinkButton;
+
+class LinkButtonTestCase extends \Codeception\Test\Unit
+{
+ function testCreate()
+ {
+ $this->assertNotNull(LinkButton::create());
+ }
+
+ function testCreateWithLabel()
+ {
+ $this->assertEquals('<a class="button" href="?" tabindex="0">yes</a>',
+ '' . LinkButton::create('yes'));
+ }
+
+ function testCreateWithLabelAndUrl()
+ {
+ $this->assertEquals('<a class="button" href="http://example.net" tabindex="0">yes</a>',
+ '' . LinkButton::create('yes', 'http://example.net'));
+ }
+
+ function testCreateWithLabelAndArray()
+ {
+ $this->assertEquals('<a a="1" b="2" class="button" href="?" tabindex="0">yes</a>',
+ '' . LinkButton::create('yes', ['a' => 1, 'b' => 2]));
+ }
+
+ function testCreateWithLabelUrlAndArray()
+ {
+ $this->assertEquals('<a a="1" b="2" class="button" href="http://example.net" tabindex="0">yes</a>',
+ '' . LinkButton::create('yes', 'http://example.net', ['a' => 1, 'b' => 2]));
+ }
+
+ function testCreateAccept()
+ {
+ $this->assertEquals('<a class="accept button" href="?" name="accept" tabindex="0">Übernehmen</a>',
+ '' . LinkButton::createAccept());
+ }
+
+ function testCreateCancel()
+ {
+ $this->assertEquals('<a class="cancel button" href="?" name="cancel" tabindex="0">Abbrechen</a>',
+ '' . LinkButton::createCancel());
+ }
+
+ function testCreatePreOrder()
+ {
+ $this->assertEquals('<a class="pre-order button" href="?" name="pre-order" tabindex="0">ok</a>',
+ '' . LinkButton::createPreOrder());
+ }
+
+ function testCreateWithInsaneArguments()
+ {
+ $this->assertEquals('<a class="button" href="http://example.net?m=&amp;m=" mad="&lt;S&gt;tu&quot;ff" tabindex="0">&gt;ok&lt;</a>',
+ '' . LinkButton::create('>ok<', 'http://example.net?m=&m=', ['mad' => '<S>tu"ff']));
+ }
+}