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\Glyph\Factory();
 
   22        return new \ILIAS\UI\Implementation\Component\Counter\Factory();
 
   26        , 
C\Glyph\Glyph::EXPAND                         => 
"glyphicon glyphicon-triangle-right" 
   27        , 
C\Glyph\Glyph::COLLAPSE                       => 
"glyphicon glyphicon-triangle-bottom" 
   28        , 
C\Glyph\Glyph::ADD                            => 
"glyphicon glyphicon-plus-sign" 
   29        , 
C\Glyph\Glyph::REMOVE                         => 
"glyphicon glyphicon-minus-sign" 
   30        , 
C\Glyph\Glyph::UP                                     => 
"glyphicon glyphicon-circle-arrow-up" 
   31        , 
C\Glyph\Glyph::DOWN                           => 
"glyphicon glyphicon-circle-arrow-down" 
   32        , 
C\Glyph\Glyph::BACK                           => 
"glyphicon glyphicon-chevron-left" 
   33        , 
C\Glyph\Glyph::NEXT                           => 
"glyphicon glyphicon-chevron-right" 
   34        , 
C\Glyph\Glyph::SORT_ASCENDING         => 
"glyphicon glyphicon-arrow-up" 
   35        , 
C\Glyph\Glyph::SORT_DESCENDING        => 
"glyphicon glyphicon-arrow-down" 
   36        , 
C\Glyph\Glyph::USER                           => 
"glyphicon glyphicon-user" 
   37        , 
C\Glyph\Glyph::MAIL                           => 
"glyphicon glyphicon-envelope" 
   38        , 
C\Glyph\Glyph::NOTIFICATION           => 
"glyphicon glyphicon-bell" 
   39        , 
C\Glyph\Glyph::TAG                            => 
"glyphicon glyphicon-tag" 
   40        , 
C\Glyph\Glyph::NOTE                           => 
"glyphicon glyphicon-pushpin" 
   41        , 
C\Glyph\Glyph::COMMENT                        => 
"glyphicon glyphicon-comment" 
   45          C\Glyph\Glyph::SETTINGS                       => 
"settings" 
   46        , 
C\Glyph\Glyph::EXPAND                         => 
"expand_content" 
   47        , 
C\Glyph\Glyph::COLLAPSE                       => 
"collapse_content" 
   48        , 
C\Glyph\Glyph::ADD                            => 
"add" 
   49        , 
C\Glyph\Glyph::REMOVE                         => 
"remove" 
   50        , 
C\Glyph\Glyph::UP                                     => 
"up" 
   51        , 
C\Glyph\Glyph::DOWN                           => 
"down" 
   52        , 
C\Glyph\Glyph::BACK                           => 
"back" 
   53        , 
C\Glyph\Glyph::NEXT                           => 
"next" 
   54        , 
C\Glyph\Glyph::SORT_ASCENDING         => 
"sort_ascending" 
   55        , 
C\Glyph\Glyph::SORT_DESCENDING        => 
"sort_descending" 
   56        , 
C\Glyph\Glyph::USER                           => 
"show_who_is_online" 
   57        , 
C\Glyph\Glyph::MAIL                           => 
"mail" 
   58        , 
C\Glyph\Glyph::NOTIFICATION           => 
"notifications" 
   59        , 
C\Glyph\Glyph::TAG                            => 
"tags" 
   60        , 
C\Glyph\Glyph::NOTE                           => 
"notes" 
   61        , 
C\Glyph\Glyph::COMMENT                        => 
"comments" 
   71        $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Glyph\\Factory", $f);
 
   72        $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Glyph\\Glyph", $f->$factory_method(
