Пример #1
0
 /**
  * @dataProvider  getDoctypeProvider
  */
 public function testGetDoctype($language, $version, $dialect, $xhtml_1_0_compat, $expected)
 {
     $ctx = new RenderContext();
     $ctx->setLanguage($language);
     $ctx->setVersion($version);
     $ctx->setDialect($dialect);
     if ($xhtml_1_0_compat) {
         $ctx->setXHTMLCompatMode($xhtml_1_0_compat);
     }
     $this->assertSame($language, $ctx->getLanguage());
     $this->assertEquals($version, $ctx->getVersion());
     $this->assertSame($dialect, $ctx->getDialect());
     $this->assertEquals($xhtml_1_0_compat, $ctx->getXHTMLCompatMode());
     $this->assertSame($expected, $ctx->getDoctype());
     $ctx = new RenderContext($language, $version, $dialect);
     $this->assertSame($language, $ctx->getLanguage());
     $this->assertEquals($version, $ctx->getVersion());
     $this->assertSame($dialect, $ctx->getDialect());
     $ctx->setCharset('utf-8');
     if ($xhtml_1_0_compat) {
         $ctx->setXHTMLCompatMode($xhtml_1_0_compat);
     }
     $pre_content = $ctx->renderPreContent();
     if ($ctx->getLanguage() == RenderContext::LANG_XML || $ctx->getLanguage() == RenderContext::LANG_XHTML && !$ctx->getXHTMLCompatMode()) {
         $this->assertContains('<' . '?xml version="1.0" encoding="utf-8" ?' . ">\n", $pre_content);
         if ($expected !== '') {
             $this->assertContains($expected, $pre_content);
         }
     } elseif ($pre_content !== '') {
         $this->assertSame($expected . "\n", $pre_content);
     }
 }