定制 sebastianknott/hamcrest-object-accessor 二次开发

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

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

sebastianknott/hamcrest-object-accessor

最新稳定版本:4.0.0

Composer 安装命令:

composer require sebastianknott/hamcrest-object-accessor

包简介

Adds a Matcher to Hamcrest which can access properties and methods of objects.

README 文档

README

Build Status

Hamcrest Object Accessor

This package extends the collection of matchers in Hamcrest. For general informationan about Hamcrest please visit their website. It's worth it ^^.

hasProperty

This Matcher tries to access a property of an object by name. It uses Getters, public properties, hassers and issers.

Example Class

class HasPropertyFixture { public $bla = 'blub'; private $getable = 'blub'; private $issable = true; private $hassable = true; private $notGettable = 'nope'; public function getGetable() { return $this->getable; } public function isIssable() { return $this->issable; } public function hasHassable() { return $this->hassable; } }

Matcher

$object = new hasPropertyFixture(); MatcherAssert::assertThat( $object, hasProperty( 'bla', // property name stringValue() // matcher the property value has to match ) ); MatcherAssert::assertThat( $object, hasProperty( 'Getable', stringValue() ) ); MatcherAssert::assertThat( $object, hasProperty( 'isIssable', boolValue() ) );

Installation

You may include this package by composer.

composer require --dev sebastianknott/hamcrest-object-accessor

I recommend to use this matcher in dev environments only!

Setup

Once the Package is installed you can call the matcher staticly ...

HasProperty::hasProperty('bla', stringValue()));

... or by requiring src/functions.php provided by this package.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固