Conditions | 1 |
Paths | 1 |
Total Lines | 86 |
Code Lines | 57 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
25 | public function testGetTemplates() { |
||
26 | $expect = array( |
||
27 | 'root' => array( |
||
28 | 'main' => "{$this->base}/module/Root.ss" |
||
29 | ), |
||
30 | 'page' => array( |
||
31 | 'main' => "{$this->base}/module/templates/Page.ss", |
||
32 | 'Layout' => "{$this->base}/module/templates/Layout/Page.ss", |
||
33 | 'themes' => array('theme' => array( |
||
34 | 'main' => "{$this->base}/themes/theme/templates/Page.ss", |
||
35 | 'Layout' => "{$this->base}/themes/theme/templates/Layout/Page.ss" |
||
36 | )) |
||
37 | ), |
||
38 | 'custompage' => array( |
||
39 | 'Layout' => "{$this->base}/module/templates/Layout/CustomPage.ss" |
||
40 | ), |
||
41 | 'customtemplate' => array( |
||
42 | 'main' => "{$this->base}/module/templates/CustomTemplate.ss", |
||
43 | 'myproject' => array( |
||
44 | 'main' => "{$this->base}/myproject/templates/CustomTemplate.ss" |
||
45 | ) |
||
46 | ), |
||
47 | 'subfolder' => array( |
||
48 | 'main' => "{$this->base}/module/subfolder/templates/Subfolder.ss" |
||
49 | ), |
||
50 | 'customthemepage' => array ( |
||
51 | 'Layout' => "{$this->base}/module/templates/Layout/CustomThemePage.ss", |
||
52 | 'themes' => |
||
53 | array( |
||
54 | 'theme' => array('main' => "{$this->base}/themes/theme/templates/CustomThemePage.ss",) |
||
55 | ) |
||
56 | ), |
||
57 | 'mynamespace\myclass' => array( |
||
58 | 'main' => "{$this->base}/module/templates/MyNamespace/MyClass.ss", |
||
59 | 'Layout' => "{$this->base}/module/templates/MyNamespace/Layout/MyClass.ss", |
||
60 | 'themes' => array( |
||
61 | 'theme' => array( |
||
62 | 'main' => "{$this->base}/themes/theme/templates/MyNamespace/MyClass.ss", |
||
63 | ) |
||
64 | ), |
||
65 | ), |
||
66 | 'mynamespace\mysubnamespace\mysubclass' => array( |
||
67 | 'main' => "{$this->base}/module/templates/MyNamespace/MySubnamespace/MySubclass.ss", |
||
68 | ), |
||
69 | 'myclass' => array( |
||
70 | 'main' => "{$this->base}/module/templates/MyNamespace/MyClass.ss", |
||
71 | 'Layout' => "{$this->base}/module/templates/MyNamespace/Layout/MyClass.ss", |
||
72 | 'themes' => array( |
||
73 | 'theme' => array( |
||
74 | 'main' => "{$this->base}/themes/theme/templates/MyNamespace/MyClass.ss", |
||
75 | ) |
||
76 | ), |
||
77 | ), |
||
78 | 'mysubclass' => array( |
||
79 | 'main' => "{$this->base}/module/templates/MyNamespace/MySubnamespace/MySubclass.ss", |
||
80 | ), |
||
81 | 'include' => array('themes' => array( |
||
82 | 'theme' => array( |
||
83 | 'Includes' => "{$this->base}/themes/theme/templates/Includes/Include.ss" |
||
84 | ) |
||
85 | )) |
||
86 | ); |
||
87 | |||
88 | $expectTests = $expect; |
||
89 | $expectTests['test'] = array( |
||
90 | 'main' => "{$this->base}/module/tests/templates/Test.ss" |
||
91 | ); |
||
92 | |||
93 | $manifest = $this->manifest->getTemplates(); |
||
94 | $manifestTests = $this->manifestTests->getTemplates(); |
||
95 | |||
96 | ksort($expect); |
||
97 | ksort($expectTests); |
||
98 | ksort($manifest); |
||
99 | ksort($manifestTests); |
||
100 | |||
101 | $this->assertEquals( |
||
102 | $expect, $manifest, |
||
103 | 'All templates are correctly loaded in the manifest.' |
||
104 | ); |
||
105 | |||
106 | $this->assertEquals( |
||
107 | $expectTests, $manifestTests, |
||
108 | 'The test manifest is the same, but includes test templates.' |
||
109 | ); |
||
110 | } |
||
111 | |||
142 |