5require_once(
"libs/composer/vendor/autoload.php");
6require_once(__DIR__.
"/../../Base.php");
8use \ILIAS\UI\Component as
C;
15 return new \ILIAS\UI\Implementation\Component\Counter\Factory();
21 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Counter\\Factory", $f);
23 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Counter\\Counter", $f->status(0));
24 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Counter\\Counter", $f->novelty(0));
33 $c = $f->status($number);
35 $this->assertNotNull($c);
36 $this->assertEquals(
C\Counter\Counter::STATUS, $c->getType());
37 $this->assertEquals($number, $c->getNumber());
46 $c = $f->novelty($number);
48 $this->assertNotNull($c);
49 $this->assertEquals(
C\Counter\Counter::NOVELTY, $c->getType());
50 $this->assertEquals($number, $c->getNumber());
55 new \ILIAS\UI\Implementation\Component\Counter\Counter(
"FOO", 1);
56 $this->assertFalse(
"We should not get here");
58 catch (\InvalidArgumentException $e) {}
68 $f->status($no_number);
69 $this->assertFalse(
"This should not happen");
71 catch (\InvalidArgumentException $e) {}
88 , array(
new stdClass())
93 (
"status" =>
"badge badge-notify il-counter-status"
94 ,
"novelty" =>
"badge badge-notify il-counter-novelty"
103 $c = $f->$type($number);
107 $css_classes = self::$canonical_css_classes[$type];
108 $expected =
"<span class=\"$css_classes\">$number</span>";
109 $this->assertEquals($expected,
$html);
114 ( array(
"status", 42)
115 , array(
"novelty", 13)
117 , 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.