承接 data-provider/example 相关项目开发

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

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

data-provider/example

Composer 安装命令:

composer require data-provider/example

包简介

An example of the DataProvider in PHP Unit.

README 文档

README

Build

Build Status

Code Quality

SensioLabsInsight Scrutinizer Code Quality Code Climate Codacy Badge

Code Style

StyleCI

Description

This is a simple example of using data provider in PHP Unit. It can be used to write less test with multiple data sets keeping the code coverage high.

    /**
    * Data provider for testCalculateTotal
    * variables are in the order of
    * $paymentMethod, $expectedTotal
    * 
    * @return type
    */
    public function paymentMethodProvider()
    {
        return [
            ['Cash', 100.00],
            ['Credit Card', 95.00],
        ];
    }

    /**
     * Test to check if the order total is calculated correctly
     * for given payment method.
     * 
     * @param string $paymentMethod
     * @param float $expectedTotal
     * 
     * @dataProvider paymentMethodProvider
     */
    public function testCalculateTotal($paymentMethod, $expectedTotal)
    {
        $this->checkout->calculateTotal($paymentMethod);
        $this->assertEquals(
            $this->checkout->getTotal(), 
            $expectedTotal,
            sprintf('Testing total calculation for %s.', $paymentMethod)
        );
    }

The description of how use data provider in PHP Unit is provided in my blog post.

Tests

You can run composer update


~> composer update --prefer-dist

and then run the tests using the command below on folder where the repo is cloned.

phpunit --bootstrap=vendor/autoload.php tests

Available in packagist

The package is availabe in packagist. You can use it for reference by adding the followign line to you composer.json file

"data-provider/example" : "0.0.2",

What Next?

Issues are put in HuBorad, do have a look.

Contribution Guide

This is just an example

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-08-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固