aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/lib/classes/ButtonTest.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/ButtonTest.php
current code from svn, revision 62608
Diffstat (limited to 'tests/unit/lib/classes/ButtonTest.php')
-rw-r--r--tests/unit/lib/classes/ButtonTest.php66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/unit/lib/classes/ButtonTest.php b/tests/unit/lib/classes/ButtonTest.php
new file mode 100644
index 0000000..5ed16b7
--- /dev/null
+++ b/tests/unit/lib/classes/ButtonTest.php
@@ -0,0 +1,66 @@
+<?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\Button;
+
+class ButtonTestCase extends \Codeception\Test\Unit
+{
+ function testCreate()
+ {
+ $this->assertEquals('<button type="submit" class="button" name="ok">ok</button>', '' . Button::create());
+ }
+
+ function testCreateWithLabel()
+ {
+ $this->assertEquals('<button type="submit" class="button" name="yes">yes</button>', '' . Button::create('yes'));
+ }
+
+ function testCreateWithLabelAndString()
+ {
+ $this->assertEquals('<button type="submit" class="button" name="aName">yes</button>', '' . Button::create('yes', 'aName'));
+ }
+
+ function testCreateWithLabelAndArray()
+ {
+ $this->assertEquals('<button type="submit" a="1" b="2" class="button" name="yes">yes</button>',
+ '' . Button::create('yes', ['a' => 1, 'b' => 2]));
+ }
+
+ function testCreateWithLabelNameAndArray()
+ {
+ $this->assertEquals('<button type="submit" a="1" b="2" class="button" name="aName">yes</button>',
+ '' . Button::create('yes', 'aName', ['a' => 1, 'b' => 2]));
+ }
+
+ function testCreateAccept()
+ {
+ $this->assertEquals('<button type="submit" class="accept button" name="accept">Übernehmen</button>',
+ '' . Button::createAccept());
+ }
+
+ function testCreateCancel()
+ {
+ $this->assertEquals('<button type="submit" class="cancel button" name="cancel">Abbrechen</button>',
+ '' . Button::createCancel());
+ }
+
+ function testCreatePreOrder()
+ {
+ $this->assertEquals('<button type="submit" class="pre-order button" name="pre-order">ok</button>',
+ '' . Button::createPreOrder());
+ }
+
+ function testCreateWithInsaneArguments()
+ {
+ $this->assertEquals('<button type="submit" class="button" mad="&lt;S&gt;tu&quot;ff" name="m&amp;m">&gt;ok&lt;</button>',
+ '' . Button::create('>ok<', 'm&m', ['mad' => '<S>tu"ff']));
+ }
+}