eo/symfony-test-edition

Symfony3精简版,用于执行bundle测试

dev-master 2016-04-26 15:32 UTC

This package is auto-updated.

Last update: 2024-09-24 00:36:28 UTC


README

欢迎来到Symfony Test Edition - 这是一个轻量级的Symfony3应用程序,您可以将其用作bundle测试的骨架。

本文档包含有关如何下载、安装和开始使用Symfony Test Edition的信息。

安装与配置

步骤 1:使用composer将Symfony Test Edition添加到您的项目中

# composer.json
{
    "require-dev": {
        "eo/symfony-test": "~3.0"
    }
}

现在运行以下命令让composer下载已添加的包

$ php composer.phar update eo/symfony-test

Composer将包安装到您项目的vendor/eo目录下。

步骤 2:配置PHPUnit

示例phpunit.xml配置

<?xml version="1.0" encoding="UTF-8"?>
<!-- phpunit.xml -->
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         syntaxCheck="false"
         bootstrap="Tests/bootstrap.php"
>
    <testsuites>
        <testsuite name="Your Bundle Test Suite">
            <directory>./Tests/</directory>
        </testsuite>
    </testsuites>

    <php>
        <server name="KERNEL_DIR" value="./vendor/eo/symfony-test-edition/app" />
    </php>
</phpunit>

步骤 3:启动您的测试(可选)

现在您已经正确安装了Symfony Test Edition并配置了PHPUnit,下一步(可选)是创建一个启动文件,用于自定义配置和bundle。

将以下配置添加到您的config.yml文件中

<?php
// Tests/bootstrap.php
function registerContainerConfiguration($loader) {
    // If you need additional configuration
    // parameters you can load it here as you would normally do
    // with the Symfony Standard Edition
    // This function is optional.

    // A simple example:
    $loader->load(__DIR__ . "/config.yml");
}

function registerBundles() {
    // If you need to register additional
    // bundles add them here as you would normally do
    // with the Symfony Standard Edition
    // This function is optional.

    // A simple example:
    return array(
        new Acme\DemoBundle\AcmeDemoBundle(),
    );
}
?>

用法

您现在可以执行测试了。对于实际例子,您可以查看PassbookBundle

许可证

此bundle使用MIT许可证。完整的许可证请见

./LICENSE

报告问题或功能请求

与此bundle相关的问题和功能请求在Github 问题跟踪器中跟踪。