Conditions | 1 |
Paths | 1 |
Total Lines | 112 |
Code Lines | 67 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 |
||
27 | { |
||
28 | $this->container->setParameter( |
||
29 | 'kernel.bundles', |
||
30 | array() |
||
31 | ); |
||
32 | $this->load(array('document_tree' => array())); |
||
33 | |||
34 | $this->assertContainerBuilderHasParameter( |
||
35 | 'sonata_admin_doctrine_phpcr.tree_block.configuration', |
||
36 | array( |
||
37 | 'routing_defaults' => array(), |
||
38 | 'repository_name' => 'default', |
||
39 | 'sortable_by' => 'position', |
||
40 | 'move' => false, |
||
41 | 'reorder' => false, |
||
42 | ) |
||
43 | ); |
||
44 | } |
||
45 | |||
46 | public function testDocumentTreeEnableMoveAndReorder() |
||
47 | { |
||
48 | $this->container->setParameter( |
||
49 | 'kernel.bundles', |
||
50 | array() |
||
51 | ); |
||
52 | $this->load( |
||
53 | array('document_tree' => array('move' => array('enabled' => true, 'reorder' => true))) |
||
54 | ); |
||
55 | |||
56 | $this->assertContainerBuilderHasParameter( |
||
57 | 'sonata_admin_doctrine_phpcr.tree_block.configuration', |
||
58 | array( |
||
59 | 'routing_defaults' => array(), |
||
60 | 'repository_name' => 'default', |
||
61 | 'sortable_by' => 'position', |
||
62 | 'move' => true, |
||
63 | 'reorder' => true, |
||
64 | ) |
||
65 | ); |
||
66 | } |
||
67 | } |
||
68 |