2

I'm trying to generate code coverage for my controllers using codeception acceptance tests but when I do run the tests with coverage Laravel doesn't know what to do with this route.

c3.php is setup and included in public/index.php - I've verified the correct page.

 [ErrorException] file_get_contents(http://localhost/c3/report/clear): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error

Are there routes I need to add?

4
  • can you share your acceptance.suite.yml ? Commented Feb 16, 2015 at 9:11
  • The provided link is broken and leading to malicious websites. Please remove. Commented Apr 8, 2019 at 12:03
  • @fkupper Thanks for that report, link removed. Commented Apr 8, 2019 at 20:27
  • @Webnet thanks. Having porn popping up on my screen on my first week in the new job was not nice. Commented Apr 9, 2019 at 7:40

2 Answers 2

2
+50

It's difficult to assess, since there could be a lot of things that might be causing this. I'm not sure it's the routing which is the problem but perhaps the step before that (because it's not a 4xx error). In Laravel, often when I have a 500 problem and especially in regards to routing (well, mod_rewrite) it often has something to do with my .htaccess file.

Have you tried perhaps adding this line

RewriteBase /

after

RewriteEngine On

in the .htaccess file?

Sign up to request clarification or add additional context in comments.

1 Comment

Do not reference this post... SO made me issue the the bounty to an existing answer.
0

For me the solution to get acceptance tests running in Laravel 4.2 is described in this GitHub issue.

codeception.yml

coverage:
    enabled: true
    remote: false
    c3_url: 'http://whatever.dev/c3.php'

routes.php

Route::get('/c3.php/{extra}', function () {
    require base_path('c3.php');
})->where('extra', '.*');

TIP: In the acceptance/functional tests I'm working with I am bootstrapping Laravel as part of the process, so I get full access to Facades and IOC container within the tests which has helped with assertions.

$app = require __DIR__.'/../bootstrap/start.php';
$app->boot();

Note: Using require_once will not work when generating code coverage.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.