"http://www.ilias.de"));
 
   81        $g = $f->$factory_method();
 
   83        $this->assertNotNull($g);
 
   84        $this->assertEquals($factory_method, $g->getType());
 
   93        $g = $f->$factory_method(
"http://www.ilias.de");
 
   95        $this->assertNotNull($g);
 
   96        $this->assertEquals(
"http://www.ilias.de", $g->getAction());
 
  105        $g = $f->$factory_method();
 
  107        $this->assertNotNull($g);
 
  108        $this->assertEquals(
null, $g->getAction());
 
  121        $g2 = $g->withHighlight();
 
  123        $this->assertFalse($g->isHighlighted());
 
  124        $this->assertTrue($g2->isHighlighted());
 
  133        $g = $f->$factory_method();
 
  135        $this->assertCount(0, $g->getCounters());
 
  150                $cf->$counter_type($number)
 
  153        $counters = $g->getCounters();
 
  154        $this->assertCount(1, $counters);
 
  156        $this->assertEquals($counter_type, $c->getType());
 
  157        $this->assertEquals($number, $c->getNumber());
 
  170                $cf->status($number_s)
 
  173                $cf->novelty($number_n)
 
  176        $counters = $g->getCounters();
 
  177        $this->assertCount(2, $counters);
 
  178        $vals = array_map(
function ($c) {
 
  179            return array($c->getType(), $c->getNumber());
 
  181        $this->assertContains(array(
"status", $number_s), $vals);
 
  182        $this->assertContains(array(
"novelty", $number_n), $vals);
 
  196                $cf->status($number_s)
 
  199                $cf->novelty($number_n1)
 
  202                $cf->novelty($number_n2)
 
  205        $counters = $g->getCounters();
 
  206        $this->assertCount(2, $counters);
 
  207        $vals = array_map(
function ($c) {
 
  208            return array($c->getType(), $c->getNumber());
 
  210        $this->assertContains(array(
"status", $number_s), $vals);
 
  211        $this->assertContains(array(
"novelty", $number_n2), $vals);
 
  225        $counters = $g->getCounters();
 
  226        $this->assertCount(0, $counters);
 
  232            new \ILIAS\UI\Implementation\Component\Glyph\Glyph(
"FOO", 
"http://www.ilias.de");
 
  233            $this->assertFalse(
"We should not get here");
 
  234        } 
catch (\InvalidArgumentException $e) {
 
  240        return array( array(
C\Glyph\Glyph::SETTINGS)
 
  241            , array(
C\Glyph\Glyph::EXPAND)
 
  242            , array(
C\Glyph\Glyph::COLLAPSE)
 
  243            , array(
C\Glyph\Glyph::ADD)
 
  244            , array(
C\Glyph\Glyph::REMOVE)
 
  245            , array(
C\Glyph\Glyph::UP)
 
  246            , array(
C\Glyph\Glyph::DOWN)
 
  247            , array(
C\Glyph\Glyph::BACK)
 
  248            , array(
C\Glyph\Glyph::NEXT)
 
  249            , array(
C\Glyph\Glyph::SORT_ASCENDING)
 
  250            , array(
C\Glyph\Glyph::SORT_DESCENDING)
 
  251            , array(
C\Glyph\Glyph::USER)
 
  252            , array(
C\Glyph\Glyph::MAIL)
 
  253            , array(
C\Glyph\Glyph::NOTIFICATION)
 
  254            , array(
C\Glyph\Glyph::TAG)
 
  255            , array(
C\Glyph\Glyph::NOTE)
 
  256            , array(
C\Glyph\Glyph::COMMENT)
 
  262        return array( array(
"status")
 
  274        $c = $f->$type(
"http://www.ilias.de");
 
  278        $css_classes = self::$canonical_css_classes[
$type];
 
  279        $aria_label = self::$aria_labels[
$type];
 
  281        $expected = 
"<a class=\"glyph\" href=\"http://www.ilias.de\" aria-label=\"$aria_label\"><span class=\"$css_classes\" aria-hidden=\"true\"></span></a>";
 
  282        $this->assertEquals($expected, 
$html);
 
  293        $c = $fg->mail(
"http://www.ilias.de")->withCounter($fc->$type(42));
 
  297        $css_classes = self::$canonical_css_classes[C\Glyph\Glyph::MAIL];
 
  298        $aria_label = self::$aria_labels[C\Glyph\Glyph::MAIL];
 
  300        $expected = 
"<a class=\"glyph\" href=\"http://www.ilias.de\" aria-label=\"$aria_label\">" .
 
  301                    "<span class=\"$css_classes\" aria-hidden=\"true\"></span>" .
 
  302                    "<span class=\"badge badge-notify il-counter-$type\">42</span>" .
 
  303                    "<span class=\"il-counter-spacer\">42</span>" .
 
  305        $this->assertEquals($expected, 
$html);
 
  313        $c = $fg->mail(
"http://www.ilias.de")
 
  314                ->withCounter($fc->novelty(42))
 
  315                ->withCounter($fc->status(7));
 
  319        $css_classes = self::$canonical_css_classes[C\Glyph\Glyph::MAIL];
 
  320        $aria_label = self::$aria_labels[C\Glyph\Glyph::MAIL];
 
  321        $expected = 
"<a class=\"glyph\" href=\"http://www.ilias.de\" aria-label=\"$aria_label\">" .
 
  322                    "<span class=\"$css_classes\" aria-hidden=\"true\"></span>" .
 
  323                    "<span class=\"badge badge-notify il-counter-status\">7</span>" .
 
  324                    "<span class=\"badge badge-notify il-counter-novelty\">42</span>" .
 
  325                    "<span class=\"il-counter-spacer\">42</span>" .
 
  327        $this->assertEquals($expected, 
$html);
 
  336            $r->render($f->status(0), $this->getDefaultRenderer());
 
  337            $this->assertFalse(
"This should not happen!");
 
  338        } 
catch (\LogicException $e) {
 
  350        $c = $f->$type(
"http://www.ilias.de")
 
  351                ->withOnLoadCode(
function (
$id) use (&$ids) {
 
  358        $this->assertCount(1, $ids);
 
  360        $css_classes = self::$canonical_css_classes[
$type];
 
  361        $aria_label = self::$aria_labels[
$type];
 
  364        $expected = 
"<a class=\"glyph\" href=\"http://www.ilias.de\" aria-label=\"$aria_label\" id=\"$id\"><span class=\"$css_classes\" aria-hidden=\"true\"></span></a>";
 
  365        $this->assertEquals($expected, 
$html);
 
An exception for terminatinating execution or to throw for unit testing.
Test on glyph implementation.
test_dont_render_counter()
test_render_with_on_load_code($type)
@dataProvider glyph_type_provider
test_render_simple($type)
@dataProvider glyph_type_provider
test_with_highlight($counter_type)
@dataProvider counter_type_provider
test_glyph_types($factory_method)
@dataProvider glyph_type_provider
static $canonical_css_classes
test_no_counter($factory_method)
@dataProvider glyph_type_provider
test_render_withTwoCounters()
test_one_counter($counter_type)
@dataProvider counter_type_provider
test_render_withCounter($type)
@dataProvider counter_type_provider
test_immutability_withCounter()
test_implements_factory_interface($factory_method)
@dataProvider glyph_type_provider
test_glyph_no_action($factory_method)
@dataProvider glyph_type_provider
test_glyph_action($factory_method)
@dataProvider glyph_type_provider
Provides common functionality for UI tests.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
if(!array_key_exists('StateId', $_REQUEST)) $id