class
MyTest
extends
DatabaseTestCase {
public function
getDataSet
() {
return new
ArrayDataSet([]);
}
}
The internal code of PHPUnit has not been modified, but now it is able to process pure PHP
arrays as data sets.
¹⁴
https://github.com/mrkrstphr/dbunit-fixture-arrays
.
Why does OCP matter?
The benefit of the Open/Closed Principle is that it limits the direct modification of existing source
code. The more often code is changed, the more likely it is to introduce unintended side effects
and cause defects. When the code is extended as in the examples above, the scope for potential
defects is limited to the specific code using the extension.
Do'stlaringiz bilan baham: |