-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControllerTest.php
More file actions
executable file
·46 lines (40 loc) · 1.41 KB
/
ControllerTest.php
File metadata and controls
executable file
·46 lines (40 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php defined('SYSPATH') OR die('Kohana bootstrap needs to be included before tests run');
/**
* Unit tests for internal methods of userguide controller
*
* @group kohana
* @group kohana.userguide
* @group kohana.userguide.controller
*
* @package Kohana/Userguide
* @category Tests
* @author Kohana Team
* @copyright (c) 2008-2013 Kohana Team
* @license http://kohanaframework.org/license
*/
class Userguide_ControllerTest extends Unittest_TestCase
{
public function provider_file_finds_markdown_files()
{
return array(
array('userguide/adding', 'guide/userguide/adding.md'),
array('userguide/adding.md', 'guide/userguide/adding.md'),
array('userguide/adding.markdown', 'guide/userguide/adding.md'),
array('userguide/does_not_exist.md', FALSE)
);
}
/**
* @dataProvider provider_file_finds_markdown_files
* @param string $page Page name passed in the URL
* @param string $expected_file Expected result from Controller_Userguide::file
*/
public function test_file_finds_markdown_files($page, $expected_file)
{
$controller = $this->getMock('Controller_Userguide', array('__construct'), array(), '', FALSE);
$path = $controller->file($page);
// Only verify trailing segments to avoid problems if file overwritten in CFS
$expected_len = strlen($expected_file);
$file = substr($path, -$expected_len, $expected_len);
$this->assertEquals($expected_file, $file);
}
}