定制 atoum/json-schema-extension 二次开发

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

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

atoum/json-schema-extension

最新稳定版本:2.1.0

Composer 安装命令:

composer require atoum/json-schema-extension

包简介

JSON Schema extension for atoum, the simple modern and intuitive unit testing framework for PHP 5.3+

README 文档

README

This extension validates your JSON strings against a JSON-Schema specification.

It also checks if a string a valid JSON string.

Example

<?php
namespace jubianchi\example\json;

use atoum;

class foo extends atoum\test
{
    public function testIsJson()
    {
        $this
            ->given($string = '{"foo": "bar"}')
            ->then
                ->json($string)
        ;
    }

    public function testValidatesSchema()
    {
        $this
            ->given($string = '["foo", "bar"]')
            ->then
                ->json($string)->validates('{"title": "test", "type": "array"}')
                ->json($string)->validates('/path/to/json.schema')
        ;
    }
}

Install it

Install extension using composer:

composer require --dev atoum/json-schema-extension

Enable the extension using atoum configuration file:

<?php

// .atoum.php

require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

use mageekguy\atoum\jsonSchema;

$runner->addExtension(new jsonSchema\extension($script));

Links

License

json-schema-extension is released under the BSD-3-Clause License. See the bundled LICENSE file for details.

atoum

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 8
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2014-12-01