Closed ESmith92 closed 9 years ago
Also where do the SearchEngineSpec functions get called when the test is run? aka how do I add my own spec test?
We use PhpSpec which will automatically do magic for you. When following the PhpSpec convention, PhpSpec will automatically run all of your tests (you don't have to "add" your spec test to any sort of list of test).
It will also automagically make the Test object (IE, SearchEngineTest or w/e its called) an instance of SearchEngine.
It's magic! :zap:
alright, but how does the $this in the test end up as an instance of SearchEngine? so that $this->handle_request calls SearchEngine's handle_request function?
One more question: it will test my branch as well or do I need to put it in my local develop branch to test it?
I recommend reading this: http://www.phpspec.net/en/latest/manual/getting-started.html
Specifically this line might clear up some confusion:
phpspec searches for these methods in your specification to run.
So if you are writing SearchItemSpec, then it will look for handle
if we call $this->handle
in SearchItem
. It's called meta programming iirc.
For your other question, TravisCI will run PhpSpec for anything that you push to Github. You can run PhpSpec locally on your machine as well.
k, thank you
How does $this know to be an instance of the SearchEngine? does the test case of $this->shouldHaveType( 'SearchApi\SearchEngine' ); assign $this to a SearchEngine instance?