Conditions | 1 |
Paths | 1 |
Total Lines | 60 |
Code Lines | 35 |
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 |
||
45 | public function testPublishing() |
||
46 | { |
||
47 | // Check that write updates Stage |
||
48 | |||
49 | $item = new SearchVariantVersionedTest_Item(array('TestText' => 'Foo')); |
||
50 | $item->write(); |
||
51 | |||
52 | SearchUpdater::flush_dirty_indexes(); |
||
53 | $this->assertEquals(array( |
||
54 | array('ID' => $item->ID, '_versionedstage' => 'Stage') |
||
55 | ), self::$index->getAdded(array('ID', '_versionedstage'))); |
||
56 | |||
57 | // Check that publish updates Live |
||
58 | |||
59 | self::$index->reset(); |
||
60 | |||
61 | $item->copyVersionToStage('Stage', 'Live'); |
||
62 | |||
63 | SearchUpdater::flush_dirty_indexes(); |
||
64 | $this->assertEquals(array( |
||
65 | array('ID' => $item->ID, '_versionedstage' => 'Stage'), |
||
66 | array('ID' => $item->ID, '_versionedstage' => 'Live') |
||
67 | ), self::$index->getAdded(array('ID', '_versionedstage'))); |
||
68 | |||
69 | // Just update a SiteTree field, and check it updates Stage |
||
70 | |||
71 | self::$index->reset(); |
||
72 | |||
73 | $item->Title = "Pow!"; |
||
74 | $item->write(); |
||
75 | |||
76 | SearchUpdater::flush_dirty_indexes(); |
||
77 | |||
78 | $expected = array(array( |
||
79 | 'ID' => $item->ID, |
||
80 | '_versionedstage' => 'Stage' |
||
81 | )); |
||
82 | $added = self::$index->getAdded(array('ID', '_versionedstage')); |
||
83 | $this->assertEquals($expected, $added); |
||
84 | |||
85 | // Test unpublish |
||
86 | |||
87 | self::$index->reset(); |
||
88 | |||
89 | $item->deleteFromStage('Live'); |
||
90 | |||
91 | SearchUpdater::flush_dirty_indexes(); |
||
92 | |||
93 | $this->assertCount(1, self::$index->deleted); |
||
94 | $this->assertEquals( |
||
95 | SiteTree::class, |
||
96 | self::$index->deleted[0]['base'] |
||
97 | ); |
||
98 | $this->assertEquals( |
||
99 | $item->ID, |
||
100 | self::$index->deleted[0]['id'] |
||
101 | ); |
||
102 | $this->assertEquals( |
||
103 | 'Live', |
||
104 | self::$index->deleted[0]['state'][SearchVariantVersioned::class] |
||
105 | ); |
||
141 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths