PK bCVs?s s phpunit.xml.distnu W+A
src/
tests/
PK bCVWٸfq fq
composer.locknu W+A {
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "cf4df8858166e442db37e79540c0f18e",
"packages": [
{
"name": "doctrine/collections",
"version": "v1.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/collections.git",
"reference": "b99c5c46c87126201899afe88ec490a25eedd6a2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/collections/zipball/b99c5c46c87126201899afe88ec490a25eedd6a2",
"reference": "b99c5c46c87126201899afe88ec490a25eedd6a2",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\Collections\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com",
"homepage": "http://www.jwage.com/",
"role": "Creator"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com",
"homepage": "http://www.instaclick.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com",
"homepage": "https://github.com/schmittjoh",
"role": "Developer of wrapped JMSSerializerBundle"
}
],
"description": "Collections Abstraction library",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"array",
"collections",
"iterator"
],
"time": "2014-02-03 23:07:43"
},
{
"name": "justinrainbow/json-schema",
"version": "1.3.7",
"source": {
"type": "git",
"url": "https://github.com/justinrainbow/json-schema.git",
"reference": "87b54b460febed69726c781ab67462084e97a105"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/87b54b460febed69726c781ab67462084e97a105",
"reference": "87b54b460febed69726c781ab67462084e97a105",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"json-schema/json-schema-test-suite": "1.1.0",
"phpdocumentor/phpdocumentor": "~2",
"phpunit/phpunit": "~3.7"
},
"bin": [
"bin/validate-json"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"psr-0": {
"JsonSchema": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Bruno Prieto Reis",
"email": "bruno.p.reis@gmail.com"
},
{
"name": "Justin Rainbow",
"email": "justin.rainbow@gmail.com"
},
{
"name": "Igor Wiedler",
"email": "igor@wiedler.ch"
},
{
"name": "Robert Schönthal",
"email": "seroscho@googlemail.com"
}
],
"description": "A library to validate a json schema.",
"homepage": "https://github.com/justinrainbow/json-schema",
"keywords": [
"json",
"schema"
],
"time": "2014-08-25 02:48:14"
},
{
"name": "nikic/php-parser",
"version": "v1.0.2",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "a8ffc6fcfcbae268656c8acf1298e378ac1ee5f1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a8ffc6fcfcbae268656c8acf1298e378ac1ee5f1",
"reference": "a8ffc6fcfcbae268656c8acf1298e378ac1ee5f1",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"files": [
"lib/bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Nikita Popov"
}
],
"description": "A PHP parser written in PHP",
"keywords": [
"parser",
"php"
],
"time": "2014-11-04 22:12:46"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "2.0.3",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "38743b677965c48a637097b2746a281264ae2347"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/38743b677965c48a637097b2746a281264ae2347",
"reference": "38743b677965c48a637097b2746a281264ae2347",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "3.7.*@stable"
},
"suggest": {
"dflydev/markdown": "1.0.*",
"erusev/parsedown": "~0.7"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-0": {
"phpDocumentor": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "mike.vanriel@naenius.com"
}
],
"time": "2014-08-09 10:27:07"
},
{
"name": "sebastian/version",
"version": "1.0.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "a77d9123f8e809db3fbdea15038c27a95da4058b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a77d9123f8e809db3fbdea15038c27a95da4058b",
"reference": "a77d9123f8e809db3fbdea15038c27a95da4058b",
"shasum": ""
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2014-12-15 14:25:24"
},
{
"name": "seld/jsonlint",
"version": "1.3.1",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/jsonlint.git",
"reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/863ae85c6d3ef60ca49cb12bd051c4a0648c40c4",
"reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"bin": [
"bin/jsonlint"
],
"type": "library",
"autoload": {
"psr-4": {
"Seld\\JsonLint\\": "src/Seld/JsonLint/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"description": "JSON Linter",
"keywords": [
"json",
"linter",
"parser",
"validator"
],
"time": "2015-01-04 21:18:15"
},
{
"name": "symfony/console",
"version": "v2.6.3",
"target-dir": "Symfony/Component/Console",
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
"reference": "6ac6491ff60c0e5a941db3ccdc75a07adbb61476"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Console/zipball/6ac6491ff60c0e5a941db3ccdc75a07adbb61476",
"reference": "6ac6491ff60c0e5a941db3ccdc75a07adbb61476",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/event-dispatcher": "~2.1",
"symfony/process": "~2.1"
},
"suggest": {
"psr/log": "For using the console logger",
"symfony/event-dispatcher": "",
"symfony/process": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Console\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony Console Component",
"homepage": "http://symfony.com",
"time": "2015-01-06 17:50:02"
},
{
"name": "symfony/dependency-injection",
"version": "v2.6.3",
"target-dir": "Symfony/Component/DependencyInjection",
"source": {
"type": "git",
"url": "https://github.com/symfony/DependencyInjection.git",
"reference": "72db9adf2f6c42e773108038bcdaff263f325b4e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/72db9adf2f6c42e773108038bcdaff263f325b4e",
"reference": "72db9adf2f6c42e773108038bcdaff263f325b4e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"conflict": {
"symfony/expression-language": "<2.6"
},
"require-dev": {
"symfony/config": "~2.2",
"symfony/expression-language": "~2.6",
"symfony/yaml": "~2.1"
},
"suggest": {
"symfony/config": "",
"symfony/proxy-manager-bridge": "Generate service proxies to lazy load them",
"symfony/yaml": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\DependencyInjection\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony DependencyInjection Component",
"homepage": "http://symfony.com",
"time": "2015-01-05 17:41:06"
},
{
"name": "symfony/event-dispatcher",
"version": "v2.6.3",
"target-dir": "Symfony/Component/EventDispatcher",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher.git",
"reference": "40ff70cadea3785d83cac1c8309514b36113064e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/40ff70cadea3785d83cac1c8309514b36113064e",
"reference": "40ff70cadea3785d83cac1c8309514b36113064e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~2.0,>=2.0.5",
"symfony/dependency-injection": "~2.6",
"symfony/expression-language": "~2.6",
"symfony/stopwatch": "~2.3"
},
"suggest": {
"symfony/dependency-injection": "",
"symfony/http-kernel": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\EventDispatcher\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony EventDispatcher Component",
"homepage": "http://symfony.com",
"time": "2015-01-05 14:28:40"
},
{
"name": "symfony/finder",
"version": "v2.6.3",
"target-dir": "Symfony/Component/Finder",
"source": {
"type": "git",
"url": "https://github.com/symfony/Finder.git",
"reference": "16513333bca64186c01609961a2bb1b95b5e1355"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Finder/zipball/16513333bca64186c01609961a2bb1b95b5e1355",
"reference": "16513333bca64186c01609961a2bb1b95b5e1355",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Finder\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony Finder Component",
"homepage": "http://symfony.com",
"time": "2015-01-03 08:01:59"
},
{
"name": "symfony/stopwatch",
"version": "v2.6.3",
"target-dir": "Symfony/Component/Stopwatch",
"source": {
"type": "git",
"url": "https://github.com/symfony/Stopwatch.git",
"reference": "e8da5286132ba75ce4b4275fbf0f4cd369bfd71c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Stopwatch/zipball/e8da5286132ba75ce4b4275fbf0f4cd369bfd71c",
"reference": "e8da5286132ba75ce4b4275fbf0f4cd369bfd71c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Stopwatch\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony Stopwatch Component",
"homepage": "http://symfony.com",
"time": "2015-01-03 08:01:59"
}
],
"packages-dev": [
{
"name": "bartlett/phpunit-loggertestlistener",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/llaville/phpunit-LoggerTestListener.git",
"reference": "1c16b2741b1b29dcbdf79d44a83575f628ab0605"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/llaville/phpunit-LoggerTestListener/zipball/1c16b2741b1b29dcbdf79d44a83575f628ab0605",
"reference": "1c16b2741b1b29dcbdf79d44a83575f628ab0605",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"psr/log": "~1.0"
},
"suggest": {
"monolog/monolog": "For advanced logging strategies"
},
"type": "library",
"autoload": {
"psr-0": {
"Bartlett\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Laurent Laville",
"email": "pear@laurent-laville.org",
"homepage": "https://github.com/llaville",
"role": "Lead"
}
],
"description": "PHPUnit Test Suite listener for compatible PSR-3 logger",
"homepage": "https://github.com/llaville/phpunit-LoggerTestListener",
"time": "2014-09-17 09:12:57"
},
{
"name": "doctrine/cache",
"version": "v1.3.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/cf483685798a72c93bf4206e3dd6358ea07d64e7",
"reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"conflict": {
"doctrine/common": ">2.2,<2.4"
},
"require-dev": {
"phpunit/phpunit": ">=3.7",
"satooshi/php-coveralls": "~0.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\Cache\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Caching library offering an object-oriented API for many cache backends",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"cache",
"caching"
],
"time": "2014-09-17 14:24:04"
},
{
"name": "monolog/monolog",
"version": "1.12.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "1fbe8c2641f2b163addf49cc5e18f144bec6b19f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/1fbe8c2641f2b163addf49cc5e18f144bec6b19f",
"reference": "1fbe8c2641f2b163addf49cc5e18f144bec6b19f",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"psr/log": "~1.0"
},
"provide": {
"psr/log-implementation": "1.0.0"
},
"require-dev": {
"aws/aws-sdk-php": "~2.4, >2.4.8",
"doctrine/couchdb": "~1.0@dev",
"graylog2/gelf-php": "~1.0",
"phpunit/phpunit": "~4.0",
"raven/raven": "~0.5",
"ruflin/elastica": "0.90.*",
"videlalvaro/php-amqplib": "~2.4"
},
"suggest": {
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
"ext-mongo": "Allow sending log messages to a MongoDB server",
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
"raven/raven": "Allow sending log messages to a Sentry server",
"rollbar/rollbar": "Allow sending log messages to Rollbar",
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
"videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.12.x-dev"
}
},
"autoload": {
"psr-4": {
"Monolog\\": "src/Monolog"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
"homepage": "http://github.com/Seldaek/monolog",
"keywords": [
"log",
"logging",
"psr-3"
],
"time": "2014-12-29 21:29:35"
},
{
"name": "psr/log",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-0": {
"Psr\\Log\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2012-12-21 11:40:51"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"platform": {
"php": ">=5.3.0",
"ext-tokenizer": "*",
"ext-pcre": "*",
"ext-spl": "*",
"ext-json": "*",
"ext-date": "*",
"ext-reflection": "*",
"ext-pdo_sqlite": "*"
},
"platform-dev": []
}
PK bCV6" " LICENSEnu W+A Copyright (c) 2011-2015, Laurent Laville
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the authors nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
PK bCV1UO phar-manifest.phpnu W+A #!/usr/bin/env php
&1');
if (strpos($tag, '-') === false && strpos($tag, 'No names found') === false) {
print $tag;
} else {
$branch = @exec('git rev-parse --abbrev-ref HEAD');
$hash = @exec('git log -1 --format="%H"');
print $branch . '@' . $hash;
}
print "\n";
$lock = json_decode(file_get_contents(__DIR__ . '/composer.lock'));
foreach ($lock->packages as $package) {
print $package->name . ': ' . $package->version;
if (!preg_match('/^[v= ]*(([0-9]+)(\\.([0-9]+)(\\.([0-9]+)(-([0-9]+))?(-?([a-zA-Z-+][a-zA-Z0-9\\.\\-:]*)?)?)?)?)$/', $package->version)) {
print '@' . $package->source->reference;
}
print "\n";
}
PK bCV_Ǜ bin/phpreflect.json-schemanu W+A {
"name": "Config",
"type": "object",
"additionalProperties": false,
"properties": {
"source-providers": {
"type": "array",
"description": "List of data sources to parse.",
"items": {
"type": "object",
"additionalProperties": true,
"properties": {
"in": {
"type": "string",
"description": "Path to the data source (with or without its alias).",
"required": true
},
"name": {
"type": "string",
"description": "Provider filename filter.",
"required": true
}
}
}
},
"plugins": {
"type": "array",
"description": "List of plugins to install.",
"items": {
"type": "object",
"additionalProperties": true,
"properties": {
"name": {
"type": "string",
"description": "Name of the plugin.",
"required": true
},
"class": {
"type": "string",
"description": "Fully Qualified Class Name of the plugin.",
"required": true
}
}
}
},
"analysers": {
"type": "array",
"description": "List of analysers to install.",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "Name of the analyser.",
"required": true
},
"class": {
"type": "string",
"description": "Fully Qualified Class Name of the analyser.",
"required": true
}
}
}
}
}
}
PK bCVm[: : bin/phpreflect.1nu W+A '\" t
.\" Title: phpreflect
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1
.\" Date: 2014-08-21
.\" Manual: \ \&
.\" Source: \ \& 2.3.0
.\" Language: English
.\"
.TH "PHPREFLECT" "1" "2014\-08\-21" "\ \& 2\&.3\&.0" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
phpreflect \- Reverse\-engineer classes, interfaces, functions, constants, namespaces and more
.SH "SYNOPSIS"
.sp
\fBphpreflect\fR [\fIoptions\fR] \fIcommand\fR [\fIarguments\fR]
.SH "DESCRIPTION"
.sp
The phpreflect(1) command parse any data source, defined in a json configuration file, to find out elements, such as classes, interfaces, functions, constants, namespaces\&.
.SH "OPTIONS"
.PP
\fB\-h, \-\-help\fR
.RS 4
Display this help message\&.
.RE
.PP
\fB\-q, \-\-quiet\fR
.RS 4
Do not output any message\&.
.RE
.PP
\fB\-v|vv|v, \-\-verbose\fR
.RS 4
Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\&.
.RE
.PP
\fB\-V, \-\-version\fR
.RS 4
Display this application version\&.
.RE
.PP
\fB\-\-ansi\fR
.RS 4
Force ANSI output\&.
.RE
.PP
\fB\-\-no\-ansi\fR
.RS 4
Disable ANSI output\&.
.RE
.PP
\fB\-\-profile\fR
.RS 4
Display timing and memory usage information\&.
.RE
.SH "VALIDATE COMMAND"
.sp
The phpreflect(1) \fIvalidate\fR command is used to check syntax of your json configuration file
.sp
Usage:
.sp
.if n \{\
.RS 4
.\}
.nf
phpreflect validate [file]
.fi
.if n \{\
.RE
.\}
.sp
Where:
.PP
\fBfile\fR
.RS 4
Path to
phpreflect\&.json
file (optional)
.RE
.SH "ANALYSER:LIST COMMAND"
.sp
The phpreflect(1) \fIanalyser:list\fR command is used to show what analysers are installed (see CONF FILES section)\&.
.SH "ANALYSER:RUN COMMAND"
.sp
The phpreflect(1) \fIanalyser:run\fR command is used to analyse a data source and display results\&.
.sp
Usage:
.sp
.if n \{\
.RS 4
.\}
.nf
phpreflect analyser:run [\-\-alias] [\-\-redraw\-freq="\&.\&.\&."] source [analysers1] \&.\&.\&. [analysersN]
.fi
.if n \{\
.RE
.\}
.sp
Where:
.PP
\fBsource\fR
.RS 4
Identify a data source declared in a json configuration file (see
CONF FILES
section)
.RE
.PP
\fB\-\-alias\fR
.RS 4
If set, the source refers to its alias
.RE
.PP
\fB\-\-redraw\-freq\fR
.RS 4
How many times should the progress bar be updated? (default: 1)
.RE
.PP
\fBanalysers1\fR \&... \fBanalysersN\fR
.RS 4
Identify one or more analyser to execute\&. See
\fIanalyser:list\fR
command to know what analysers are available\&.
.RE
.SH "PLUGIN:LIST COMMAND"
.sp
The phpreflect(1) \fIplugin:list\fR command is used to show what plugins are installed (see CONF FILES section)\&.
.SH "PROVIDER:LIST COMMAND"
.sp
The phpreflect(1) \fIprovider:list\fR command is used to show what data sources are declared in a json configuration file (see CONF FILES section)\&.
.SH "PROVIDER:SHOW COMMAND"
.sp
The phpreflect(1) \fIprovider:show\fR command is used to show files in data sources\&.
.sp
Usage:
.sp
.if n \{\
.RS 4
.\}
.nf
phpreflect provider:show [\-\-alias] source
.fi
.if n \{\
.RE
.\}
.sp
Where:
.PP
\fBsource\fR
.RS 4
Identify a data source declared in a json configuration file (see
CONF FILES
section)
.RE
.PP
\fB\-\-alias\fR
.RS 4
If set, the source refers to its alias
.RE
.SH "PROVIDER:DISPLAY COMMAND"
.sp
The phpreflect(1) \fIprovider:display\fR command is used to show source code of a file in a data source\&.
.sp
Usage:
.sp
.if n \{\
.RS 4
.\}
.nf
phpreflect provider:display [\-\-alias] source file
.fi
.if n \{\
.RE
.\}
.sp
Where:
.PP
\fBsource\fR
.RS 4
Identify a data source declared in a json configuration file (see
CONF FILES
section)
.RE
.PP
\fB\-\-alias\fR
.RS 4
If set, the source refers to its alias
.RE
.PP
\fBfile\fR
.RS 4
Relative path to a file in the data source
.RE
.SH "EXIT STATUS"
.PP
\fB0\fR
.RS 4
Success
.RE
.PP
\fB1\fR
.RS 4
Failure (syntax or usage error; configuration error; unexpected error)\&.
.RE
.SH "CONF FILES"
.sp
A configuration file contains data sources that can be analysed, but also optional plugins and analysers installed\&. Require configuration file is loaded in the following order:
.sp
.RS 4
.ie n \{\
\h'-04' 1.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 1." 4.2
.\}
The CONF_FILE specified by the environment variable
REFLECT\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 2.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 2." 4.2
.\}
phpreflect\&.json
from the current directory\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 3.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 3." 4.2
.\}
phpreflect\&.json
from the User
$HOME/\&.config
directory\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 4.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 4." 4.2
.\}
phpreflect\&.json
from the
/etc
directory\&.
.RE
.SH "BUGS"
.sp
Report any issue at https://github\&.com/llaville/php\-reflect/issues
.SH "AUTHORS"
.sp
The Command\-Line Interface (CLI) version was introduced in version 2\&.0 and is written by Laurent Laville\&.
.SH "SEE ALSO"
.sp
Main web site: http://php5\&.laurent\-laville\&.org/reflect/
.SH "COPYRIGHT"
.sp
Copyright (C) 2011\-2014 Laurent Laville\&.
.SH "LICENSE"
.sp
Free use of this software is granted under the terms of the BSD 3\-clause license\&.
PK bCV[ bin/phpreflectnu W+A #!/usr/bin/env php
setUseIncludePath(true);
if (PHP_SAPI !== 'cli') {
return;
}
use Bartlett\Reflect\Environment;
use Bartlett\Reflect\Console\Application;
Environment::setScanDir();
$application = new Application($appName, '3.0');
$application->run();
PK bCV
C3 bin/phpreflect.json.distnu W+A {
"source-providers": [
{
"in": ". as current",
"name": "/\\.(php|inc|phtml)$/"
}
],
"plugins": [
],
"analysers" : [
]
}
PK bCVV: : box.jsonnu W+A {
"alias": "phpreflect.phar",
"chmod": "0755",
"directories": ["src"],
"extract": false,
"compression": "GZ",
"files": [
"bin/phpreflect.json-schema",
"bin/phpreflect.json.dist",
"manifest.txt",
"LICENSE",
"vendor/nikic/php-parser/LICENSE",
"vendor/sebastian/version/LICENSE",
"vendor/symfony/console/Symfony/Component/Console/LICENSE",
"vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/LICENSE",
"vendor/symfony/finder/Symfony/Component/Finder/LICENSE",
"vendor/symfony/stopwatch/Symfony/Component/Stopwatch/LICENSE",
"vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LICENSE",
"vendor/seld/jsonlint/LICENSE",
"vendor/justinrainbow/json-schema/LICENSE",
"vendor/doctrine/cache/LICENSE",
"vendor/doctrine/collections/LICENSE",
"vendor/psr/log/LICENSE",
"vendor/monolog/monolog/LICENSE",
"vendor/autoload.php"
],
"finder": [
{
"name": "*.php",
"in": "vendor/composer"
},
{
"name": "*.php",
"in": "vendor/nikic/php-parser/lib"
},
{
"name": "Version.php",
"in": "vendor/sebastian/version/src"
},
{
"name": "*.php",
"notPath": "/Tests/",
"in": "vendor/symfony"
},
{
"name": "*.php",
"in": "vendor/seld/jsonlint/src"
},
{
"name": "*.php",
"in": "vendor/justinrainbow/json-schema/src"
},
{
"name": "*.php",
"in": "vendor/phpdocumentor/reflection-docblock/src"
},
{
"name": "*.php",
"in": "vendor/doctrine/cache/lib"
},
{
"name": "*.php",
"in": "vendor/doctrine/collections/lib"
},
{
"name": "*.php",
"in": "vendor/psr/log/Psr"
},
{
"name": "*.php",
"in": "vendor/monolog/monolog/src"
}
],
"replacements": { "package_version": "3.0.0-alpha3" },
"main": "bin/phpreflect",
"output": "phpreflect-3.0.0-alpha3.phar",
"stub": "phar-stub.php",
"web": false,
"shebang": false
}
PK bCVzc)^ ^ manifest.txtnu W+A bartlett/php-reflect: 3.0.0-alpha3
doctrine/collections: v1.2
justinrainbow/json-schema: 1.3.7
nikic/php-parser: v1.0.2
phpdocumentor/reflection-docblock: 2.0.3
sebastian/version: 1.0.4
seld/jsonlint: 1.3.1
symfony/console: v2.6.3
symfony/dependency-injection: v2.6.3
symfony/event-dispatcher: v2.6.3
symfony/finder: v2.6.3
symfony/stopwatch: v2.6.3
PK bCV%F F
phar-stub.phpnu W+A #!/usr/bin/env php
=5.3.0",
"ext-tokenizer": "*",
"ext-pcre": "*",
"ext-spl": "*",
"ext-json": "*",
"ext-date": "*",
"ext-reflection": "*",
"ext-pdo_sqlite": "*",
"sebastian/version": "~1.0",
"nikic/php-parser": "~1.0",
"doctrine/collections": "~1.2",
"symfony/event-dispatcher": "~2.5",
"symfony/finder": "~2.5",
"symfony/console": "~2.5",
"symfony/stopwatch": "~2.5",
"symfony/dependency-injection": "~2.5",
"phpdocumentor/reflection-docblock": "~2.0",
"justinrainbow/json-schema": "~1.3",
"seld/jsonlint": "~1.1"
},
"require-dev": {
"doctrine/cache": "~1.3",
"psr/log": "~1.0",
"monolog/monolog": "~1.10",
"bartlett/phpunit-loggertestlistener": "~1.1"
},
"suggest": {
"doctrine/cache": "Allow caching results",
"psr/log": "Allow logging events with the LogPlugin",
"monolog/monolog": "Allow logging events with the LogPlugin",
"bartlett/phpunit-loggertestlistener": "Allow logging unit tests to your favorite PSR-3 logger interface"
},
"authors": [
{
"name": "Laurent Laville",
"email": "pear@laurent-laville.org",
"homepage": "https://github.com/llaville",
"role": "Lead"
}
],
"bin": [
"bin/phpreflect"
],
"autoload": {
"psr-0": {
"Bartlett\\": "src/"
}
},
"autoload-dev": {
"psr-0": {
"Bartlett\\Tests\\Reflect\\": "tests/"
}
}
}
PK bCVUG
G
README.asciidocnu W+A = PHP Reflect
**PHP Reflect** is a library that
adds the ability to reverse-engineer classes, interfaces, functions, constants, namespaces and more.
Both were distributed as source code (install via composer) and a PHAR version
that bundles all dependencies in a single file.
Follow development on the http://php5.laurent-laville.org/reflect/blog/[official Blog].
Have a look on master branch for previous stable API 1.0
== Install
You can either :
* download the phar version http://bartlett.laurent-laville.org/get/phpreflect-2.6.0.phar[2.6.0]
* install via https://packagist.org/packages/bartlett/php-reflect/[packagist] the current source dev-master or the stable version 2.6.0
== Documentation
The documentation for PHP Reflect 2.6 is available
in http://php5.laurent-laville.org/reflect/manual/2.6/en/[English]
to read it online or download to read it later (multiple formats).
AsciiDoc source code are available on `docs` folder of the repository.
== Contribute
Contributions to source code and its documentation are always welcome.
As developper, I'm always happy when I have the more informations as possible to check and find out issues.
This is the reason why I've created a https://github.com/llaville/phpunit-LoggerTestListener[PHPUnit TestSuite Listener for compatible PSR-3 Loggers].
If you want to use it, then :
- install the component via Composer
[source,bash]
----
$ php composer.phar require bartlett/phpunit-loggertestlistener=~1.1
----
- create a `phpunit.xml` file with at least following contents :
[source,xml]
----
src/
tests/
----
- configure your PSR-3 logger in the `tests\bootstrap.dev.php` file
NOTE: Default will log all tests in local file `/var/logs/phpreflect.log`
and send a Growl notification of Test Suites summary when ended (if growl server running).
PK bCVD D examples/api_analyser_run.phpnu W+A
* array (
* 'files' =>
* array (
* // ...
* ),
* 'Bartlett\\Reflect\\Analyser\\StructureAnalyser' =>
* array (
* 'namespaces' => 19,
* 'interfaces' => 7,
* 'traits' => 0,
* 'classes' => 56,
* 'abstractClasses' => 6,
* 'concreteClasses' => 50,
* 'functions' => 6,
* 'namedFunctions' => 0,
* 'anonymousFunctions' => 6,
* 'methods' => 280,
* 'publicMethods' => 241,
* 'protectedMethods' => 29,
* 'privateMethods' => 10,
* 'nonStaticMethods' => 273,
* 'staticMethods' => 7,
* 'constants' => 0,
* 'classConstants' => 17,
* 'globalConstants' => 0,
* 'magicConstants' => 3,
* 'testClasses' => 0,
* 'testMethods' => 0,
* ),
* 'Bartlett\\Reflect\\Analyser\\LocAnalyser' =>
* array (
* 'llocClasses' => 995,
* 'llocByNoc' => 0,
* 'llocByNom' => 0,
* 'llocFunctions' => 48,
* 'llocByNof' => 0,
* 'llocGlobal' => 0,
* 'classes' => 56,
* 'functions' => 6,
* 'methods' => 303,
* 'cloc' => 117,
* 'eloc' => 2700,
* 'lloc' => 1043,
* 'wloc' => 329,
* 'loc' => 3146,
* 'ccn' => 475,
* 'ccnMethods' => 451,
* ),
* )
*
*
* @category PHP
* @package PHP_Reflect
* @author Laurent Laville
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: @package_version@
* @link http://php5.laurent-laville.org/reflect/
* @since Example available since Release 3.0.0-alpha3
*/
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Bartlett\Reflect\Client;
// creates an instance of client
$client = new Client();
// request for a Bartlett\Reflect\Api\Analyser
$api = $client->api('analyser');
// perform request, on a data source with two analysers (structure, loc)
$dataSource = dirname(__DIR__) . '/src';
$analysers = array('structure', 'loc');
// equivalent to CLI command `phpreflect analyser:run ../src structure loc`
$metrics = $api->run($dataSource, $analysers);
var_export($metrics);
PK bCVŲl l build/1.6.1.txtnu W+A Additions and changes:
- none
Bug fixes:
- constants of extensions are no more considered as user constant
PK bCVʤ build/2.0.0.txtnu W+A New major version and API rewritten specially for PHP 5.3 and greater.
Additions and changes since RC3:
* cache feature will be included in next version (2.1.0).
PK bCVL build/2.0.0RC1.txtnu W+A New major version and API rewritten specially for PHP 5.3 and greater.
Additions and changes:
- Implement Event Driven Architecture powered by the Symfony EventDispatcher component.
- More data source can be parse. Implement a new source provider powered by the Symfony Finder component.
- Each element found during parsing can be exploited by an API almost equivalent to PHP5 Reflection.
This first release candidate is published for test purpose only, and should not be used yet in production.
PK bCVe7 build/1.8.0.txtnu W+A Additions and changes:
- Latest version of branch 1.x
- Little memory usage optimisation : tokens list are not kept after source parsing.
- visibility property for class method parsing was added by default.
Bug fixes:
- none
PK bCVBE build/build.xmlnu W+A
A toolchain manager for ${phing.project.name} ${build.version}
targets:
adoc.all Generate the full documentation
phar.all Generate the PHAR version
all Do all tasks above
PK bCV = build/1.9.0.txtnu W+A Additions and changes:
- drop support of PHP 5.2
- add Composer support
Bug fixes:
- avoid wrong trait detection if source code used a class property named trait: $this->trait
PK bCVz build/2.0.0RC3.txtnu W+A New major version and API rewritten specially for PHP 5.3 and greater.
Additions and changes since RC2:
* adds a new command *analyser:run* that display a structure report.
* adds a new command *plantUML:run* to make PlantUML diagrams (package or class).
* fixes `composer.json` syntax file.
* phar version is now a single file with all dependencies bundled.
* can use all file informations into into `reflect.progress`, `reflect.success` and `reflect.error` events.
* fixes PHP-Parser namespace error.
* prints progress filenames and optional errors on verbose level 2.
* prevent error on plugin:list command if json config file does not have a _plugins_ entry.
* each plugin is now really plug-and-play (should provide additional commands).
* console application respect now plug-and-play protocol.
* fixes plugin:list command render when multiple plugins are available.
Issues since RC2:
* GH-3: fix vendor paths between source composer and phar version.
*This is the last RC before final stable version planned for Fri, 4 April 2014.*
PK bCVaS S build/2.0.0RC2.txtnu W+A New major version and API rewritten specially for PHP 5.3 and greater.
Additions and changes since RC1:
* Parser: use now PHP-Parser 1.0-dev (https://github.com/nikic/PHP-Parser)
[-] removed component or element/method
[+] add component or element/method
* Reflect:
** [-] parseFile(), DefaultParser centralized now tokens analysis
** [-] pushParser()
** [-] popParser()
** [-] getTraits()
** [-] getInterfaces()
** [-] getClasses()
** [-] getFunctions()
** [-] getConstants()
** [-] getIncludes()
* ManagerInterface
** [-] pushParser()
** [-] popParser()
* [-] ParserInterface
* AbstractModel:
** [-] update()
* ClassModel:
** [-] update()
** [+] getStaticProperties()
** [+] getProperties()
** [+] getDefaultProperties()
** [+] getProperty()
** [+] hasProperty()
* MethodModel:
** [+] getClassName()
* PackageModel:
** [-] getIterator()
** [-] addElement()
** [+] getClasses()
** [+] getInterfaces()
** [+] getTraits()
** [+] getFunctions()
** [+] getConstants()
** [+] getDependencies()
** [+] isImported()
* Plugin:
** [+] AnalyserPlugin
* Token:
** [-] all tokens declarations
PK bCVuH build/1.6.2.txtnu W+A Additions and changes:
- support for token T_CALLABLE on PHP lower than 5.4
Bug fixes:
- PHP_CompatInfo GH-83: Freeze while scanning a big project (Thanks to Igor Klipach)
PK bCV[ build/1.6.0.txtnu W+A Additions and changes:
- add user, class and magic constants detection
- declares methods getNamespaces(), getTraits(), getInterfaces(), getClasses(),
getFunctions() and getConstants().
Bug fixes:
- Wrong detection of function name when a closure uses a typehint for the first argument
PK bCVF5 5 build/1.8.1.txtnu W+A Additions and changes:
- none
CAUTION: this version is the last to support PHP 5.2. Next API 2.0 will drop this support
Bug fixes:
- avoid wrong namespace detection if source code used a class property named namespace: $this->namespace
(Thanks to Remi Collet to notice me a strong behavior in class report)
PK bCVa a build/1.7.0.txtnu W+A Additions and changes:
- add T_FINALLY and T_YIELD tokens support for PHP 5.5
Bug fixes:
- none
PK bCV~3 tests/bootstrap.dev.phpnu W+A addClassMap(
array(
'Bartlett\Tests\Reflect\Analyser\FooAnalyser'
=> __DIR__ . '/Analyser/FooAnalyser.php',
'Bartlett\Tests\Reflect\Analyser\BarAnalyser'
=> __DIR__ . '/Analyser/BarAnalyser.php',
'Bartlett\Tests\Reflect\Model\GenericModelTest'
=> __DIR__ . '/Model/GenericModelTest.php',
'Bartlett\LoggerTestListener'
=> __DIR__ . '/../vendor/bartlett/phpunit-loggertestlistener/src/Bartlett/LoggerTestListener.php',
'Monolog\Handler\GrowlHandler'
=> __DIR__ . '/../vendor/bartlett/phpunit-loggertestlistener/extra/GrowlHandler.php',
'Monolog\Handler\AdvancedFilterHandler'
=> __DIR__ . '/../vendor/bartlett/phpunit-loggertestlistener/extra/AdvancedFilterHandler.php',
)
);
use Monolog\Logger;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Handler\GrowlHandler;
use Monolog\Handler\AdvancedFilterHandler;
class Psr3Logger extends Logger
{
public function __construct($name = 'PHPUnit')
{
// filter to be notified only on end test suite.
$filter1 = function($record) {
return (preg_match('/^TestSuite(.*)ended\. Tests/', $record['message']) === 1);
};
$stream = new RotatingFileHandler('/var/logs/phpreflect.log', 30);
$stream->setFilenameFormat('{filename}-{date}', 'Ymd');
$handlers = array($stream);
try {
$growl = new GrowlHandler(array(), Logger::NOTICE);
$filterGrowl = new AdvancedFilterHandler(
$growl,
array($filter1)
);
$handlers[] = $filterGrowl;
} catch (\Exception $e) {
// Growl client is probably not started
echo $e->getMessage(), PHP_EOL, PHP_EOL;
}
parent::__construct($name, $handlers);
}
}
PK bCV~\ tests/EnvironmentTest.phpnu W+A
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version GIT: $Id$
* @link http://php5.laurent-laville.org/reflect/
* @since Class available since Release 2.6.0
*/
namespace Bartlett\Tests\Reflect;
use Bartlett\Reflect\Environment;
/**
* Unit Test Case that covers Bartlett\Reflect\Environment
*
* @category PHP
* @package PHP_Reflect
* @subpackage Tests
* @author Laurent Laville
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: @package_version@
* @link http://php5.laurent-laville.org/reflect/
*/
class EnvironmentTest extends \PHPUnit_Framework_TestCase
{
const DIST_RC = 'phpreflect.json.dist';
/**
* Sets up the shared fixture.
*
* @return void
* @link http://phpunit.de/manual/current/en/fixtures.html#fixtures.sharing-fixture
*/
public static function setUpBeforeClass()
{
copy(dirname(__DIR__) . '/bin/' . self::DIST_RC, __DIR__ . '/' . self::DIST_RC);
}
/**
* Clean-up the shared fixture environment.
*
* @return void
* @link http://phpunit.de/manual/current/en/fixtures.html#fixtures.sharing-fixture
*/
public static function tearDownAfterClass()
{
unlink(__DIR__ . '/' . self::DIST_RC);
}
/**
* Clean-up single test environment
*
* @return void
*/
public function tearDown()
{
putenv("BARTLETT_SCAN_DIR=");
putenv("BARTLETTRC=");
}
/**
* @covers Bartlett\Reflect\Environment::getJsonConfigFilename
*
* @return void
*/
public function testUndefinedScanDir()
{
$this->assertFalse(
Environment::getJsonConfigFilename(),
"Environment variable BARTLETT_SCAN_DIR is not defined."
);
}
/**
* @covers Bartlett\Reflect\Environment::getJsonConfigFilename
*
* @return void
*/
public function testUndefinedConfigFilename()
{
putenv("BARTLETT_SCAN_DIR=.");
$this->assertFalse(
Environment::getJsonConfigFilename(),
"Environment variable BARTLETTRC is not defined."
);
}
/**
* @covers Bartlett\Reflect\Environment::getJsonConfigFilename
*
* @return void
*/
public function testGetConfigFilenameInSingleScanDirEnvironment()
{
$singleScanDir = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'bin';
putenv("BARTLETT_SCAN_DIR=$singleScanDir");
putenv("BARTLETTRC=" . self::DIST_RC);
$this->assertEquals(
$singleScanDir . DIRECTORY_SEPARATOR . self::DIST_RC,
Environment::getJsonConfigFilename(),
"Config filename does not match."
);
}
/**
* @covers Bartlett\Reflect\Environment::getJsonConfigFilename
*
* @return void
*/
public function testGetConfigFilenameInMultipleScanDirEnvironment()
{
$multipleScanDir = __DIR__ . DIRECTORY_SEPARATOR . PATH_SEPARATOR .
dirname(__DIR__) . DIRECTORY_SEPARATOR . 'bin';
putenv("BARTLETT_SCAN_DIR=$multipleScanDir");
putenv("BARTLETTRC=" . self::DIST_RC);
$this->assertEquals(
__DIR__ . DIRECTORY_SEPARATOR . self::DIST_RC,
Environment::getJsonConfigFilename(),
"Config filename does not match."
);
}
/**
* @covers Bartlett\Reflect\Environment::setScanDir
*
* @return void
*/
public function testSetDefaultScanDir()
{
$home = defined('PHP_WINDOWS_VERSION_BUILD') ? 'USERPROFILE' : 'HOME';
$dirs = array(
realpath('.'),
getenv($home) . DIRECTORY_SEPARATOR . '.config',
DIRECTORY_SEPARATOR . 'etc'
);
$multipleScanDir = implode(PATH_SEPARATOR, $dirs);
Environment::setScanDir();
$this->assertEquals(
$multipleScanDir,
getenv("BARTLETT_SCAN_DIR"),
"Environment variable BARTLETT_SCAN_DIR does not match."
);
}
}
PK bCV۹8 tests/bootstrap.phpnu W+A addClassMap(
array(
'Bartlett\Tests\Reflect\Analyser\FooAnalyser'
=> __DIR__ . '/Analyser/FooAnalyser.php',
'Bartlett\Tests\Reflect\Analyser\BarAnalyser'
=> __DIR__ . '/Analyser/BarAnalyser.php',
'Bartlett\Tests\Reflect\Model\GenericModelTest'
=> __DIR__ . '/Model/GenericModelTest.php',
)
);
PK bCVѨ2 ! tests/Model/ConstantModelTest.phpnu W+A
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version GIT: $Id$
* @link http://php5.laurent-laville.org/reflect/
* @since Class available since Release 2.0.0RC1
*/
namespace Bartlett\Tests\Reflect\Model;
/**
* Unit Test Case that covers Bartlett\Reflect\Model\ConstantModel
*
* @category PHP
* @package PHP_Reflect
* @subpackage Tests
* @author Laurent Laville
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: @package_version@
* @link http://php5.laurent-laville.org/reflect/
*/
class ConstantModelTest extends GenericModelTest
{
/**
* Sets up the shared fixture.
*
* @return void
*/
public static function setUpBeforeClass()
{
self::$fixture = 'constants.php';
parent::setUpBeforeClass();
}
/**
* Tests the Doc comment accessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getDocComment
* @group reflection
* @return void
*/
public function testDocCommentAccessor()
{
$c = 0; // sandbox\CONNECT_OK
$expected = '/** connection semaphore */';
$this->assertEquals(
$expected,
self::$models[$c]->getDocComment(),
self::$models[$c]->getName() . ' doc comment does not match.'
);
}
/**
* Tests file name accessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getFileName
* @group reflection
* @return void
*/
public function testFileNameAccessor()
{
$c = 0; // sandbox\CONNECT_OK
$this->assertEquals(
self::$fixture,
self::$models[$c]->getFileName(),
self::$models[$c]->getName() . ' file name does not match.'
);
}
/**
* Tests name accessor.
*
* covers Bartlett\Reflect\Model\ConstantModel::getName
* @group reflection
* @return void
*/
public function testNameAccessor()
{
$c = 0; // sandbox\CONNECT_OK
$this->assertEquals(
'sandbox\CONNECT_OK',
self::$models[$c]->getName(),
self::$models[$c]->getName() . ' constant name does not match.'
);
}
/**
* Tests value accessor of a user constant.
*
* covers Bartlett\Reflect\Model\ConstantModel::getValue
* @group reflection
* @return void
*/
public function testUserConstantValueAccessor()
{
$c = 0; // sandbox\CONNECT_OK
$this->assertEquals(
1,
self::$models[$c]->getValue(),
self::$models[$c]->getName() . ' user constant value does not match.'
);
}
/**
* Tests the namespace name accessor.
*
* covers Bartlett\Reflect\Model\ConstantModel::getNamespaceName
* @group reflection
* @return void
*/
public function testNamespaceNameAccessor()
{
$c = 0; // sandbox\CONNECT_OK
$this->assertEquals(
'sandbox',
self::$models[$c]->getNamespaceName(),
self::$models[$c]->getName() . ' namespace does not match.'
);
}
/**
* Tests function short name accessor.
*
* covers Bartlett\Reflect\Model\ConstantModel::getShortName
* @group reflection
* @return void
*/
public function testShortNameAccessor()
{
$c = 0; // sandbox\CONNECT_OK
$this->assertEquals(
'CONNECT_OK',
self::$models[$c]->getShortName(),
self::$models[$c]->getName() . ' short name does not match.'
);
}
/**
* Tests whether a constant is defined in a namespace.
*
* covers Bartlett\Reflect\Model\ConstantModel::inNamespace
* @group reflection
* @return void
*/
public function testInNamespace()
{
$c = 0; // sandbox\CONNECT_OK
$this->assertTrue(
self::$models[$c]->inNamespace(),
self::$models[$c]->getName() . ' is defined in a namespace.'
);
}
/**
* Tests whether a constant is internal.
*
* covers Bartlett\Reflect\Model\ConstantModel::isInternal
* @group reflection
* @return void
*/
public function testIsInternal()
{
$c = 0; // sandbox\CONNECT_OK
$this->assertFalse(
self::$models[$c]->isInternal(),
self::$models[$c]->getName() . ' is an internal constant.'
);
}
/**
* Tests whether a constant is magic.
*
* covers Bartlett\Reflect\Model\ConstantModel::isMagic
* @group reflection
* @return void
*/
public function testIsMagic()
{
$c = 0; // sandbox\CONNECT_OK
$this->assertFalse(
self::$models[$c]->isMagic(),
self::$models[$c]->getName() . ' is a magic constant.'
);
}
/**
* Tests whether a constant is scalar.
*
* covers Bartlett\Reflect\Model\ConstantModel::isScalar
* @group reflection
* @return void
*/
public function testIsScalar()
{
$c = 4; // sandbox\TWO
$this->assertFalse(
self::$models[$c]->isScalar(),
self::$models[$c]->getName() . ' is a scalar constant.'
);
}
/**
* Tests string representation of the FunctionModel object
*
* covers Bartlett\Reflect\Model\ConstantModel::__toString
* @group reflection
* @return void
*/
public function testToString()
{
$c = 4; // sandbox\TWO
$expected = <<expectOutputString($expected);
print(
self::$models[$c]->__toString()
);
}
}
PK bCV@ ! tests/Model/PropertyModelTest.phpnu W+A
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version GIT: $Id$
* @link http://php5.laurent-laville.org/reflect/
* @since Class available since Release 2.0.0RC2
*/
namespace Bartlett\Tests\Reflect\Model;
/**
* Unit Test Case that covers Bartlett\Reflect\Model\PropertyModel
*
* @category PHP
* @package PHP_Reflect
* @subpackage Tests
* @author Laurent Laville
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: @package_version@
* @link http://php5.laurent-laville.org/reflect/
*/
class PropertyModelTest extends GenericModelTest
{
/**
* Sets up the shared fixture.
*
* @return void
*/
public static function setUpBeforeClass()
{
self::$fixture = 'properties.php';
parent::setUpBeforeClass();
}
/**
* Tests doc comment accessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getDocComment
* @group reflection
* @return void
*/
public function testDocCommentAccessor()
{
$c = 0; // class SimpleClass
$p = 5; // var6 property
$properties = self::$models[$c]->getProperties();
$this->assertEquals(
'/** This is allowed only in PHP 5.3.0 and later. */',
$properties[$p]->getDocComment(),
$properties[$p]->getName()
. ' doc comment does not match.'
);
}
/**
* Tests name of the property.
*
* covers Bartlett\Reflect\Model\PropertyModel::getName
* @group reflection
* @return void
*/
public function testNameAccessor()
{
$c = 0; // class SimpleClass
$p = 1; // var2 property
$properties = self::$models[$c]->getProperties();
$this->assertEquals(
'var2',
$properties[$p]->getName(),
$properties[$p]->getName()
. ", property #$p name does not match."
);
}
/**
* Tests declaring class of the property.
*
* covers Bartlett\Reflect\Model\PropertyModel::getDeclaringClass
* @group reflection
* @return void
*/
public function testDeclaringClassAccessor()
{
$c = 0; // class SimpleClass
$p = 1; // var2 property
$properties = self::$models[$c]->getProperties();
$this->assertEquals(
'SimpleClass',
$properties[$p]->getDeclaringClass()->getName(),
$properties[$p]->getName()
. ", property #$p declaring class does not match."
);
}
/**
* Tests if property is defined at run-time or compile-time.
*
* covers Bartlett\Reflect\Model\PropertyModel::isDefault
* @group reflection
* @return void
*/
public function testDefaultValue()
{
$c = 0; // class SimpleClass
$p = 1; // var2 property
$properties = self::$models[$c]->getProperties();
$this->assertTrue(
$properties[$p]->isDefault(),
$properties[$p]->getName()
. ", property #$p was not declared at compile-time."
);
}
/**
* Tests default value of the property.
*
* covers Bartlett\Reflect\Model\PropertyModel::getValue
* @group reflection
* @return void
*/
public function testValueAccessor()
{
$c = 0; // class SimpleClass
$p = 5; // var6 property
$properties = self::$models[$c]->getProperties();
$expected = 'hello world';
$this->assertEquals(
$expected,
$properties[$p]->getValue(),
$properties[$p]->getName()
. ", property #$p value does not match."
);
}
/**
* Tests property with private visibility.
*
* covers Bartlett\Reflect\Model\PropertyModel::isPrivate
* @group reflection
* @return void
*/
public function testPrivateProperty()
{
$c = 0; // class SimpleClass
$p = 2; // var3 property
$properties = self::$models[$c]->getProperties();
$this->assertTrue(
$properties[$p]->isPrivate(),
$properties[$p]->getName()
. ' is not a private property.'
);
}
/**
* Tests property with protected visibility.
*
* covers Bartlett\Reflect\Model\PropertyModel::isProtected
* @group reflection
* @return void
*/
public function testProtectedProperty()
{
$c = 0; // class SimpleClass
$p = 3; // var4 property
$properties = self::$models[$c]->getProperties();
$this->assertTrue(
$properties[$p]->isProtected(),
$properties[$p]->getName()
. ' is not a protected property.'
);
}
/**
* Tests property with public visibility.
*
* covers Bartlett\Reflect\Model\PropertyModel::isPublic
* @group reflection
* @return void
*/
public function testPublicProperty()
{
$c = 0; // class SimpleClass
$p = 4; // var5 property
$properties = self::$models[$c]->getProperties();
$this->assertTrue(
$properties[$p]->isPublic(),
$properties[$p]->getName()
. ' is not a public property.'
);
}
/**
* Tests property with static keyword.
*
* covers Bartlett\Reflect\Model\PropertyModel::isStatic
* @group reflection
* @return void
*/
public function testStaticProperty()
{
$c = 0; // class SimpleClass
$p = 2; // var3 property
$properties = self::$models[$c]->getProperties();
$this->assertTrue(
$properties[$p]->isStatic(),
$properties[$p]->getName()
. ' is not a static property.'
);
}
/**
* Tests property with implicit public visibility.
*
* covers Bartlett\Reflect\Model\PropertyModel::isImplicitlyPublic
* @group reflection
* @return void
*/
public function testImplicitlyPublicProperty()
{
$c = 0; // class SimpleClass
$p = 0; // debug property
$properties = self::$models[$c]->getProperties();
$this->assertTrue(
$properties[$p]->isImplicitlyPublic(),
$properties[$p]->getName()
. ' is not implicitly public.'
);
}
/**
* Tests string representation of the PropertyModel object
* for a static property.
*
* covers Bartlett\Reflect\Model\PropertyModel::__toString
* @group reflection
* @return void
*/
public function testToStringStaticProperty()
{
$c = 0; // class SimpleClass
$p = 2; // var3 property
$properties = self::$models[$c]->getProperties();
$this->assertEquals(
'Property [ private static $var3 ]' . "\n",
$properties[$p]->__toString(),
$properties[$p]->getName()
. ", property #$p string representation does not match."
);
}
}
PK bCVh4
},3 ,3 " tests/Model/ParameterModelTest.phpnu W+A
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version GIT: $Id$
* @link http://php5.laurent-laville.org/reflect/
* @since Class available since Release 2.0.0RC1
*/
namespace Bartlett\Tests\Reflect\Model;
use Bartlett\Reflect\Exception\ModelException;
/**
* Unit Test Case that covers Bartlett\Reflect\Model\ParameterModel
*
* @category PHP
* @package PHP_Reflect
* @subpackage Tests
* @author Laurent Laville
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: @package_version@
* @link http://php5.laurent-laville.org/reflect/
*/
class ParameterModelTest extends GenericModelTest
{
/**
* Sets up the shared fixture.
*
* @return void
*/
public static function setUpBeforeClass()
{
self::$fixture = 'functions.php';
parent::setUpBeforeClass();
}
/**
* Tests name of the parameter.
*
* covers Bartlett\Reflect\Model\ParameterModel::getName
* @group reflection
* @return void
*/
public function testNameAccessor()
{
$c = 1; // class Foo
$m = 1; // method otherfunction
$p = 0; // parameter $baz
$methods = self::$models[$c]->getMethods();
$parameters = $methods[$m]->getParameters();
$this->assertEquals(
'baz',
$parameters[$p]->getName(),
$methods[$m]->getName()
. ", parameter #$p name does not match."
);
}
/**
* Tests position of the parameter.
*
* covers Bartlett\Reflect\Model\ParameterModel::getPosition
* @group reflection
* @return void
*/
public function testPositionAccessor()
{
$f = 2; // function singleFunction
$p = 1; // parameter $somethingelse
$parameters = self::$models[$f]->getParameters();
$this->assertEquals(
1,
$parameters[$p]->getPosition(),
self::$models[$f]->getName() . ", parameter #$p position does not match."
);
}
/**
* Tests type hinting of the parameter.
*
* covers Bartlett\Reflect\Model\ParameterModel::getTypeHint
* @group reflection
* @return void
*/
public function testTypeHintAccessor()
{
$f = 2; // function singleFunction
$p = 0; // parameter $someparam
$parameters = self::$models[$f]->getParameters();
$this->assertEquals(
'array',
$parameters[$p]->getTypeHint(),
self::$models[$f]->getName() . ", parameter #$p type hint does not match."
);
}
/**
* Tests whether the parameter allows NULL
* when type hint is defined without default value for a class method.
*
* covers Bartlett\Reflect\Model\ParameterModel::allowsNull
* @group reflection
* @return void
*/
public function testAllowsNullWhenOnlyTypeHintDefinedOnClassMethod()
{
$i = 0; // interface iB extends iA
$m = 0; // method baz
$p = 0; // parameter $baz
$methods = self::$models[$i]->getMethods();
$parameters = $methods[$m]->getParameters();
$this->assertFalse(
$parameters[$p]->allowsNull(),
self::$models[$i]->getName()
. '::'
. $methods[$m]->getName()
. ", parameter #$p does not allow null with type hint without null default value."
);
}
/**
* Tests whether the parameter allows NULL
* when type hint is defined with default value is null for a class method.
*
* covers Bartlett\Reflect\Model\ParameterModel::allowsNull
* @group reflection
* @return void
*/
public function testAllowsNullWhenTypeHintDefinedWithNullDefaultValueOnClassMethod()
{
$c = 1; // class Foo
$m = 0; // method myfunction
$p = 0; // parameter $param
$methods = self::$models[$c]->getMethods();
$parameters = $methods[$m]->getParameters();
$this->assertTrue(
$parameters[$p]->allowsNull(),
self::$models[$c]->getName()
. '::'
. $methods[$m]->getName()
. ", parameter #$p allows null with type hint and null default value."
);
}
/**
* Tests whether the parameter allows NULL
* when type hint is not defined for a class method.
*
* covers Bartlett\Reflect\Model\ParameterModel::allowsNull
* @group reflection
* @return void
*/
public function testAllowsNullWithoutTypeHintDefinedOnClassMethod()
{
$c = 1; // class Foo
$m = 1; // method otherfunction
$p = 1; // parameter $param
$methods = self::$models[$c]->getMethods();
$parameters = $methods[$m]->getParameters();
$this->assertTrue(
$parameters[$p]->allowsNull(),
$methods[$m]->getName()
. ", parameter #$p allows null without type hint."
);
}
/**
* Tests whether the parameter allows NULL
* for a user-defined function.
*
* covers Bartlett\Reflect\Model\ParameterModel::allowsNull
* @group reflection
* @return void
*/
public function testAllowsNullOnUserFunction()
{
$f = 2; // function singleFunction
$p = 2; // parameter $lastone
$parameters = self::$models[$f]->getParameters();
$this->assertTrue(
$parameters[$p]->allowsNull(),
self::$models[$f]->getName() . ", parameter #$p allows null when default value is null."
);
}
/**
* Tests if the parameter is optional.
*
* covers Bartlett\Reflect\Model\ParameterModel::isOptional
* @group reflection
* @return void
*/
public function testIsOptional()
{
$f = 2; // function singleFunction
$p = 1; // parameter $somethingelse
$parameters = self::$models[$f]->getParameters();
$this->assertFalse(
$parameters[$p]->isOptional(),
self::$models[$f]->getName() . ", parameter #$p is required."
);
}
/**
* Checks if the parameter is passed in by reference.
*
* covers Bartlett\Reflect\Model\ParameterModel::isPassedByReference
* @group reflection
* @return void
*/
public function testIsPassedByReference()
{
$f = 3; // function myprocess
$p = 1; // parameter $myresult
$parameters = self::$models[$f]->getParameters();
$this->assertTrue(
$parameters[$p]->isPassedByReference(),
self::$models[$f]->getName() . ", parameter #$p is passed by reference."
);
}
/**
* Checks if the parameter is variadic.
*
* covers Bartlett\Reflect\Model\ParameterModel::isVariadic
* @group reflection
* @link http://php.net/manual/en/migration56.new-features.php#migration56.new-features.variadics
* @return void
*/
public function testIsVariadic()
{
$f = 3; // function myprocess
$p = 2; // parameter $opt
$parameters = self::$models[$f]->getParameters();
$this->assertTrue(
$parameters[$p]->isVariadic(),
self::$models[$f]->getName() . ", parameter #$p is not variadic."
);
}
/**
* Tests if the parameter expects an array.
*
* covers Bartlett\Reflect\Model\ParameterModel::isArray
* @group reflection
* @return void
*/
public function testIsArray()
{
$f = 2; // function singleFunction
$p = 0; // parameter $someparam
$parameters = self::$models[$f]->getParameters();
$this->assertTrue(
$parameters[$p]->isArray(),
self::$models[$f]->getName() . ", parameter #$p expects an array."
);
}
/**
* Tests if the parameter expects a callback.
*
* covers Bartlett\Reflect\Model\ParameterModel::isCallable
* @group reflection
* @return void
*/
public function testIsCallable()
{
$f = 3; // function myprocess
$p = 0; // parameter $param
$parameters = self::$models[$f]->getParameters();
$this->assertTrue(
$parameters[$p]->isCallable(),
self::$models[$f]->getName() . ", parameter #$p expects a callback."
);
}
/**
* Tests if a default value for the parameter is available
* for a user-defined function.
*
* covers Bartlett\Reflect\Model\ParameterModel::isDefaultValueAvailable
* @group reflection
* @return void
*/
public function testIsDefaultValueAvailableOnUserFunction()
{
$f = 2; // function singleFunction
$p = 2; // parameter $lastone
$parameters = self::$models[$f]->getParameters();
$this->assertTrue(
$parameters[$p]->isDefaultValueAvailable(),
self::$models[$f]->getName() . ", parameter #$p have a default value."
);
}
/**
* Tests the default value of the parameter for a class method.
*
* covers Bartlett\Reflect\Model\ParameterModel::getDefaultValue
* @group reflection
* @return void
*/
public function testDefaultValueAccessorOnClassMethod()
{
$c = 1; // class Foo
$m = 0; // method myfunction
$p = 1; // parameter $otherparam
$methods = self::$models[$c]->getMethods();
$parameters = $methods[$m]->getParameters();
$this->assertEquals(
'TRUE',
$parameters[$p]->getDefaultValue(),
$methods[$m]->getName()
. ", parameter #$p default value does not match."
);
}
/**
* Tests the default value of the parameter for a user-defined function.
*
* covers Bartlett\Reflect\Model\ParameterModel::getDefaultValue
* @group reflection
* @return void
*/
public function testDefaultValueAccessorOnUserFunction()
{
$f = 2; // function singleFunction
$p = 2; // parameter $lastone
$parameters = self::$models[$f]->getParameters();
$this->assertEquals(
'NULL',
$parameters[2]->getDefaultValue(),
self::$models[$f]->getName() . ", parameter #$p default value does not match."
);
}
/**
* Tests the default value of a parameter not optional.
*
* covers Bartlett\Reflect\Model\ParameterModel::getDefaultValue
* @group reflection
* @return void
*/
public function testDefaultValueAccessorOnRequiredParameter()
{
try {
$f = 2; // function singleFunction
$p = 0; // parameter $someparam
$parameters = self::$models[$f]->getParameters();
$parameters[$p]->getDefaultValue();
} catch (ModelException $expected) {
$this->assertEquals(
'Parameter #0 [$someparam] is not optional.',
$expected->getMessage(),
'Expected exception message does not match'
);
return;
}
$this->fail(
'An expected Bartlett\Reflect\Exception\ModelException exception' .
' has not been raised.'
);
}
/**
* Tests string representation of the ParameterModel object
* for a required parameter.
*
* covers Bartlett\Reflect\Model\ParameterModel::__toString
* @group reflection
* @return void
*/
public function testToStringRequiredParameter()
{
$f = 3; // function myprocess
$p = 1; // parameter $myresult
$parameters = self::$models[$f]->getParameters();
$this->assertEquals(
'Parameter #1 [ &$myresult ]' . "\n",
$parameters[$p]->__toString(),
self::$models[$f]->getName() . ", parameter #$p string representation does not match."
);
}
/**
* Tests string representation of the ParameterModel object
* for an optional parameter.
*
* covers Bartlett\Reflect\Model\ParameterModel::__toString
* @group reflection
* @return void
*/
public function testToStringOptionalParameter()
{
$c = 1; // class Foo
$m = 0; // method myfunction
$p = 0; // parameter $param
$methods = self::$models[$c]->getMethods();
$parameters = $methods[$m]->getParameters();
$this->assertEquals(
'Parameter #0 [ stdClass $param = NULL ]' . "\n",
$parameters[$p]->__toString(),
$methods[$m]->getName()
. ", parameter #$p string representation does not match."
);
}
}
PK bCV =.? ? tests/Model/ClassModelTest.phpnu W+A
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version GIT: $Id$
* @link http://php5.laurent-laville.org/reflect/
* @since Class available since Release 2.0.0RC1
*/
namespace Bartlett\Tests\Reflect\Model;
use Bartlett\Reflect\Exception\ModelException;
/**
* Unit Test Case that covers Bartlett\Reflect\Model\ClassModel
*
* @category PHP
* @package PHP_Reflect
* @subpackage Tests
* @author Laurent Laville
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: @package_version@
* @link http://php5.laurent-laville.org/reflect/
*/
class ClassModelTest extends GenericModelTest
{
/**
* Sets up the shared fixture.
*
* @return void
*/
public static function setUpBeforeClass()
{
self::$fixture = 'classes.php';
parent::setUpBeforeClass();
}
/**
* Tests the Doc comment accessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getDocComment
* @group reflection
* @return void
*/
public function testDocCommentAccessor()
{
$c = 3; // class Foo implements iB
$expected = '/** short desc for class that implement a unique interface */';
$this->assertEquals(
$expected,
self::$models[$c]->getDocComment(),
self::$models[$c]->getName() . ' doc comment does not match.'
);
}
/**
* Tests starting line number accessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getStartLine
* @group reflection
* @return void
*/
public function testStartLineAccessor()
{
$c = 3; // class Foo implements iB
$this->assertEquals(
21,
self::$models[$c]->getStartLine(),
self::$models[$c]->getName() . ' starting line does not match.'
);
}
/**
* Tests ending line number accessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getEndLine
* @group reflection
* @return void
*/
public function testEndLineAccessor()
{
$c = 3; // class Foo implements iB
$this->assertEquals(
33,
self::$models[$c]->getEndLine(),
self::$models[$c]->getName() . ' ending line does not match.'
);
}
/**
* Tests file name accessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getFileName
* @group reflection
* @return void
*/
public function testFileNameAccessor()
{
$c = 3; // class Foo implements iB
$this->assertEquals(
self::$fixture,
self::$models[$c]->getFileName(),
self::$models[$c]->getName() . ' file name does not match.'
);
}
/**
* Tests class name accessor.
*
* covers Bartlett\Reflect\Model\ClassModel::getName
* @group reflection
* @return void
*/
public function testNameAccessor()
{
$c = 3; // class Foo implements iB
$this->assertEquals(
'Foo',
self::$models[$c]->getName(),
self::$models[$c]->getName() . ' class name does not match.'
);
}
/**
* Tests the namespace name accessor.
*
* covers Bartlett\Reflect\Model\ClassModel::getNamespaceName
* @group reflection
* @return void
*/
public function testNamespaceNameAccessor()
{
$c = 3; // class Foo implements iB
$this->assertEquals(
'',
self::$models[$c]->getNamespaceName(),
self::$models[$c]->getName() . ' namespace does not match.'
);
}
/**
* Tests class short name accessor.
*
* covers Bartlett\Reflect\Model\ClassModel::getShortName
* @group reflection
* @return void
*/
public function testShortNameAccessor()
{
$c = 3; // class Foo implements iB
$this->assertEquals(
'Foo',
self::$models[$c]->getShortName(),
self::$models[$c]->getName() . ' short name does not match.'
);
}
/**
* Tests class constants accessor.
*
* covers Bartlett\Reflect\Model\ClassModel::getConstants
* @group reflection
* @return void
*/
public function testConstantsAccessor()
{
$c = 6; // class Bar
$this->assertCount(
2,
self::$models[$c]->getConstants(),
self::$models[$c]->getName() . ' constants number does not match.'
);
}
/**
* Tests class constant accessor.
*
* covers Bartlett\Reflect\Model\ClassModel::getConstant
* @group reflection
* @return void
*/
public function testConstantAccessor()
{
$c = 6; // class Bar
$k = 'ONE'; // constant ONE
$this->assertEquals(
'Number one',
self::$models[$c]->getConstant($k),
self::$models[$c]->getName() . "::$k constant value does not match."
);
}
/**
* Tests class constant accessor.
*
* covers Bartlett\Reflect\Model\ClassModel::getConstant
* @group reflection
* @return void
*/
public function testUndefinedConstant()
{
$c = 6; // class Bar
$k = 'FOO'; // constant FOO is not implemented
$this->assertFalse(
self::$models[$c]->getConstant($k),
"Constant [$k] is defined."
);
}
/**
* Tests whether a specific constant is defined in a class.
*
* covers Bartlett\Reflect\Model\ClassModel::hasConstant
* @group reflection
* @return void
*/
public function testHasConstant()
{
$c = 6; // class Bar
$k = 'TWO'; // constant TWO
$this->assertTrue(
self::$models[$c]->hasConstant($k),
self::$models[$c]->getName() . " $k constant does not exist."
);
}
/**
* Tests class methods accessor.
*
* covers Bartlett\Reflect\Model\ClassModel::getMethods
* @group reflection
* @return void
*/
public function testMethodsAccessor()
{
$c = 6; // class Bar
$this->assertCount(
2,
self::$models[$c]->getMethods(),
self::$models[$c]->getName() . ' methods number does not match.'
);
}
/**
* Tests class method accessor.
*
* covers Bartlett\Reflect\Model\ClassModel::getMethod
* @group reflection
* @return void
*/
public function testMethodAccessor()
{
$c = 6; // class Bar
$m = 'otherfunction';
$this->assertInstanceOf(
'Bartlett\Reflect\Model\MethodModel',
self::$models[$c]->getMethod($m),
'This is not a MethodModel object'
);
}
/**
* Tests class method accessor.
*
* covers Bartlett\Reflect\Model\ClassModel::getMethod
* @group reflection
* @return void
*/
public function testUndefinedMethod()
{
try {
$c = 6; // class Bar
$m = 'nemo'; // method nemo is not implemented
self::$models[$c]->getMethod($m);
} catch (ModelException $expected) {
$this->assertEquals(
"Method $m does not exist.",
$expected->getMessage(),
'Expected exception message does not match'
);
return;
}
$this->fail(
'An expected Bartlett\Reflect\Exception\ModelException exception' .
' has not been raised.'
);
}
/**
* Tests whether a specific method is defined in a class.
*
* covers Bartlett\Reflect\Model\ClassModel::hasMethod
* @group reflection
* @return void
*/
public function testHasMethod()
{
$c = 6; // class Bar
$m = 'otherfunction';
$this->assertTrue(
self::$models[$c]->hasMethod($m),
self::$models[$c]->getName() . " $m method does not exist."
);
}
/**
* Tests whether a class is defined in a namespace.
*
* covers Bartlett\Reflect\Model\ClassModel::inNamespace
* @group reflection
* @return void
*/
public function testInNamespace()
{
$c = 6; // class Bar
$this->assertFalse(
self::$models[$c]->inNamespace(),
self::$models[$c]->getName() . " is in a namespace."
);
}
/**
* Tests if the class is abstract.
*
* covers Bartlett\Reflect\Model\ClassModel::isAbstract
* @group reflection
* @return void
*/
public function testAbstractClass()
{
$c = 4; // abstract class AbstractClass
$this->assertTrue(
self::$models[$c]->isAbstract(),
self::$models[$c]->getName() . ' is not an abstract class.'
);
}
/**
* Tests if the class is an interface.
*
* covers Bartlett\Reflect\Model\ClassModel::isInterface
* @group reflection
* @return void
*/
public function testInterfaceClass()
{
$c = 4; // abstract class AbstractClass
$this->assertFalse(
self::$models[$c]->isInterface(),
self::$models[$c]->getName() . ' is an abstract class.'
);
}
/**
* Tests if the class is a trait.
*
* covers Bartlett\Reflect\Model\ClassModel::isTrait
* @group reflection
* @return void
*/
public function testTraitClass()
{
$i = 1; // interface iA
$this->assertFalse(
self::$models[$i]->isTrait(),
self::$models[$i]->getName() . ' is an interface.'
);
}
/**
* Tests if the class is a user-defined class.
*
* covers Bartlett\Reflect\Model\ClassModel::isUserDefined
* @group reflection
* @return void
*/
public function testUserDefinedClass()
{
$c = 5; // class MyDestructableClass
$this->assertTrue(
self::$models[$c]->isUserDefined(),
self::$models[$c]->getName() . ' is not a user-defined class.'
);
}
/**
* Tests if the class is iterateable.
*
* covers Bartlett\Reflect\Model\ClassModel::isIterateable
* @group reflection
* @return void
*/
public function testIterateableClass()
{
$c = 7; // class IteratorClass implements Iterator
$this->assertTrue(
self::$models[$c]->isIterateable(),
self::$models[$c]->getName() . ' is not iterateable.'
);
}
/**
* Tests if the class is iterateable by inheritance.
*
* covers Bartlett\Reflect\Model\ClassModel::isIterateable
* @group reflection
* @return void
*/
public function testIterateableClassByInheritance()
{
$this->markTestIncomplete('Not yet fully implemented (FIXME)');
$c = 8; // class DerivedClass
$this->assertTrue(
self::$models[$c]->isIterateable(),
self::$models[$c]->getName() . ' is not iterateable.'
);
}
/**
* Tests if the class is cloneable.
*
* covers Bartlett\Reflect\Model\ClassModel::isCloneable
* @group reflection
* @return void
*/
public function testNotCloneableClass()
{
$c = 9; // class NotCloneable
$this->assertFalse(
self::$models[$c]->isCloneable(),
self::$models[$c]->getName() . ' is cloneable and should not be.'
);
}
/**
* Tests if the class is cloneable.
*
* covers Bartlett\Reflect\Model\ClassModel::isCloneable
* @group reflection
* @return void
*/
public function testCloneableClass()
{
$c = 10; // class Cloneable
$this->assertTrue(
self::$models[$c]->isCloneable(),
self::$models[$c]->getName() . ' is not cloneable.'
);
}
/**
* Tests if the class is final.
*
* covers Bartlett\Reflect\Model\ClassModel::isFinal
* @group reflection
* @return void
*/
public function testNotFinalClass()
{
$c = 3; // class Foo implements iB
$this->assertFalse(
self::$models[$c]->isFinal(),
self::$models[$c]->getName() . ' should not be a final class.'
);
}
/**
* Tests if the class is final.
*
* covers Bartlett\Reflect\Model\ClassModel::isFinal
* @group reflection
* @return void
*/
public function testFinalClass()
{
$c = 11; // class TestFinalClass
$this->assertTrue(
self::$models[$c]->isFinal(),
self::$models[$c]->getName() . ' is not a final class.'
);
}
/**
* Tests if the class is instantiable.
*
* covers Bartlett\Reflect\Model\ClassModel::isInstantiable
* @group reflection
* @return void
*/
public function testNotInstantiableClass()
{
$i = 0; // interface iTemplate
$this->assertFalse(
self::$models[$i]->isInstantiable(),
self::$models[$i]->getName() . ' should not be instantiable.'
);
}
/**
* Tests if the class is instantiable.
*
* covers Bartlett\Reflect\Model\ClassModel::isInstantiable
* @group reflection
* @return void
*/
public function testInstantiableClass()
{
$c = 3; // class Foo implements iB
$this->assertTrue(
self::$models[$c]->isInstantiable(),
self::$models[$c]->getName() . ' is not instantiable.'
);
}
/**
* Tests if the class is a subclass of a specified class.
*
* covers Bartlett\Reflect\Model\ClassModel::isSubclassOf
* @group reflection
* @return void
*/
public function testSubclassOfInterface()
{
$this->markTestIncomplete('Not yet fully implemented (FIXME)');
$c = 8; // class DerivedClass extends IteratorClass
$n = 'Iterator';
$this->assertTrue(
self::$models[$c]->isSubclassOf($n),
self::$models[$c]->getName() . " is not a subclass of $n."
);
}
/**
* Tests if the class is a subclass of a specified class.
*
* covers Bartlett\Reflect\Model\ClassModel::isSubclassOf
* @group reflection
* @return void
*/
public function testSubclassOfClass()
{
$this->markTestIncomplete('Not yet fully implemented (FIXME)');
$c = 8; // class DerivedClass extends IteratorClass
$n = 'IteratorClass';
$this->assertTrue(
self::$models[$c]->isSubclassOf($n),
self::$models[$c]->getName() . " is not a subclass of $n."
);
}
/**
* Tests string representation of the ClassModel object
*
* covers Bartlett\Reflect\Model\ClassModel::__toString
* @group reflection
* @return void
*/
public function testToString()
{
$c = 6; // class Bar
$expected = << class Bar ] {
@@ %filename% 60 - 72
- Constants [2] {
Constant [ ONE ] { Number one }
Constant [ TWO ] { Number two }
}
- Properties [0] {
}
- Methods [2] {
Method [ public method myfunction ] {
@@ %filename% 65 - 66
- Parameters [2] {
Parameter #0 [ stdClass \$param = NULL ]
Parameter #1 [ \$otherparam = TRUE ]
}
}
Method [ protected method otherfunction ] {
@@ %filename% 68 - 70
- Parameters [2] {
Parameter #0 [ Baz \$baz ]
Parameter #1 [ \$param ]
}
}
}
}
EOS;
$this->expectOutputString(
str_replace('%filename%', self::$fixture, $expected)
);
print(
self::$models[$c]->__toString()
);
}
}
PK bCVp tests/Model/IssueTest.phpnu W+A
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version GIT: $Id$
* @link http://php5.laurent-laville.org/reflect/
* @since Class available since Release 3.0.0-alpha2
*/
namespace Bartlett\Tests\Reflect\Model;
use Bartlett\Reflect\Client;
/**
* Tests for PHP_CompatInfo, retrieving reference elements,
* and versioning information.
*
* @category PHP
* @package PHP_Reflect
* @subpackage Tests
* @author Laurent Laville
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: @package_version@
* @link http://php5.laurent-laville.org/reflect/
*/
class IssueTest extends \PHPUnit_Framework_TestCase
{
const GH4 = 'packages.php';
protected static $fixtures;
protected static $api;
/**
* Sets up the shared fixture.
*
* @return void
*/
public static function setUpBeforeClass()
{
self::$fixtures = dirname(__DIR__) . DIRECTORY_SEPARATOR
. 'fixtures' . DIRECTORY_SEPARATOR;
$client = new Client();
// request for a Bartlett\Reflect\Api\Analyser
self::$api = $client->api('analyser');
}
/**
* Regression test for bug GH#4
*
* @link https://github.com/llaville/php-reflect/issues/
* "Handle namespaces without name"
* @link https://github.com/llaville/php-reflect/pull/4 by Eric Colinet
* @group regression
* @return void
*/
public function testBugGH4()
{
$dataSource = self::$fixtures . self::GH4;
$analysers = array('reflection');
$metrics = self::$api->run($dataSource, $analysers);
$models = $metrics['ReflectionAnalyser'];
$c = 0; // empty namespace, class MyGlobalClass
$this->assertInstanceOf(
'Bartlett\Reflect\Model\ClassModel',
$models[$c]
);
$this->assertEquals('MyGlobalClass', $models[$c]->getName());
}
}
PK bCV m- - tests/Model/MethodModelTest.phpnu W+A
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version GIT: $Id$
* @link http://php5.laurent-laville.org/reflect/
* @since Class available since Release 2.0.0RC1
*/
namespace Bartlett\Tests\Reflect\Model;
/**
* Unit Test Case that covers Bartlett\Reflect\Model\MethodModel
*
* @category PHP
* @package PHP_Reflect
* @subpackage Tests
* @author Laurent Laville
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: @package_version@
* @link http://php5.laurent-laville.org/reflect/
*/
class MethodModelTest extends GenericModelTest
{
/**
* Sets up the shared fixture.
*
* @return void
*/
public static function setUpBeforeClass()
{
self::$fixture = 'classes.php';
parent::setUpBeforeClass();
}
/**
* Tests doc comment accessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getDocComment
* @group reflection
* @return void
*/
public function testDocCommentAccessor()
{
$c = 4; // abstract class AbstractClass
$m = 0; // method lambdaMethod
$methods = self::$models[$c]->getMethods();
$this->assertEquals(
'/** static meth: */',
$methods[$m]->getDocComment(),
$methods[$m]->getName()
. ' doc comment does not match.'
);
}
/**
* Tests starting line number accessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getStartLine
* @group reflection
* @return void
*/
public function testStartLineAccessor()
{
$c = 5; // class MyDestructableClass
$m = 2; // method dump;
$methods = self::$models[$c]->getMethods();
$this->assertEquals(
54,
$methods[$m]->getStartLine(),
$methods[$m]->getName()
. ' starting line does not match.'
);
}
/**
* Tests ending line number accessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getEndLine
* @group reflection
* @return void
*/
public function testEndLineAccessor()
{
$c = 5; // class MyDestructableClass
$m = 2; // method dump;
$methods = self::$models[$c]->getMethods();
$this->assertEquals(
57,
$methods[$m]->getEndLine(),
$methods[$m]->getName()
. ' ending line does not match.'
);
}
/**
* Tests file name accessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getFileName
* @group reflection
* @return void
*/
public function testFileNameAccessor()
{
$c = 5; // class MyDestructableClass
$m = 2; // method dump;
$methods = self::$models[$c]->getMethods();
$this->assertEquals(
self::$fixtures . 'classes.php',
$methods[$m]->getFileName(),
$methods[$m]->getName()
. ' file name does not match.'
);
}
/**
* Tests method name accessor.
*
* covers Bartlett\Reflect\Model\AbstractFunctionModel::getShortName
* @group reflection
* @return void
*/
public function testNameAccessor()
{
$c = 5; // class MyDestructableClass
$m = 2; // method dump;
$methods = self::$models[$c]->getMethods();
$this->assertEquals(
'dump',
$methods[$m]->getShortName(),
$methods[$m]->getName()
. ' method name does not match.'
);
}
/**
* Tests declaring class of the method.
*
* covers Bartlett\Reflect\Model\MethodModel::getDeclaringClass
* @group reflection
* @return void
*/
public function testDeclaringClassAccessor()
{
$c = 5; // class MyDestructableClass
$m = 2; // method dump;
$methods = self::$models[$c]->getMethods();
$this->assertEquals(
'MyDestructableClass',
$methods[$m]->getDeclaringClass()->getName(),
$methods[$m]->getName()
. ", method #$m declaring class does not match."
);
}
/**
* Tests method extension name acessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getExtensionName
* @group reflection
* @return void
*/
public function testExtensionNameAccessor()
{
$c = 5; // class MyDestructableClass
$m = 2; // method dump;
$methods = self::$models[$c]->getMethods();
$this->assertEquals(
'user',
$methods[$m]->getExtensionName(),
$methods[$m]->getName()
. ' extension name does not match.'
);
}
/**
* Tests class method is a PHP4 constructor.
*
* covers Bartlett\Reflect\Model\MethodModel::isConstructor
* @group reflection
* @return void
*/
public function testPHP4Constructor()
{
$c = 3; // class Foo implements iB
$m = 0; // method Foo
$methods = self::$models[$c]->getMethods();
$this->assertTrue(
$methods[$m]->isConstructor(),
$methods[$m]->getName()
. ' is not a class constructor.'
);
}
/**
* Tests class method is a PHP5 constructor.
*
* covers Bartlett\Reflect\Model\MethodModel::isConstructor
* @group reflection
* @return void
*/
public function testPHP5Constructor()
{
$c = 5; // class MyDestructableClass
$m = 0; // method __construct
$methods = self::$models[$c]->getMethods();
$this->assertTrue(
$methods[$m]->isConstructor(),
$methods[$m]->getName()
. ' is not a class constructor.'
);
}
/**
* Tests class method is a destructor.
*
* covers Bartlett\Reflect\Model\MethodModel::isDestructor
* @group reflection
* @return void
*/
public function testDestructor()
{
$c = 5; // class MyDestructableClass
$m = 1; // method __destruct
$methods = self::$models[$c]->getMethods();
$this->assertTrue(
$methods[$m]->isDestructor(),
$methods[$m]->getName()
. ' is not a class destructor.'
);
}
/**
* Tests class method with abstract keyword.
*
* covers Bartlett\Reflect\Model\MethodModel::isAbstract
* @group reflection
* @return void
*/
public function testAbstractMethod()
{
$c = 4; // abstract class AbstractClass
$m = 1; // method abstractMethod
$methods = self::$models[$c]->getMethods();
$this->assertTrue(
$methods[$m]->isAbstract(),
$methods[$m]->getName()
. ' is not an abstract class method.'
);
}
/**
* Tests class method with final keyword.
*
* covers Bartlett\Reflect\Model\MethodModel::isFinal
* @group reflection
* @return void
*/
public function testFinalMethod()
{
$c = 3; // class Foo implements iB
$m = 2; // method baz
$methods = self::$models[$c]->getMethods();
$this->assertTrue(
$methods[$m]->isFinal(),
$methods[$m]->getName()
. ' is not a final class method.'
);
}
/**
* Tests class method with static keyword.
*
* covers Bartlett\Reflect\Model\MethodModel::isStatic
* @group reflection
* @return void
*/
public function testStaticMethod()
{
$c = 4; // abstract class AbstractClass
$m = 0; // method lambdaMethod
$methods = self::$models[$c]->getMethods();
$this->assertTrue(
$methods[$m]->isStatic(),
$methods[$m]->getName()
. ' is not a static class method.'
);
}
/**
* Tests class method with private visibility.
*
* covers Bartlett\Reflect\Model\MethodModel::isPrivate
* @group reflection
* @return void
*/
public function testPrivateMethod()
{
$c = 3; // class Foo implements iB
$m = 1; // method FooBaz
$methods = self::$models[$c]->getMethods();
$this->assertTrue(
$methods[$m]->isPrivate(),
$methods[$m]->getName()
. ' is not a private class method.'
);
}
/**
* Tests class method with protected visibility.
*
* covers Bartlett\Reflect\Model\MethodModel::isProtected
* @group reflection
* @return void
*/
public function testProtectedMethod()
{
$c = 6; // class Bar
$m = 1; // method otherfunction
$methods = self::$models[$c]->getMethods();
$this->assertTrue(
$methods[$m]->isProtected(),
$methods[$m]->getName()
. ' is not a protected class method.'
);
}
/**
* Tests class method with public visibility.
*
* covers Bartlett\Reflect\Model\MethodModel::isPublic
* @group reflection
* @return void
*/
public function testPublicMethod()
{
$c = 4; // abstract class AbstractClass
$m = 0; // method lambdaMethod
$methods = self::$models[$c]->getMethods();
$this->assertTrue(
$methods[$m]->isPublic(),
$methods[$m]->getName()
. ' is not a public class method.'
);
}
/**
* Tests class method with implicit public visibility.
*
* covers Bartlett\Reflect\Model\MethodModel::isImplicitlyPublic
* @group reflection
* @return void
*/
public function testImplicitlyPublicMethod()
{
$c = 5; // class MyDestructableClass
$m = 2; // method dump;
$methods = self::$models[$c]->getMethods();
$this->assertTrue(
$methods[$m]->isImplicitlyPublic(),
$methods[$m]->getName()
. ' is not implicitly public.'
);
}
/**
* Tests parameters of the class method.
*
* covers Bartlett\Reflect\Model\AbstractFunctionModel::getParameters
* @group reflection
* @return void
*/
public function testParametersAccessor()
{
$i = 2; // interface iB extends iA
$m = 0; // method baz
$methods = self::$models[$i]->getMethods();
$this->assertCount(
1,
$methods[$m]->getParameters(),
$methods[$m]->getName()
. ' parameters number does not match.'
);
}
/**
* Tests string representation of the MethodModel object
*
* covers Bartlett\Reflect\Model\MethodModel::__toString
* @group reflection
* @return void
*/
public function testToString()
{
$c = 6; // class Bar
$m = 0; // method myfunction
$expected = << public method myfunction ] {
@@ %filename% 65 - 66
- Parameters [2] {
Parameter #0 [ stdClass \$param = NULL ]
Parameter #1 [ \$otherparam = TRUE ]
}
}
EOS;
$this->expectOutputString(
str_replace('%filename%', self::$fixture, $expected)
);
$methods = self::$models[$c]->getMethods();
print(
$methods[$m]->__toString()
);
}
}
PK bCV$ $ ! tests/Model/FunctionModelTest.phpnu W+A
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version GIT: $Id$
* @link http://php5.laurent-laville.org/reflect/
* @since Class available since Release 2.0.0RC1
*/
namespace Bartlett\Tests\Reflect\Model;
/**
* Unit Test Case that covers Bartlett\Reflect\Model\FunctionModel
*
* @category PHP
* @package PHP_Reflect
* @subpackage Tests
* @author Laurent Laville
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: @package_version@
* @link http://php5.laurent-laville.org/reflect/
*/
class FunctionModelTest extends GenericModelTest
{
/**
* Sets up the shared fixture.
*
* @return void
*/
public static function setUpBeforeClass()
{
self::$fixture = 'namespaces.php';
parent::setUpBeforeClass();
}
/**
* Tests the Doc comment accessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getDocComment
* @group reflection
* @return void
*/
public function testDocCommentAccessor()
{
$c = 1; // class glob\Foo
$m = 0; // method myfunction
$methods = self::$models[$c]->getMethods();
$expected = '/**
* @param stdClass $param
* @param mixed $otherparam
*/';
$this->assertEquals(
$expected,
$methods[$m]->getDocComment(),
$methods[$m]->getName()
. ' doc comment does not match.'
);
}
/**
* Tests starting line number accessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getStartLine
* @group reflection
* @return void
*/
public function testStartLineAccessor()
{
$f = 3; // function glob\myprocess
$this->assertEquals(
29,
self::$models[$f]->getStartLine(),
self::$models[$f]->getName() . ' starting line does not match.'
);
}
/**
* Tests ending line number accessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getEndLine
* @group reflection
* @return void
*/
public function testEndLineAccessor()
{
$f = 3; // function glob\myprocess
$this->assertEquals(
32,
self::$models[$f]->getEndLine(),
self::$models[$f]->getName() . ' ending line does not match.'
);
}
/**
* Tests file name accessor.
*
* covers Bartlett\Reflect\Model\AbstractFunctionModel::getFileName
* @group reflection
* @return void
*/
public function testFileNameAccessor()
{
$f = 3; // function glob\myprocess
$this->assertEquals(
self::$fixtures . 'namespaces.php',
self::$models[$f]->getFileName(),
self::$models[$f]->getName() . ' file name does not match.'
);
}
/**
* Tests method name accessor.
*
* covers Bartlett\Reflect\Model\AbstractFunctionModel::getName
* @group reflection
* @return void
*/
public function testNameAccessor()
{
$f = 3; // function glob\myprocess
$this->assertEquals(
'glob\myprocess',
self::$models[$f]->getName(),
self::$models[$f]->getName() . ' function name does not match.'
);
}
/**
* Tests method extension name acessor.
*
* covers Bartlett\Reflect\Model\AbstractModel::getExtensionName
* @group reflection
* @return void
*/
public function testExtensionNameAccessor()
{
$f = 3; // function glob\myprocess
$this->assertEquals(
'user',
self::$models[$f]->getExtensionName(),
self::$models[$f]->getName() . ' extension name does not match.'
);
}
/**
* Tests the namespace name accessor.
*
* covers Bartlett\Reflect\Model\AbstractFunctionModel::getNamespaceName
* @group reflection
* @return void
*/
public function testNamespaceNameAccessor()
{
$f = 4; // function nemo\nobody
$this->assertEquals(
'nemo',
self::$models[$f]->getNamespaceName(),
self::$models[$f]->getName() . ' namespace does not match.'
);
}
/**
* Tests function short name accessor.
*
* covers Bartlett\Reflect\Model\AbstractFunctionModel::getShortName
* @group reflection
* @return void
*/
public function testShortNameAccessor()
{
$f = 2; // function glob\singleFunction
$this->assertEquals(
'singleFunction',
self::$models[$f]->getShortName(),
self::$models[$f]->getName() . ' short name does not match.'
);
}
/**
* Tests the number of parameters that a function defines.
*
* covers Bartlett\Reflect\Model\AbstractFunctionModel::getNumberOfParameters
* @group reflection
* @return void
*/
public function testNumberOfParametersAccessor()
{
$f = 2; // function glob\singleFunction
$this->assertEquals(
3,
self::$models[$f]->getNumberOfParameters(),
self::$models[$f]->getName() . ' number of parameters does not match.'
);
}
/**
* Tests the number of required parameters that a function defines.
*
* covers Bartlett\Reflect\Model\AbstractFunctionModel::getNumberOfRequiredParameters
* @group reflection
* @return void
*/
public function testNumberOfRequiredParametersAccessor()
{
$f = 2; // function glob\singleFunction
$this->assertEquals(
2,
self::$models[$f]->getNumberOfRequiredParameters(),
self::$models[$f]->getName() . ' number of required parameters does not match.'
);
}
/**
* Tests parameters of the class method.
*
* covers Bartlett\Reflect\Model\AbstractFunctionModel::getParameters
* @group reflection
* @return void
*/
public function testParametersAccessor()
{
$f = 2; // function glob\singleFunction
$this->assertCount(
3,
self::$models[$f]->getParameters(),
self::$models[$f]->getName() . ' parameters number does not match.'
);
}
/**
* Tests whether a function is defined in a namespace.
*
* covers Bartlett\Reflect\Model\AbstractFunctionModel::inNamespace
* @group reflection
* @return void
*/
public function testInNamespace()
{
$f = 2; // function glob\singleFunction
$this->assertTrue(
self::$models[$f]->inNamespace(),
self::$models[$f]->getName() . ' is defined in a namespace.'
);
}
/**
* Tests whether it's an anonymous function (closure).
*
* covers Bartlett\Reflect\Model\AbstractFunctionModel::isClosure
* @group reflection
* @return void
*/
public function testAnonymousFunction()
{
$f = 2; // function glob\singleFunction
$this->assertFalse(
self::$models[$f]->isClosure(),
self::$models[$f]->getName() . ' is not an anonymous function.'
);
}
/**
* Tests whether it's a closure in a user namespace.
*
* covers Bartlett\Reflect\Model\AbstractFunctionModel::isClosure
* @group reflection
* @return void
*/
public function testClosureInNamespace()
{
$f = 5; // closure in nemo namespace
$this->assertTrue(
self::$models[$f]->isClosure(),
self::$models[$f]->getName() . ' is a closure.'
);
}
/**
* Tests whether it's an internal function.
*
* covers Bartlett\Reflect\Model\AbstractFunctionModel::isInternal
* @group reflection
* @return void
*/
public function testInternalFunction()
{
$f = 2; // function glob\singleFunction
$this->assertFalse(
self::$models[$f]->isInternal(),
self::$models[$f]->getName() . ' is a user-defined function.'
);
}
/**
* Tests string representation of the FunctionModel object
*
* covers Bartlett\Reflect\Model\FunctionModel::__toString
* @group reflection
* @return void
*/
public function testToString()
{
$f = 2; // function glob\singleFunction
$expected = << function glob\\singleFunction ] {
@@ %filename% 25 - 27
- Parameters [3] {
Parameter #0 [ array \$someparam ]
Parameter #1 [ glob\stdClass \$somethingelse ]
Parameter #2 [ \$lastone = NULL ]
}
}
EOS;
$this->expectOutputString(
str_replace('%filename%', self::$fixture, $expected)
);
print(
self::$models[$f]->__toString()
);
}
}
PK bCVuV tests/Model/GenericModelTest.phpnu W+A
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version GIT: $Id$
* @link http://php5.laurent-laville.org/reflect/
* @since Class available since Release 3.0.0-alpha2
*/
namespace Bartlett\Tests\Reflect\Model;
use Bartlett\Reflect\Client;
/**
* Unit Test Case that covers Bartlett\Reflect\Model\*Model
*
* @category PHP
* @package PHP_Reflect
* @subpackage Tests
* @author Laurent Laville
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: @package_version@
* @link http://php5.laurent-laville.org/reflect/
*/
abstract class GenericModelTest extends \PHPUnit_Framework_TestCase
{
protected static $fixtures;
protected static $fixture;
protected static $models;
protected static $api;
/**
* Sets up the shared fixture.
*
* @return void
* @link http://phpunit.de/manual/current/en/fixtures.html#fixtures.sharing-fixture
*/
public static function setUpBeforeClass()
{
self::$fixtures = dirname(__DIR__) . DIRECTORY_SEPARATOR
. 'fixtures' . DIRECTORY_SEPARATOR;
self::$fixture = self::$fixtures . self::$fixture;
$client = new Client();
// request for a Bartlett\Reflect\Api\Analyser
self::$api = $client->api('analyser');
$dataSource = self::$fixture;
$analysers = array('reflection');
$metrics = self::$api->run($dataSource, $analysers);
self::$models = $metrics['ReflectionAnalyser'];
}
}
PK bCVQVr r tests/fixtures/classes.phpnu W+A name = "MyDestructableClass";
}
function __destruct() {
print "Destroying " . $this->name . "\n";
}
function dump() {
print "Dump content of " . $this->name . "\n";
}
}
class Bar
{
const ONE = "Number one";
const TWO = "Number two";
function myfunction ( stdClass $param = NULL, $otherparam = TRUE ) {
}
protected function otherfunction( Baz $baz, $param )
{
}
}
class IteratorClass implements Iterator {
public function __construct() { }
public function key() { }
public function current() { }
function next() { }
function valid() { }
function rewind() { }
}
class DerivedClass extends IteratorClass { }
class NotCloneable {
public $var1;
private function __clone() {
}
}
class Cloneable {
public $var1;
}
final class TestFinalClass { }
PK bCVq! tests/fixtures/constants.phpnu W+A $field = new stdClass;
}
}
}
PK bCV S &