OPINION: Make/Accessible, a lightweight PHP package that let you test singleton and encapsulated classes.

This is where you share YOUR scripts with others

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 1
Joined: Sat Nov 04, 2017 3:15 pm

Sat Nov 04, 2017 3:48 pm

Hi everyone, its my first time here and I'm happy to finally have founded a place like this.

I bring today a solution for automated tests: Make/Accessible.

A lightweight PHP package that let you easily access and test singleton classes and inaccessible instance members like private properties and protected methods.

With this package you can now:
  • Call inaccessible methods
  • Set values into inaccessible properties
  • Get values from inaccessible properties
  • Instantiate singleton classes
And based on your feedback soon you will also be able to easily test abstract class methods too.

People complain a lot about encapsulated class members: "Their hard to test! We need to use reflection!" Blablabla... I think i solved this problem.

People also complain a lot about singleton classes: "Their hard to test! We can only have one instance! One change in the instance will also influence other tests!" Blablabla... I think i also solved this problem.

Please, read the usage to better understand witch problems this package solves, I'm open to any criticism and your feedback is really really important to me, or this project will die since I'm not helping anyone! Thanks for read and I'm waiting for your opinion if I'm loosing my time writing it or if i should continue!!! :D
User avatar
php-forum GURU
php-forum GURU
Posts: 396
Joined: Sat Mar 23, 2013 8:24 am
Location: Livonia, MI

Sun Nov 05, 2017 8:17 am

First of all I have been told by PHP gurus that one should not be using too many singleton classes and second if one writes a class that the class should be able to be UNIT tested without using a PHP package.
Life is a fig newton of your imagination! https://www.miniaturephotographer.com
Post Reply