container); $projectModel = new ProjectModel($this->container); $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertTrue($projectModel->enablePublicAccess(1)); $this->assertEquals(1, $taskCreationModel->create(array('title' => 'Task #1', 'project_id' => 1))); $project = $projectModel->getById(1); $this->assertEquals('
Test
', $helper->markdown('Test')); $this->assertEquals( 'Task #123
', $helper->markdown('Task #123') ); $this->assertEquals( 'Task #123
', $helper->markdown('Task #123', true) ); $this->assertEquals( 'Task #1
', $helper->markdown('Task #1', true) ); $this->assertEquals( '', $helper->markdown( 'Check that: http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454' ) ); } public function testMarkdownUserLink() { $h = new TextHelper($this->container); $this->assertEquals('Text @admin @notfound
', $h->markdown('Text @admin @notfound')); $this->assertEquals('Text @admin,
', $h->markdown('Text @admin,')); $this->assertEquals('Text @admin!
', $h->markdown('Text @admin!')); $this->assertEquals('Text @admin?
', $h->markdown('Text @admin? ')); $this->assertEquals('Text @admin.
', $h->markdown('Text @admin.')); $this->assertEquals('Text @admin: test
', $h->markdown('Text @admin: test')); $this->assertEquals('Text @admin @notfound
', $h->markdown('Text @admin @notfound', true)); } public function testMarkdownAttribute() { $helper = new TextHelper($this->container); $this->assertEquals('<p>Ça marche</p>', $helper->markdownAttribute('Ça marche')); $this->assertEquals('<p>Test with "double quotes"</p>', $helper->markdownAttribute('Test with "double quotes"')); $this->assertEquals('<p>Test with 'single quotes'</p>', $helper->markdownAttribute("Test with 'single quotes'")); } public function testFormatBytes() { $h = new TextHelper($this->container); $this->assertEquals('1k', $h->bytes(1024)); $this->assertEquals('33.71k', $h->bytes(34520)); } public function testContains() { $h = new TextHelper($this->container); $this->assertTrue($h->contains('abc', 'b')); $this->assertFalse($h->contains('abc', 'd')); } public function testInList() { $h = new TextHelper($this->container); $this->assertEquals('?', $h->in('a', array('b' => 'c'))); $this->assertEquals('c', $h->in('b', array('b' => 'c'))); } }