Conditions | 1 |
Paths | 1 |
Total Lines | 120 |
Code Lines | 116 |
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 |
||
64 | $this->setExpectedException( |
||
65 | \Dennis\Seeder\Provider\NotFoundException::class |
||
66 | ); |
||
67 | $this->subject->guessProviderName(''); |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @method guessProviderName |
||
72 | * @test |
||
73 | * @throws \Dennis\Seeder\Provider\NotFoundException |
||
74 | */ |
||
75 | public function guessProviderNameReturnsProvidername() |
||
76 | { |
||
77 | $this->assertSame('postcode', $this->subject->guessProviderName('zip')); |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @method guessProviderNameByKey |
||
82 | * @test |
||
83 | * @throws \Dennis\Seeder\Provider\NotFoundException |
||
84 | */ |
||
85 | public function guessProviderNameByKeyReturnsNullIfNotFound() |
||
86 | { |
||
87 | $this->assertSame(null, $this->subject->guessProviderName('doesnotexist')); |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * @method get |
||
92 | * @test |
||
93 | * @throws \Dennis\Seeder\Provider\NotFoundException |
||
94 | */ |
||
95 | public function getThrowsExceptionIfNoProviderWasFound() |
||
96 | { |
||
97 | $this->setExpectedException(\Dennis\Seeder\Provider\NotFoundException::class); |
||
98 | $this->subject->get('doesnotexist'); |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * @method get |
||
103 | * @test |
||
104 | * @throws \Dennis\Seeder\Provider\NotFoundException |
||
105 | */ |
||
106 | public function getZipReturnsPostcode() |
||
107 | { |
||
108 | $this->assertSame('49766-3666', $this->subject->get('zip')); |
||
109 | } |
||
110 | |||
111 | /** |
||
112 | * @method get |
||
113 | * @test |
||
114 | * @throws \Dennis\Seeder\Provider\NotFoundException |
||
115 | */ |
||
116 | public function getPostcodeReturnsPostcode() |
||
117 | { |
||
118 | $this->assertSame('49766-3666', $this->subject->get('postcode')); |
||
119 | } |
||
120 | |||
121 | /** |
||
122 | * @method get |
||
123 | * @test |
||
124 | * @throws \Dennis\Seeder\Provider\NotFoundException |
||
125 | */ |
||
126 | public function getPostcodeWithUnderscoreReturnsPostcode() |
||
127 | { |
||
128 | $this->assertSame('49766-3666', $this->subject->get('post_code')); |
||
129 | } |
||
130 | |||
131 | /** |
||
132 | * @method get |
||
133 | * @test |
||
134 | * @throws \Dennis\Seeder\Provider\NotFoundException |
||
135 | */ |
||
136 | public function getPostcodeWithWeiredCaseReturnsPostcode() |
||
137 | { |
||
138 | $this->assertSame('49766-3666', $this->subject->get('poSt_COde')); |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * @method get |
||
143 | * @test |
||
144 | * @throws \Dennis\Seeder\Provider\NotFoundException |
||
145 | */ |
||
146 | public function getPostcodeWithUpperCaseReturnsPostcode() |
||
147 | { |
||
148 | $this->assertSame('49766-3666', $this->subject->get('POSTCODE')); |
||
149 | } |
||
150 | |||
151 | /** |
||
152 | * @method get |
||
153 | * @test |
||
154 | * @throws \Dennis\Seeder\Provider\NotFoundException |
||
155 | */ |
||
156 | public function guessProviderNameReturnsNullWithSkippedFieldName() |
||
157 | { |
||
158 | $skippedFieldName = 'l10n_parent'; |
||
159 | $this->assertSame(null, $this->subject->guessProviderName($skippedFieldName)); |
||
160 | } |
||
161 | |||
162 | /** |
||
163 | * @method __call |
||
164 | * @test |
||
165 | */ |
||
166 | public function returnCustomDataIfCustomProviderIsAvailable() |
||
167 | { |
||
168 | $this->assertSame('customData', $this->subject->getCustomData()); |
||
169 | } |
||
170 | } |
||
171 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.