• Stars
    star
    221
  • Rank 179,773 (Top 4 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Writing test code should be simple

NSA; See and do whatever you want. Great for writing tests

Latest Version Software License Build Status Code Coverage Quality Score Total Downloads

This small class helps you to test your private and protected properties and methods. One could argue that you never should test private methods but sometimes it just makes the test code a lot cleaner and easier to write and understand. This library is all about DX.

Usage

$object = new Dog();

NSA::setProperty($object, 'name', 'Foobar');
$name = NSA::getProperty($object, 'name');
$result = NSA::invokeMethod($object, 'doAction', 'jump', '1 meter');

echo $name; // "Foobar"
echo $result; // "Dog just did 'jump' for 1 meter"

// Access static properties and methods
$age = NSA::getProperty('\Dog', 'age');
echo $age; // 12
class Dog
{
    private $name = 'unnamed';
    private static $age = 12;

    private function doAction($action, $parameter)
    {
        return sprintf("Dog just did '%s' for %s", $action, $parameter);
    }
}

Install

$ composer require nyholm/nsa

License

The MIT License (MIT). Please see License File for more information.

More Repositories

1

psr7

A super lightweight PSR-7 implementation
PHP
1,061
star
2

psr7-server

Helper classes to use any PSR7 implementation as your main request and response
PHP
84
star
3

dsn

A powerful DSN parser.
PHP
82
star
4

SuperSlim

A small and super quick framework for your microservices
PHP
36
star
5

effective-interest-rate

Calculate effective interest, XIRR or effective APR.
PHP
21
star
6

next-faker

19
star
7

append_query_string

Append a query string to a URL
PHP
18
star
8

symfony-messenger-recorder

An implementation for MessageRecorder for Symfony messenger
PHP
15
star
9

sunflower

The best kernel for simple apps
PHP
14
star
10

workshop-state-machines

14
star
11

workshop-symfony-internals

11
star
12

roave-bc-check-docker

Roave BC Check with Docker
Dockerfile
10
star
13

effective-interest-rate-js

Calculate effective interest, XIRR or effective APR.
JavaScript
9
star
14

symfony-4-internals-presentaion

This is the source code for the Symfony 4 internals
PHP
7
star
15

symfony-runtime

Temporary repository for symfony/symfony#36652
PHP
6
star
16

sfhackday.com

PHP
5
star
17

message-component-demo

PHP
5
star
18

http-client

A super lightweight PSR-7 Http client
PHP
5
star
19

small-symfony-project

This is just a dummy project that loads a bunch of files and runs hello world
PHP
4
star
20

Wordpress-Email-Subscription

The plugin gives your visitors the opportunity to subscribe to future posts by email.
PHP
4
star
21

git-reviewer

Find a list of reviewers for your pull request
PHP
3
star
22

clean-aws-lambda-code-storage

Small application to fix CodeStorageExceededException
PHP
2
star
23

bref-runtime-demo

PHP
2
star
24

php-cs-fixer-Jenkins-plugin

A Jenkins plugin for php-cs-fixer
Java
1
star
25

workshop-logging-with-wordpress

PHP
1
star
26

sf-bref-session-issue

PHP
1
star
27

sf-issue-42303

PHP
1
star
28

sf-issue-40600

PHP
1
star
29

serverless-issue-8772

JavaScript
1
star
30

phpstorm-test-code

PHP
1
star
31

symfony-bootstrap-form

Create a test page for symfony boostrap form.
PHP
1
star
32

noop

No-operation
PHP
1
star
33

Chrome-HTML5-form-validation-remover

This little plugin disables the HTML form validation
JavaScript
1
star
34

bref-issue-output-started

PHP
1
star
35

matlab-why

A port of Matlab's why function
PHP
1
star