Collection of value objects that represent the PHP code units

Related tags

API code-unit
Overview

sebastian/code-unit

Collection of value objects that represent the PHP code units.

Installation

You can add this library as a local, per-project dependency to your project using Composer:

composer require sebastian/code-unit

If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:

composer require --dev sebastian/code-unit
You might also like...
The 1Password Connect PHP SDK provides your PHP applications access to the 1Password Connect API hosted on your infrastructure and leverage the power of 1Password Secrets Automation

1Password Connect PHP SDK The 1Password Connect PHP SDK provides your PHP applications access to the 1Password Connect API hosted on your infrastructu

API for Symbiota using the Lumen PHP PHP Micro-Framework By Laravel

symbiota-api API for Symbiota using the Lumen PHP PHP Micro-Framework By Laravel Laravel Lumen Official Documentation Documentation for the Lumen fram

Facebook SDK for PHP (v6) - allows you to access the Facebook Platform from your PHP app

Facebook SDK for PHP (v6) This repository contains the open source PHP SDK that allows you to access the Facebook Platform from your PHP app. Installa

Single file PHP script that adds a REST API to a SQL database

PHP-CRUD-API Single file PHP script that adds a REST API to a MySQL/MariaDB, PostgreSQL, SQL Server or SQLite database. NB: This is the TreeQL referen

Simple and effective multi-format Web API Server to host your PHP API as Pragmatic REST and / or RESTful API

Luracast Restler ![Gitter](https://badges.gitter.im/Join Chat.svg) Version 3.0 Release Candidate 5 Restler is a simple and effective multi-format Web

Unofficial Firebase Admin SDK for PHP

Firebase Admin PHP SDK Table of Contents Overview Installation Documentation Support License Overview Firebase provides the tools and infrastructure y

Simple utility and class library for generating php classes from a wsdl file.

wsdl2phpgenerator Simple WSDL to PHP classes converter. Takes a WSDL file and outputs class files ready to use. Uses the MIT license. Announcement: We

Content Negotiation tools for PHP.

Negotiation Negotiation is a standalone library without any dependencies that allows you to implement content negotiation in your application, whateve

A PHP library to support implementing representations for HATEOAS REST web services.

Hateoas A PHP library to support implementing representations for HATEOAS REST web services. Installation Working With Symfony Usage Introduction Conf

Comments
  • Implement FileUnit

    Implement FileUnit

    This PR adds support for code units that cover files. It should not break any existing code since we use a pattern for the @covers annotation that does not collide with the existing patterns.

    Future work: relative paths

    Future work would be to add support for relative paths, the most important open question for this is: relative to what?

    Using relative paths would require some configuration, which we either have to inject or extract from global state. A simple but arguably not very pretty solution would be to use PHP's search path. Another solution would be to add a static configurator function to mapper, that is easy to implement but could be considered fairly ugly.

    class Mapper {
        public static function setBasePathForRelativePaths($absoluteDirectoryPath): void {
            self::assertDirectoryExists($absoluteDirectoryPath);
            self::$basePath = $absoluteDirectoryPath;
        }
    

    Another option would be to change Test::getLinesToBeCovered() to allow a Mapper instance to be passed in:

        public static function getLinesToBeCovered(string $className, string $methodName, Mapper $mapper = null)
    

    This would allow callers to optionally pass in their own Mapper, but requires a lot more changes everywhere in the chain..

    opened by SamMousa 11
  • Mapper::stringToCodeUnits() breaks when ClassName<extended> is used for class that extends built-in class

    Mapper::stringToCodeUnits() breaks when ClassName is used for class that extends built-in class

    | Q | A | --------------------| --------------- | PHPUnit version | 9.1.0 and above | PHP version | 7.3.11 | Installation Method | Composer

    Summary

    PHPUnit 9.1.0 contains BC break and the change has been not documented in the changelog.

    Before annotation:

    * @covers Laminas\Hydrator\HydratorAwareTrait<extended>
    

    worked fine, but since 9.1.0 it breaks when generating code coverage with the following message:

    "@covers Laminas\Hydrator\HydratorAwareTrait<extended>" is invalid
    Script phpunit --colors=always --coverage-clover clover.xml handling the test-coverage event returned with error code 2
    

    I've checked the documentation, and using <extended> is not recommended:

    https://phpunit.readthedocs.io/en/9.1/annotations.html#covers

    but even in documentation of v9.1 it does not say it is not valid.

    Previous Behavior

    No errors when generating code coverage.

    Current Behavior

    Error when generating code coverage and code coverage is not completed.

    How to reproduce

    Checkout repo: https://github.com/laminas/laminas-hydrator and run:

    composer install
    composer test-coverage
    

    then try downgrade PHPUnit to 9.0.2 and try again composer test-coverage.

    bug 
    opened by michalbundyra 3
Owner
Sebastian Bergmann
Sebastian Bergmann is the creator of PHPUnit. He co-founded thePHP.cc and helps PHP teams build better software.
Sebastian Bergmann
Read and write OpenAPI 3.0.x YAML and JSON files and make the content accessible in PHP objects.

php-openapi Read and write OpenAPI 3.0.x YAML and JSON files and make the content accessible in PHP objects. It also provides a CLI tool for validatin

Carsten Brandt 399 Dec 23, 2022
ObjectHydrator - Object Hydration library to create Command and Query objects.

Object Hydrator This is a utility that converts structured request data (for example: decoded JSON) into a complex object structure. The intended use

EventSauce 264 Dec 14, 2022
A collection of custom Arcanist linters

Arcanist Linters This is a collection of custom Arcanist linters that we've written at Pinterest. Apache Thrift Apache Thrift Generated Black Checksty

Pinterest 64 May 7, 2022
Modern version of pocketmine forms API, ported to PHP 8.0+ with high quality code and phpstan integration

forms Modern version of pocketmine forms API, ported to PHP 8.0+ with high quality code and phpstan integration Code samples ModalForm Using ModalForm

Frago9876543210 23 Nov 18, 2022
This package makes it easy for developers to access WhatsApp Cloud API service in their PHP code.

The first PHP API to send and receive messages using a cloud-hosted version of the WhatsApp Business Platform

NETFLIE 135 Dec 29, 2022
A bundle providing routes and glue code between Symfony and a WOPI connector.

WOPI Bundle A Symfony bundle to facilitate the implementation of the WOPI endpoints and protocol. Description The Web Application Open Platform Interf

Champs-Libres 5 Aug 20, 2022
Scan source code for calls to ray() and related calls.

Quickly scan source code for calls to Ray This package can quickly scan source code for calls to ray(), rd(), Ray::*, and ->ray() helper methods from

Spatie 64 Dec 29, 2022
Judge0 API integration for running/judging code with different languages

Laravel Judge0 Judge0 API integration for running/judging code with different languages use Mouadbnl\Judge0\Models\Submission; $submission = Submissi

Mouad Benali 10 Dec 6, 2022
Use middleware to decorate method calls within your application code.

Laravel Middlewarize ?? Chain of Responsibility Design Pattern In Laravel Apps ?? You can use middlewares to decorate any method calls on any object.

Iman 99 Jan 1, 2023
Code shared by the schema packages

Code shared by the schema packages

PoP CMS Schema 2 Nov 4, 2022