Typography = new TypographyHelper(new View(null)); } /** * tearDown method * * @return void */ public function tearDown() { unset($this->Typography); parent::tearDown(); } /** * testFormatCharacter method * * @return void */ public function testFormatCharacter() { $strs = array( '"double quotes"' => '“double quotes”', '"testing" in "theory" that is' => '“testing” in “theory” that is', "Here's what I'm" => 'Here’s what I’m', '&' => '&', '&' => '&', ' ' => ' ', '--' => '—', 'foo...' => 'foo…', 'foo..' => 'foo..', 'foo...bar.' => 'foo…bar.', 'test. new' => 'test.  new', ); foreach ($strs as $str => $expected) { $result = $this->Typography->formatCharacters($str); echo pre($result); $this->assertEquals($expected, $result); } //$this->tearDown(); //$this->setUp(); Configure::write('Typography.locale', 'low'); $strs = array( '"double quotes"' => '„double quotes‟', '"testing" in "theory" that is' => '„testing‟ in „theory‟ that is', "Here's what I'm" => 'Here‛s what I‛m', ); foreach ($strs as $str => $expected) { $result = $this->Typography->formatCharacters($str); echo pre($result); $this->assertEquals($expected, $result); } } /** * testAutoTypography method * * @return void */ public function testAutoTypography() { $str = 'Some \'funny\' and "funky" test with a new paragraph and a new line tabbed in.'; $res = $this->Typography->autoTypography($str); echo pre($res); debug($res); } /** * testNl2brExceptPre method * * @return void */ public function testNl2brExceptPre() { $str = << I am inside a pre tag. Please don't mess with me. k? That's my story and I'm sticking to it. The End. EOH; $expected = <<
I like to skip.

Jump

and sing.

I am inside a pre tag. Please don't mess with me.

k?


That's my story and I'm sticking to it.

The End. EOH; $result = $this->Typography->nl2brExceptPre($str); $this->assertEquals($expected, $result); } }