mardi 26 avril 2016

API testing in Travis-CI 404 not found

I am trying to setup API Testing in Laravel. We are using travis to automate the build and deploy process. I have tried many different things and up to this point I know that Laravel routing on the travis server does not work.

When the API test attempts to hit an endpoint it always returns 404 not found. I have tried adding "php artisan serve --port=80" to my scripts but it just holds the terminal window and does not continue the rest of the build. The only other option I have considered is to try and point all API calls to the actual URL rather than the masked one so something like ".php?route=something" in plain PHP terms.

I also stumbled upon this post if it helps anyone help me: http://ift.tt/1Syts8W.

I've exhausted all of my options with this one and really need to get this working as it's on a very large project of mine. Any ideas would be greatly appreciated! I have listed one of my tests below.

function it_creates_a_thread()
    {
        $thread = factory(\App\Models\Forum\Thread::class)->make();
        $thread->body = 'Testing';

        $this->authUserPost($this->apiForumResource . '/thread', ['thread' => $thread->toArray()])
            ->seeInDatabase('forum_threads', ['title' => $thread->title])
            ->seeInDatabase('forum_posts', ['body' => $thread->body])
            ->seeJsonContains(['title' => $thread->title]);
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire