Codeception / c3

Remote CodeCoverage for Codeception. Part of Codeception testing framework.
http://codeception.com
71 stars 46 forks source link

Load autoload_runtime.php if available in c3.php #74

Closed Branlute closed 3 years ago

Branlute commented 3 years ago

Hello,

With Symfony 5.3, a new feature is available, the Runtime Component https://symfony.com/blog/new-in-symfony-5-3-runtime-component

This component generate an autoload_runtime.php which is load into the index.php instead of the autoload.php.

This PR add a condition into c3.php for load autoload_runtime.php instead of autoload.php if the file exist.

Naktibalda commented 3 years ago

I don't think that this change make sense. If application uses Runtime Component, autoload_runtime.php will be included by index.php.

It would make sense to create Runtime for c3 to avoid adding require_once 'c3.php'; line to index.php, but recipe for codeception/c3 does not exit.

Branlute commented 3 years ago

C3 does not work by including autoload.php when autoload_runtime.php is included in index.php.

In this case, can a compatibility be expected for the Runtime Component ?

Naktibalda commented 3 years ago

I meant that your index.php must look like this:

<?php
require_once __DIR__ . '/vendor/autoload_runtime.php';
require __DIR__ . '/vendor/codeception/c3/c3.php';
// more code

or

<?php
require __DIR__ . '/vendor/codeception/c3/c3.php';
require_once __DIR__ . '/vendor/autoload_runtime.php';
// more code
Branlute commented 3 years ago

Yes i known, my index.php look alrealdy like this.

My projet work fine with autoload.php and codeception since a long time if i load c3.php before or after autoload.php. But recently, i use autoload_runtime, and codeception C3 doesnt' work because c3.php load autoload.php before autoload_runtime.php

It's work only when c3.php is load after autoload_runtime.php. Maybe it should be indicated in the Readme.

Naktibalda commented 3 years ago

Have you got the latest version of c3.php ? Similar issue was fixed a month ago.

Branlute commented 3 years ago

Yes, i use the 2.6.4, and all latest versions of codeception's modules.

Branlute commented 3 years ago

I just try with classic index.php with autloload.php and no problem.

And then with autoload_runtime.php, work only with require c3.php after : require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

You can find the two index.php (with autoload.php or autoload_runtime.php here : https://symfony.com/blog/new-in-symfony-5-3-runtime-component