facile-it/symfony-functional-testcase 问题修复 & 功能扩展

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

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

facile-it/symfony-functional-testcase

最新稳定版本:1.4.0

Composer 安装命令:

composer require facile-it/symfony-functional-testcase

包简介

A small functional base test case for Symfony

README 文档

README

Build status Latest Stable Version Latest Unstable Version Codecov coverage status

This is a small base TestCase for PHPUnit functional tests in Symfony that provides a simple getContainer() helper, alongside with some small caching to speed up the tests.

Forked (and slimmed down) from liip/LiipFunctionalTestBundle.

Installation

$ composer require --dev facile-it/symfony-functional-testcase

Usage

To use this in one of your functional tests, you just have to edit it like this:

<?php

namespace Tests;

-use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
+use Facile\SymfonyFunctionalTestCase\WebTestCase;

class SomeTest extends WebTestCase
{

Functionalities

Check HTTP status codes

isSuccessful()

Check that the request succedded:

$client = $this->makeClient();
$client->request('GET', '/contact');

// Successful HTTP request
$this->isSuccessful($client->getResponse());

Add false as the second argument in order to check that the request failed:

$client = $this->makeClient();
$client->request('GET', '/error');

// Request returned an error
$this->isSuccessful($client->getResponse(), false);

In order to test more specific status codes, use assertStatusCode():

assertStatusCode()

Check the HTTP status code from the request:

$client = $this->makeClient();
$client->request('GET', '/contact');

// Standard response for successful HTTP request
$this->assertStatusCode(302, $client);

Command Tests

TODO document runCommand

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 4
  • Forks: 182
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-06