Land's series seems to gain momentum with every installment, and his latest is as timely and extravagantly plotted as ever. Ben, a rugged Palestinian-American detective, and Danielle, a beautiful former Israeli police inspector, soon discover that the massacre has little to do with current tensions between Israelis and Palestinians. Instead, the attack is rooted in a discovery made by Allied soldiers in The mysterious cache of steel canisters uncovered under stacks of corpses at Buchenwald pulses beneath the present-day action like a ticking time bomb.
Everyone who has come into contact with the canisters in the half-century since their discovery has wound up dead, and a Nostradamus prophecy of universal destruction adds another layer of menace to the tale. Ben and Danielle's investigation leads them into conflict with renegades all over the globe, including the last vestiges of the Iraqi Special Republican Guard and a network of rogue ex-Soviet moles.
Land's prose can be a little overheated, but the breakneck pace and chockablock plotting leave protagonists and the civilized world constantly teetering on the brink of destruction.
Highly entertaining from start to finish, this is prime escapist fiction, implausible yet riveting. There are 2 interesting calls - willExtend and willImplement. The first one tells object prophecy that our object should extend specific class, the second one says that it should implement some interface. Obviously, objects in PHP can implement multiple interfaces, but extend only one parent class. Ok, now we have our object prophecy.
What can we do with it? First of all, we can get our object dummy by revealing its prophecy:. The key point about dummies is that they do not hold any logic - they just do nothing. Any method of the dummy will always return null and the dummy will never throw any exceptions.
Dummy is your friend if you don't care about the actual behavior of this double and just need a token object to satisfy a method typehint. You need to understand one thing - a dummy is not a prophecy. Ok, now we know how to create basic prophecies and reveal dummies from them. That's awesome if we don't care about our doubles objects that reflect originals interactions.
If we do, we need to use stubs or mocks. A stub is an object double, which doesn't have any expectations about the object behavior, but when put in specific environment, behaves in specific way. Ok, I know, it's cryptic, but bear with me for a minute. Simply put, a stub is a dummy, which depending on the called method signature does different things has logic.
To create stubs in Prophecy:. Oh wow.
We've just made an arbitrary call on the object prophecy? Yes, we did. And this call returned us a new object instance of class MethodProphecy.
Nostradamus: The Last Prophecy is an adventure video game released in that was developed by Kheops, Mzone and Totm. It was a co-production by. All are touched upon in Nostradamus: The Last Prophecy. The player is immortalized as a profiler of sorts in this treasure hunt game - a brilliantly vivid historical rendition of the acclaimed quatrains of Nostradamus. “I was both pleased and impressed, as Nostradamus: The Last.
Yep, that's a specific method with arguments prophecy. Method prophecies give you the ability to create method promises or predictions. We'll talk about method predictions later in the Mocks section. As a matter of fact, the call that we made earlier willReturn 'value' is a simple shortcut to:. This promise will cause any call to our double's read method with exactly one argument - '' to always return 'value'.
But that's only for this promise, there's plenty others you can use:. Prophecy enforces same method prophecies and, as a consequence, same promises and predictions for the same method calls with the same arguments. This means:. That's interesting, right? Now you might ask me how would you define more complex behaviors where some method call changes behavior of others. In Prophecy, you'll use promises for that:.
And now it doesn't matter how many times or in which order your methods are called. What matters is their behaviors and how well you faked it. Note: If the method is called several times, you can use the following syntax to return different values for each call:. This feature is actually not recommended for most cases. Relying on the order of calls for the same arguments tends to make test fragile, as adding one more call can break everything.
The previous example is awesome at least I hope it is for you , but that's not optimal enough. We hardcoded 'everzet' in our expectation. Isn't there a better way?
In fact there is, but it involves understanding what this 'everzet' actually is. You see, even if method arguments used during method prophecy creation look like simple method arguments, in reality they are not. They are argument token wildcards. And yes, those classnames are damn big. ExactValueToken is not very useful in our case as it forced us to hardcode the username. That's why Prophecy comes bundled with a bunch of other tokens:.
And you can add even more by implementing TokenInterface with your own custom classes. That's it. We've just described how our stub object should behave, even though the original object could have no behavior whatsoever. Your stub will continue behaving the way it did before. That's because of how arguments wildcarding works. Every argument token type has a different score level, which wildcard then uses to calculate the final arguments match score and use the method prophecy promise that has the highest score.
In this case, Argument::type in case of success scores 5 and Argument::any scores 3. So the type token wins, as does the first setName method prophecy and its promise. The simple rule of thumb - more precise token always wins. As you might see, the only difference between how we get dummies and stubs is that with stubs we describe every object conversation instead of just agreeing with null returns object being dummy.
As a matter of fact, after you define your first promise method call , Prophecy will force you to define all the communications - it throws the UnexpectedCallException for any call you didn't describe with object prophecy before calling it on a stub. Now we know how to define doubles without behavior dummies and doubles with behavior, but no expectations stubs. What's left is doubles for which we have some expectations.
These are called mocks and in Prophecy they look almost exactly the same as stubs, except that they define predictions instead of promises on method prophecies:. The shouldBeCalled method here assigns CallPrediction to our method prophecy. Predictions are a delayed behavior check for your prophecies.