Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/saksmt/open-popo

Simple library for easy testing Plain Old PHP Objects (inspired by open-pojo)
https://github.com/saksmt/open-popo

Last synced: 9 days ago
JSON representation

Simple library for easy testing Plain Old PHP Objects (inspired by open-pojo)

Awesome Lists containing this project

README

        

open-popo
=========

Small library for quick testing your Plain Old PHP Objects.

*(inspired by open-pojo)*

Installation
============

composer require smt/open-popo

Usage
=====

Example
-------

addRule(GetterMustExist::create())
->addRule(
SetterMustExist::create()
->skip('iWantThisPropertyToHaveNoSetter')
)

->addTester(GetterTester::create())
->addTester(FluentSetterTester::create())

->validate(PopoClass::fromClassName(Entity::class)
;
}
}

Notes (need to rewrite into documentation)
------------------------------------------

Available rules:

- `GetterMustExist`
- `SetterMustExist`

Available testers:

- `GetSetTester` **deprecated**
- `FluentGetSetTester`**deprecated**
- `GetterTester`
- `SetterTester`
- `FluentSetterTester`

Planned:

- Collection rules/testers (`add*`/`remove*`)

Every rule and tester:

- has `skip` method to specify properties to skip
- can be instantiated directly (via `new`) or via factory method (`::create()`)

Validator can be instantiated directly (via `new`) or via factory method (`::create()`)

License
=======

This package is licensed under [MIT license](https://github.com/saksmt/open-popo/blob/develop/LICENSE)