2017 © Pedro Peláez
 

library open-popo

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

image

smt/open-popo

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

  • Friday, November 13, 2015
  • by smt
  • Repository
  • 1 Watchers
  • 1 Stars
  • 13 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

open-popo

Small library for quick testing your Plain Old PHP Objects., (*1)

(inspired by open-pojo), (*2)

Installation

composer require smt/open-popo

Usage

Example

<?php

use Smt\OpenPopo\Reflection\PopoClass;
use Smt\OpenPopo\Validator\Validator;
use Smt\OpenPopo\Rule\Impl\GetterMustExist;
use Smt\OpenPopo\Rule\Impl\SetterMustExist;
use Smt\OpenPopo\Tester\Impl\GetterTester;
use Smt\OpenPopo\Tester\Impl\FluentSetterTester; // You can also remove "Fluent" prefix if you don't want to check
                                                 // this functional

class EntityTest extends PHPUnit_Framework_TestCase
{
    public function testAll()
    {
        Validator::create()

            ->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:, (*3)

  • GetterMustExist
  • SetterMustExist

Available testers:, (*4)

  • GetSetTester deprecated
  • FluentGetSetTesterdeprecated
  • GetterTester
  • SetterTester
  • FluentSetterTester

Planned:, (*5)

  • Collection rules/testers (add*/remove*)

Every rule and tester:, (*6)

  • 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()), (*7)

License

This package is licensed under MIT license, (*8)

The Versions

13/11 2015

dev-develop

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

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

  Sources   Download

MIT

The Requires

 

by Kirill Saksin

test phpunit entity object plain old php object

13/11 2015

v1.1.0

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

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

  Sources   Download

MIT

The Requires

 

by Kirill Saksin

test phpunit entity object plain old php object

10/11 2015

v1.0.0

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

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

  Sources   Download

MIT

The Requires

 

by Kirill Saksin

test phpunit entity object plain old php object