unit testing - PhpSpec expected call exact -


I have a way for my Laravel5 application, I am trying to test in PhpSpec but this is the following error Throwing:

  App / Heders / Recurring 37! It should return the recurrence collection method call: double \ church repository interface \ P6-> Expected calls are: MatchChurchTimeZone (exact (1))  

The method has passed an array, and I want to duplicate that The model's childprimazion system gives a timezone.

method:

  public function __ composition (rule $ rules, arrrtransformer $ simplified conversion, church registry entry interface $ church) {$ this- & gt; Rule = $ rule; $ This- & gt; Array Tranceformer = $ arrayTransformer; $ This- & gt; Church = $ Church; } Public event getRecurrenceCollection ($ schedule) {$ timezone = $ this- & gt; Church- & gt; GetChurchTimezone ($ schedule ['church_id']); // more code}  

In my other specs, I often use the $ double-> Method ('someArgument') - gt; I am talking like willReturn ('blah'). , but for some reason this specific case is not working and why not amazed me.

I have tried to give it a copy of the array, I have tried to give it an integer straight, I tried it $> -> church-> Chyachchurch timezone in my own method And tried to pass it an array or an integer, but it does not matter that PhpSpec definitely comes back with a 'exact' on expected call error.

Tip: Expands the square RecurrRuleSpec objectbiver {Secure $ schedule = ['Church_ID' = & gt; 1, 'Start' = & gt; '2014-11-21 10:36:07', 'end' => '2014-11-21 11:36:07', 'Recur_url ='> 'FREQ = Weekly; BYDAY = SU; ',' recurr_until '=> '2015-02-22 10:36:07,'; Function it_is_initializable () {$ this- & gt; Should type ('app' helpers 'recursive rules'); } / ** * Set our confirmation, give / function with a couple matching our constructor ($ rule, $ arrayTransformer, $ church) {$ rule- & gt; BeadoubleOf ('\ Recurr \ rule'); $ ArrayTransformer-> BeadoubleOf ('\ Recurr \ Transformer \ ArrayTransformer'); $ Church & gt; BeADoubleOf ('\ Application \ data archive location \ ChurchRepositoryInterface'); $ This- & gt; Structured ($ rule, $ arrayTransformer, $ church); } Function it_should_return_a_recurrence_collection ($ rules, $ arrayTransformer, $ church) {$ church-> GetChurchTimeZone (1) - & gt; Will Ritter ('Europe / Dublin'); // $ Church- & gt; MilchchurchTimeJohn ($ this-> Schedule ['Church_ID']) - & gt; Will Return ('Europe / Dublin'); // $ Church- & gt; Match Chart Time Zone (Logic :: Any) - & gt; Will Ritter ('Europe / Dublin'); $ Rule- & gt; CreateFromString () - & gt; WillReturn ([]); $ ArrayTransformer-> Change () - & gt; WillReturn ([]); $ This- & gt; GetRecurrenceCollection ($ this-> Schedule) - & gt; ShouldReturn ([]); }

There is another example of elsewhere in my app that uses the same approach and pass

  function it_should_return_a_one_dimensional_numeric_array_of_servers ($ config) {$ expectResult = ['Domain.com', 'domain2.com']; $ Config- & gt; Get ('server') - & gt; WillReturn ($ this-> ConfigGetReturn); $ This- & gt; ServerArray () - & gt; ShouldBeArray (); $ This- & gt; ServerArray () - & gt; ShouldEqual ($ expectedResult); }   

You have written the name of the code in separate code and: GetChurchTimeZone / GetChurchTimezone

In fact the error message is in:

  getChurchTimezone (1) was not expected. The expected calls are: - getChurchTimeZone (exact (1)) By the way, you can take advantage of some PhpSpec magic by writing your let () function like this:  < Give pre>  function (rule $ rules, arrrtransformer $ simplified conversion, ChurchRegository interface $ church) {$ this- & gt; May be with Konststead ($ rules, $ arrayTransformer, $ church); }  

PhpSpec automatically shows the expected socks from type-points in let () signature.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -