*
* 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->assertXmlStringEqualsXmlString(
'yes',
(string) LinkButton::create('yes')
);
}
function testCreateWithLabelAndUrl()
{
$this->assertXmlStringEqualsXmlString(
'yes',
(string) LinkButton::create('yes', 'http://example.net')
);
}
function testCreateWithLabelAndArray()
{
$this->assertXmlStringEqualsXmlString(
'yes',
(string) LinkButton::create('yes', ['a' => 1, 'b' => 2])
);
}
function testCreateWithLabelUrlAndArray()
{
$this->assertXmlStringEqualsXmlString(
'yes',
(string) LinkButton::create('yes', 'http://example.net', ['a' => 1, 'b' => 2])
);
}
function testCreateAccept()
{
$this->assertXmlStringEqualsXmlString(
'Übernehmen',
(string) LinkButton::createAccept()
);
}
function testCreateCancel()
{
$this->assertXmlStringEqualsXmlString(
'Abbrechen',
(string) LinkButton::createCancel()
);
}
function testCreatePreOrder()
{
$this->assertXmlStringEqualsXmlString(
'ok',
(string) LinkButton::createPreOrder()
);
}
function testCreateWithInsaneArguments()
{
$this->assertXmlStringEqualsXmlString(
'>ok<',
(string) LinkButton::create('>ok<', 'http://example.net?m=&m=', ['mad' => 'tu"ff'])
);
}
}