22 | | function test_get_file_data() { |
23 | | $theme_headers = array( |
24 | | 'Name' => 'Theme Name', |
25 | | 'ThemeURI' => 'Theme URI', |
26 | | 'Description' => 'Description', |
27 | | 'Version' => 'Version', |
28 | | 'Author' => 'Author', |
29 | | 'AuthorURI' => 'Author URI', |
30 | | ); |
31 | | |
32 | | $actual = get_file_data( DIR_TESTDATA . '/themedir1/default/style.css', $theme_headers ); |
| 31 | public function test_get_file_data( $file, $headers, $context, $expected ) { |
34 | | $expected = array( |
35 | | 'Name' => 'WordPress Default', |
36 | | 'ThemeURI' => 'http://wordpress.org/', |
37 | | 'Description' => 'The default WordPress theme based on the famous <a href="http://binarybonsai.com/kubrick/">Kubrick</a>.', |
38 | | 'Version' => '1.6', |
39 | | 'Author' => 'Michael Heilemann', |
40 | | 'AuthorURI' => 'http://binarybonsai.com/', |
41 | | ); |
| 33 | $actual = get_file_data( DIR_TESTDATA . $file, $headers, $context ); |
51 | | function test_get_file_data_cr_line_endings() { |
52 | | $headers = array( 'SomeHeader' => 'Some Header', 'Description' => 'Description', 'Author' => 'Author' ); |
53 | | $actual = get_file_data( DIR_TESTDATA . '/formatting/cr-line-endings-file-header.php', $headers ); |
54 | | $expected = array( |
55 | | 'SomeHeader' => 'Some header value!', |
56 | | 'Description' => 'This file is using CR line endings for a testcase.', |
57 | | 'Author' => 'A Very Old Mac', |
| 54 | public function data_test_get_data_file() { |
| 55 | return array( |
| 56 | array( |
| 57 | '/themedir1/page-templates/template-header.php', |
| 58 | array( |
| 59 | 'Template Name' => 'Template Name', |
| 60 | ), |
| 61 | '', |
| 62 | array( |
| 63 | 'Template Name' => 'This Template Header Is On One Line', |
| 64 | ), |
| 65 | ), |
| 66 | array( |
| 67 | '/themedir1/default/style.css', |
| 68 | array( |
| 69 | 'Name' => 'Theme Name', |
| 70 | 'ThemeURI' => 'Theme URI', |
| 71 | 'Description' => 'Description', |
| 72 | 'Version' => 'Version', |
| 73 | 'Author' => 'Author', |
| 74 | 'AuthorURI' => 'Author URI', |
| 75 | ), |
| 76 | '', |
| 77 | array( |
| 78 | 'Name' => 'WordPress Default', |
| 79 | 'ThemeURI' => 'http://wordpress.org/', |
| 80 | 'Description' => 'The default WordPress theme based on the famous <a href="http://binarybonsai.com/kubrick/">Kubrick</a>.', |
| 81 | 'Version' => '1.6', |
| 82 | 'Author' => 'Michael Heilemann', |
| 83 | 'AuthorURI' => 'http://binarybonsai.com/', |
| 84 | ), |
| 85 | ), |
| 86 | array( |
| 87 | '/formatting/cr-line-endings-file-header.php', |
| 88 | array( |
| 89 | 'SomeHeader' => 'Some Header', |
| 90 | 'Description' => 'Description', |
| 91 | 'Author' => 'Author', |
| 92 | ), |
| 93 | '', |
| 94 | array( |
| 95 | 'SomeHeader' => 'Some header value!', |
| 96 | 'Description' => 'This file is using CR line endings for a testcase.', |
| 97 | 'Author' => 'A Very Old Mac', |
| 98 | ), |
| 99 | ), |