Codeception / c3

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

Move C3 code to separate class #72

Closed marcovtwout closed 1 year ago

marcovtwout commented 3 years ago

This PR is a first step in improving https://github.com/Codeception/c3/issues/40 Instead of having a copy of c3.php in the project root it can be included from any location.

Basic usage:


require __DIR__ . '/vendor/autoload.php'; // If using Composer
//require __DIR__ . '/vendor/codeception/c3/c3.php'; // Or include it directly

$c3 = new Codeception\C3(__DIR__); // pass the directory that contains Codeception config files
$c3->run();

I only made the minimal changes to test this concept. Best to disable whitespace comparison when reviewing this PR.

There's more to be improved after this:

DavertMik commented 3 years ago

Thanks @marcovtwout Looks really nice!

I like the idea but it must be tested very well before releasing. Unfortunately, we have only basic tests on Codeception Ci pipeline. If we release this as a major version and c3 will be installed only from Composer I think this will be fine for most setups. Anyway, I need to see that this works and maybe we could release it as beta and ask volunteers to test it.

marcovtwout commented 3 years ago

@DavertMik Thanks for the feedback :)

Here's a preview with some of the improvements I mentioned already applied: https://github.com/marcovtwout/c3/pull/1/commits And a quick link to the full file: https://github.com/marcovtwout/c3/blob/class_based_c3_improvements/c3.php

Since you are thinking about a new major version anyways, perhaps legacy compatibility parts can be removed as well?

marcovtwout commented 1 year ago

@DavertMik @Naktibalda I revisited this PR after some time has passed. Seems to me this is still a good basis for further improvements.

I created a new PR basing the same changes on the actual version of main: https://github.com/Codeception/c3/pull/85