Wednesday 15 June 2011

php - Testing a class that calls parent::function? -


I have a model which overloads the where function.

My overloaded method looks like this:

  where the public function ($ column, $ operator = zero, $ value = null, $ boolean = 'and') { If (in_array ($ column, $ this-> Metafield)) {$ value = '%' '. $ Column '': ''. $ Value. '' ';' $ Column = 'meta'; $ operator = 'likes';} Return parent: where ($ column, $ operator, $ value, $ boolean) ;} Now, using phpunit and joke, I am trying to check this class, I need to check my surcharge, where function, I really care what the value is that  Parents :: Where ()   

My question is, is it possible / how do I duplicate the original class so that I do $ (= '' Blue '; ("'" "" "" "" ")) -> Once ( ); I'm testing the $ model on the mother (with -> - '' '-' ') - & gt; ([' meta ',' as', '%' color) // model- & Gt; where ('color', 'blue');

I I really care about what values ​​are passed to parents: where ()

No, you do not do this, it's an implementation description in which you can test the unit Exactly v Science does not need to. just relax.

Edit: This was not a joke, although if it is necessary for your design, then you should prejudice on the basis of inheritance so that you are actually "Parent "And therefore inject it, so check this kind of expectation. According to the definition, in the joke a parent of a fake is a class, so in this case the parents have class with overloaded method, not the parents. You can not duplicate "parents" with jokes (and I do not know about any other PHP MacBook library).

No comments:

Post a Comment