I'm using PhpSpec to test application Laravel framework. How can I test Api Restful on file Route and post data like when using PHPUnit.
Example :
$res = $this->call('POST', '/articles', [
'alias' => 'This is invalid alias',
'order' => 'invalid',
],[],[], []);
You don't. PhpSpec is for unit tests, while what you're trying to write is an integration test.
From the introduction to PhpSpec:
[...] The technique is to first use a tool like phpspec to describe the behaviour of an object you are about to write. Next you write just enough code to meet that specification and finally you refactor this code.
Use other tools for integration tests. PHPUnit is great for this kind of testing (despite the fact it's got "unit" in the name).