5require_once(
"libs/composer/vendor/autoload.php");
6require_once(__DIR__ .
"/../../Base.php");
8use \ILIAS\UI\Component as
C;
17 return new \ILIAS\UI\Implementation\Component\Counter\Factory();
24 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Counter\\Factory",
$f);
26 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Counter\\Counter",
$f->status(0));
27 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Counter\\Counter",
$f->novelty(0));
37 $c =
$f->status($number);
39 $this->assertNotNull(
$c);
40 $this->assertEquals(
C\Counter\Counter::STATUS,
$c->getType());
41 $this->assertEquals($number,
$c->getNumber());
51 $c =
$f->novelty($number);
53 $this->assertNotNull(
$c);
54 $this->assertEquals(
C\Counter\Counter::NOVELTY,
$c->getType());
55 $this->assertEquals($number,
$c->getNumber());
61 new \ILIAS\UI\Implementation\Component\Counter\Counter(
"FOO", 1);
62 $this->assertFalse(
"We should not get here");
63 }
catch (\InvalidArgumentException $e) {
75 $f->status($no_number);
76 $this->assertFalse(
"This should not happen");
77 }
catch (\InvalidArgumentException $e) {
83 return array( array(-13)
92 return array( array(
"foo")
95 , array(
new stdClass())
100 ,
"novelty" =>
"badge badge-notify il-counter-novelty"
110 $c =
$f->$type($number);
114 $css_classes = self::$canonical_css_classes[
$type];
115 $expected =
"<span class=\"$css_classes\">$number</span>";
116 $this->assertEquals($expected,
$html);
121 return array( array(
"status", 42)
122 , array(
"novelty", 13)
124 , array(
"novelty", 23)
An exception for terminatinating execution or to throw for unit testing.
Defines tests that a counter implementation should pass.
test_implements_factory_interface()
test_status_counter($number)
@dataProvider number_provider
test_int_numbers_only($no_number)
@dataProvider no_number_provider
counter_type_and_number_provider()
test_novelty_counter($number)
@dataProvider number_provider
test_render_status($type, $number)
@dataProvider counter_type_and_number_provider
static $canonical_css_classes
test_known_counters_only()
Provides common functionality for UI tests.
getDefaultRenderer(JavaScriptBinding $js_binding=null)