承接 phphd/cache-test-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

phphd/cache-test-bundle

最新稳定版本:1.0.0

Composer 安装命令:

composer require --dev phphd/cache-test-bundle

包简介

Clearing Symfony cache pools between test runs

README 文档

README

🧰 Provides Symfony Cache clearing extension for PHPUnit.

Codecov Licence Build Status

Installation ⚒️

  1. Install via composer

    composer require --dev phphd/cache-test-bundle
  2. Enable the bundle in the bundles.php

    PhPhD\CacheTestBundle\PhdCacheTestBundle::class => ['test' => true],
  3. Add PHPUnit extension

        <extensions>
            <extension class="PhPhD\CacheTest\Hook\ClearCachePoolsExtension"/>
        </extensions>

Usage 🚀

It is possible to use this bundle to clear cache pools for any tests that extend Symfony\Bundle\FrameworkBundle\Test\KernelTestCase (WebTestCase, ApiTestCase, etc.)

Use #[ClearPool] attribute in order to clear caches:

use PhPhD\CacheTest\ClearPool;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

#[ClearPool('my_cache_pool')]
final class BlogControllerTest extends WebTestCase
{
    public function testIndex(): void
    {
        $client = static::createClient();
        $client->request('GET', '/en/blog/');

        self::assertResponseIsSuccessful();
    }
}

In the example above, my_cache_pool will be cleared before every test from BlogControllerTest.

统计信息

  • 总下载量: 31
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-18