Example #1
0
 /**
  * Setup a new Letterpress instance.
  *
  * Please note that there will only be one configuration object used by all
  * letterpress instances. It is however always possible to override specific
  * or all config options on calls to `press()` &c.
  *
  * @param array $config
  */
 public function __construct(array $config = [])
 {
     if (!Config::isInitialized()) {
         Config::init();
     }
     $this->setup($config);
 }
 public function setUp()
 {
     parent::setUp();
     Config::init();
     // NOTE: this explicitly does NOT test media modifiers
     Config::set('letterpress.media.enabled', false);
 }
Example #3
0
    public function testPress()
    {
        $actual = <<<'Markdown'
# Hello World

I am a simpleminded paragraph with no big aims for my life.
Fortunately though, I was blessed with some *emphasis*.

> This is how it always was and always should
> be: Keep making excuses to quote things that don't exist
- Mariella
Markdown;
        $expected = <<<'HTML'
<h1>Hello World</h1>
<p>I am a simple&shy;minded para&shy;graph with no big aims for my life.<br>
Fortunately though, I was blessed with some <em>emphasis</em>.</p>
<figure><blockquote>
<p>This is how it always was and always should
be: Keep making excuses to quote things that don&rsquo;t exist</p>

</blockquote><figcaption>Mari&shy;ella</figcaption></figure>
HTML;
        Config::init();
        $lp = new Letterpress();
        $this->assertEquals($expected, $lp->press($actual));
    }
 public function setUp()
 {
     parent::setUp();
     Config::init();
     Config::set('letterpress.media.enabled', false);
     $this->processor = new MarkupProcessor();
     $this->setUnitUnderTest();
 }
 public function setUp()
 {
     parent::setUp();
     Config::init();
 }
Example #6
0
 /**
  * @expectedException RuntimeException
  * @expectedExceptionMessage Cloning Letterpress\Config is forbidden.
  */
 public function testClone()
 {
     Config::init();
     $cfg = clone Config::instance();
 }