SymfonyTest/symfony-bundle-test

Are we ready for 2.0?

Closed this issue · 7 comments

FYI @chapterjason

Is there something else we should change before releasing 2.0 beta1?

@Nyholm I actually wrote you on twitter some seconds ago. 😄

I have some Ideas to make the implementation much simpler and support a lot more Symfony features.
It will also rely more on the actual Symfony implementation and reduces the amount of duplicated code (MicroKernelTrait).

I tested that already against 5.3 and 6.0 cause I created a fork to continue some work on other projects.
I create a PR the next hours/days.

@Nyholm Another thing I came across was the use of the system tmp directory. I don't know how much this is managed and will cleared by different systems. For a CI it doesn't care, but they will fill up fast locally.

[...]/T/NyholmBundleTest
❯ ls
cache6120433999c571.51203996	cache61204e5b602718.67344140	cache612052559edf14.62561566	cache612056462fc9b6.02927090
cache612047522ccb42.47974958	cache61204fa0003d11.24332267	cache612052784e2518.53922131	cache612056466d9151.77068458
cache612047527b37e9.69638632	cache61204fa00a8d32.65886088	cache612052a2c25a63.00646220	cache6120564691fb99.34873491
cache612047529db067.71511423	cache61204fa00b0033.59059590	cache612052cac90d24.09728916	cache61205646b58455.18855355
cache61204752c0b368.48739614	cache61204fa00b6a63.08512753	cache612052f025d423.18207783	cache61205646d93dd2.43489213
cache61204752e42dd5.84355230	cache61204fa00be451.71348500	cache612052f64da1a8.04471361	cache6120564707dab8.77674914
cache6120475314c629.32387482	cache61204fa00c5449.77622796	cache612052f65976b9.78140141	cache61205684ab51e2.39229639
cache6120476ec4beb1.50979856	cache612050247b7358.59409843	cache612052f65a7134.45876660	cache612056bb58db07.32805435
cache6120476f0b6908.73387894	cache612050249d5937.06833376	cache612052f65c3659.73582556	cache612510940512a0.71680620
cache6120476f30d517.39263890	cache61205024af50f7.71388588	cache612052f65e0058.58762661	cache6125109451ff04.57552014
cache6120476f534380.77107160	cache61205024c3a357.61067497	cache612052f65fbeb8.10772173	cache612510947637c0.70982268
cache6120476f76dcc2.81328234	cache61205024d94b87.11240231	cache6120531da40a91.37689646	cache612510949810d6.32764719
cache6120476f9e0de4.26235296	cache61205024ede048.85940541	cache6120531daf75e5.05347270	cache61251094bbcd26.59826543
cache61204e5aded1a8.09640417	cache61205254ca9f33.65006694	cache6120531db04dd4.26165736	cache61251094dcc2e8.38105483
cache61204e5b135ac7.56709897	cache612052550e9ce0.12214133	cache6120531db1e777.21424216	log
cache61204e5b263981.09658869	cache61205255338aa6.22508356	cache6120531db36ee6.56939110
cache61204e5b399056.16821110	cache61205255569dc1.74542842	cache6120531db4eb43.73279016
cache61204e5b4c0b39.88050938	cache612052557b1d95.48297182	cache61205331e6ffa0.78628606
❯ du -sh .
2.2M	.

And these wasn't that much test runs (vendor/bin/phpunit), every single test will create a directory.
A possible solution I used was:

use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\Kernel;

class TestKernel extends Kernel {

    /// [...]

    public function shutdown(): void
    {
        parent::shutdown();

        $cacheDirectory = $this->getCacheDir();
        $logDirectory = $this->getLogDir();

        $filesystem = new Filesystem();

        if ($filesystem->exists($cacheDirectory)) {
            $filesystem->remove($cacheDirectory);
        }

        if ($filesystem->exists($logDirectory)) {
            $filesystem->remove($logDirectory);
        }
    }
}

Yeah. I'll be happy to add a cleanup.

The reason we create a new directory is to make sure the cache is empty.

@Nyholm I think after them we are ready.

  • #58
  • #59
  • Changes in readme you wanted to make?

Let's sneak out with a beta first to try things out a little. =)

Noticed the PR symfony/symfony#42991

I think we should add 5.4 dev for the pipeline and should check that the tests still successful after merge.

I would like to also think about this task: SymfonyTest/SymfonyConfigTest#70