kununu/testing-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

kununu/testing-bundle

最新稳定版本:v21.1.0

Composer 安装命令:

composer require kununu/testing-bundle

包简介

Testing made easy by providing helper classes and fixtures loading

README 文档

README

This bundle integrates with kununu/data-fixtures package allowing you to load fixtures in your tests.

It also provides some utilities that makes testing easier, like a RequestBuilder that turns testing controllers more expressive.

If you want to see an example of what this bundle can do for you click here.

Install

1. Add kununu/testing-bundle to your project

Please be aware that this bundle should not be used in production mode!

composer require --dev kununu/testing-bundle

2. Enable Bundle

Enable the bundle at config/bundles.php for any environment.

<?php
declare(strict_types=1);

return [
    ...
    Kununu\TestingBundle\KununuTestingBundle::class => ['dev' => true, 'test' => true],
];

Configuration

Create the file kununu_testing.yaml inside config/packages/test/.

The configuration options of the bundle heavily depend on the fixture type.

Check out the Load Fixtures section where you can find more options.

Tip If you are using the bundle on more than one environment, for example dev and test, and the configuration options are exactly the same you can import the kununu_testing.yaml like bellow in order to not duplicate the configurations.

# config/packages/dev/kununu_testing.yaml
kununu_testing:
  cache:
    pools:
      app.cache.first:
        load_command_fixtures_classes_namespace:
          - 'Kununu\TestingBundle\Tests\App\Fixtures\CachePool\CachePoolFixture1'
# config/packages/test/kununu_testing.yaml
imports:
  - { resource: '../dev/kununu_testing.yaml' }

Load Fixtures

This bundle integrates with kununu/data-fixtures allowing you to load fixtures in your tests.

Currently, this bundle supports the following types of fixtures:

Schema Copier

This bundle also has a way of copying a database schema from one database to another.

See more:

Testing your code

To test your code, load fixtures and call your endpoints, see:

Testing the bundle

This repository takes advantages of GitHub actions to run tests when a commit is performed to a branch.

If you want to run the integration tests on your local machine you will need:

  • pdo_mysql extension
  • MySQL server
  • Elasticsearch cluster
  • OpenSearch cluster

In your local environment to get everything ready for you, run ./tests/setupLocalTests.sh and follow the instructions.

Then you can run the tests: vendor/bin/phpunit.

Contribute

If you are interested in contributing read our contributing guidelines.

Continuous Integration Quality Gate Status

统计信息

  • 总下载量: 47.93k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 1

GitHub 信息

  • Stars: 8
  • Watchers: 11
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-07