Beispiel #1
0
 /**
  *
  */
 public function testEmptyGlobalContext()
 {
     $ctxs = array();
     while ($ctx = RenderContext::pop()) {
         $ctxs[] = $ctx;
     }
     $ctx = RenderContext::get();
     $this->assertSame(null, $ctx);
     $ctxs = array_reverse($ctxs);
     foreach ($ctxs as $ctx) {
         RenderContext::push($ctx);
     }
 }
Beispiel #2
0
 /**
  * @dataProvider  truncateProvider()
  */
 public function testTruncate($text, $length, $boundary, $ellipsis, $extension, $text_mode, $expected)
 {
     if ($text_mode) {
         $ctx = new RenderContext();
         $ctx->setLanguage(RenderContext::LANG_TEXT);
         RenderContext::push($ctx);
     } else {
         $this->assertSame(RenderContext::get()->getLanguage(), RenderContext::LANG_HTML, 'Wrong RenderContext!');
     }
     $this->assertSame($expected, String::truncate($text, $length, $boundary, $ellipsis, $extension));
     if ($text_mode) {
         RenderContext::pop();
     }
 }