定制 berrygoudswaard/callable-comparator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

berrygoudswaard/callable-comparator

最新稳定版本:0.1.0

Composer 安装命令:

composer require berrygoudswaard/callable-comparator

包简介

Makes it possible to use callables in PHPunit assertions

README 文档

README

Software License Build Status Code Climate Test Coverage Total Downloads

Makes it possible to use callables in PHPunit assertions

Installation

composer require noregression/callable-comparator

Usage

<?php

require_once ('vendor/autoload.php');

use NoRegression\PHPUnit\CallableComparatorTrait;
use NoRegression\PHPUnit\Comparator\Callables\CallableProxy;
use NoRegression\PHPUnit\Comparator\Callables\IsDateTime;
use NoRegression\PHPUnit\Comparator\Callables\IsUuid;
use NoRegression\PHPUnit\Comparator\Callables\IsPasswordHashFor;

class ExampleTest extends \PHPUnit_Framework_TestCase
{
    use CallableComparatorTrait;

    public function setUp()
    {
        parent::setUp();
        $this->setupCallableComparator();
    }

    public function tearDown()
    {
        parent::tearDown();
        $this->tearDownCallableComparator();
    }

    public function testCallableComparator()
    {
        $data = [
            'id' => 'f4a2b7b0-e944-11e4-b571-0800200c9a66',
            'modified' => '2015-03-22 01:12',
            'bcrypt_password' => password_hash('password', PASSWORD_BCRYPT),
            'default_password' => password_hash('password', PASSWORD_DEFAULT),
            'emptystring' => '',
            'contains' => 'This string contains "lazy fox".'
        ];

        $expected = [
            'id' => new IsUuid(),
            'modified' => new IsDateTime(),
            'bcrypt_password' => new IsPasswordHashFor('password'),
            'default_password' => new IsPasswordHashFor('password'),
            'emptystring' => new CallableProxy([$this, 'assertEmpty']),
            'contains' => new CallableProxy([$this, 'assertContains'], ['lazy fox'])
        ];

        $this->assertEquals($expected, $data);
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固