Skip to content

Commit 0315b45

Browse files
committed
Initial commit
0 parents  commit 0315b45

File tree

8 files changed

+541
-0
lines changed

8 files changed

+541
-0
lines changed

.circleci/config.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
version: 2
2+
3+
workflows:
4+
version: 2
5+
build:
6+
jobs:
7+
- build_lowest
8+
- build_highest
9+
10+
defaults: &defaults
11+
docker:
12+
- image: previousnext/php-apache:7.2-3.x-dev
13+
working_directory: /data
14+
steps:
15+
- checkout
16+
- restore_cache:
17+
keys:
18+
- deps-{{ arch }}
19+
- run:
20+
name: "Install Dependencies"
21+
command: composer update --prefer-dist --no-progress --no-suggest --no-interaction ${PREFER_LOWEST}
22+
- save_cache:
23+
key: deps-{{ arch }}
24+
paths:
25+
- vendor
26+
- run:
27+
name: "Lint"
28+
command: ./bin/phpcs
29+
- run:
30+
name: "Test"
31+
command: |
32+
mkdir -p ~/phpunit
33+
./bin/phpunit --testsuite unit --log-junit ~/phpunit/phpunit.xml
34+
- store_test_results:
35+
path: ~/phpunit
36+
- store_artifacts:
37+
path: ~/phpunit
38+
39+
jobs:
40+
build_lowest:
41+
<<: *defaults
42+
docker:
43+
- image: previousnext/php-apache:7.1-3.x-dev
44+
45+
environment:
46+
- PREFER_LOWEST: --prefer-lowest
47+
build_highest:
48+
<<: *defaults
49+
environment:
50+
- PREFER_LOWEST: ''

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/bin
2+
/vendor
3+
/composer.lock

LICENSE.txt

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# PHP Prometheus
2+
3+
A PHP library for serializing to the prometheus text format.
4+
5+
[![CircleCI](https://circleci.com/gh/previousnext/php-prometheus.svg?style=svg)](https://circleci.com/gh/previousnext/prometheus)
6+
7+
8+
## Installation
9+
10+
```
11+
composer require previousnext/php-prometheus
12+
```
13+
14+
## Usage
15+
16+
TBD
17+
18+
## Developing
19+
20+
PHP CodeSniffer
21+
```
22+
./bin/phpcs
23+
```
24+
25+
PHPUnit
26+
27+
```
28+
./bin/phpunit
29+
```

composer.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "previousnext/pnx-prometheus",
3+
"description": "A PHP library for serializing to the prometheus text format.",
4+
"license": "GPL-2.0-or-later",
5+
"authors": [
6+
{
7+
"name": "Kim Pepper",
8+
"email": "kim@previousnext.com.au"
9+
}
10+
],
11+
"require": {
12+
"php": "^7.1",
13+
"psr/log": "~1.0",
14+
"symfony/serializer": "~3.4"
15+
},
16+
"require-dev": {
17+
"drupal/coder": ">=8.2.12",
18+
"phpunit/phpunit": "~6.5",
19+
"symfony/phpunit-bridge": "~3.4"
20+
},
21+
"autoload": {
22+
"psr-4": {"PNX\\Prometheus\\": "src/"}
23+
},
24+
"autoload-dev": {
25+
"psr-4": {"PNX\\Prometheus\\Tests\\": "tests/"}
26+
},
27+
"config": {
28+
"bin-dir": "bin/",
29+
"preferred-install": {
30+
"*": "dist"
31+
},
32+
"sort-packages": true
33+
}
34+
}

phpcs.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ruleset name="php-prometheus">
3+
<description>PHP CodeSniffer configuration for PHP Prometheus</description>
4+
<!-- folders to scan -->
5+
<file>./src</file>
6+
<file>./tests</file>
7+
<!-- extensions to scan -->
8+
<arg name="extensions" value="php"/>
9+
<!-- additional arguments -->
10+
<arg name="report" value="full"/>
11+
<!-- inherit from coder -->
12+
<rule ref="./vendor/drupal/coder/coder_sniffer/Drupal"/>
13+
<!-- Additional detailed sniff configuration -->
14+
<!-- You can determine sniff names by running with -s flag -->
15+
<!-- Example 1 - ignore Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
16+
<rule ref="Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps">
17+
<severity>0</severity>
18+
</rule>
19+
// End example 1 -->
20+
<!-- Example 2 - ignore rule for specific files
21+
<rule ref="Drupal.NamingConventions.ValidVariableName.LowerCamelName">
22+
<exclude-pattern>OfferNormalizerTrait.php</exclude-pattern>
23+
<exclude-pattern>TimeOfUseValidationTrait.php</exclude-pattern>
24+
</rule>
25+
// End example 2 -->
26+
</ruleset>

phpunit.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!-- TODO set checkForUnintentionallyCoveredCode="true" once https://www.drupal.org/node/2626832 is resolved. -->
4+
<!-- PHPUnit expects functional tests to be run with either a privileged user
5+
or your current system user. See core/tests/README.md and
6+
https://www.drupal.org/node/2116263 for details.
7+
-->
8+
<phpunit bootstrap="tests/bootstrap.php" colors="true"
9+
beStrictAboutTestsThatDoNotTestAnything="true"
10+
beStrictAboutOutputDuringTests="true"
11+
beStrictAboutChangesToGlobalState="true"
12+
checkForUnintentionallyCoveredCode="false">
13+
<php>
14+
<!-- Set error reporting to E_ALL. -->
15+
<ini name="error_reporting" value="32767"/>
16+
<!-- Do not limit the amount of memory tests take to run. -->
17+
<ini name="memory_limit" value="-1"/>
18+
<const name="BOOTSTRAP_IS_PHPUNIT" value="true"/>
19+
</php>
20+
<testsuites>
21+
<testsuite name="unit">
22+
<directory>./tests/Unit</directory>
23+
</testsuite>
24+
<testsuite name="functional">
25+
<directory>./tests/Functional</directory>
26+
</testsuite>
27+
</testsuites>
28+
<listeners>
29+
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener">
30+
</listener>
31+
</listeners>
32+
<!-- Filter for coverage reports. -->
33+
<filter>
34+
<whitelist>
35+
<directory>./src</directory>
36+
<!-- By definition test classes have no tests. -->
37+
<exclude>
38+
<directory suffix="Test.php">./</directory>
39+
<directory suffix="TestBase.php">./</directory>
40+
</exclude>
41+
</whitelist>
42+
</filter>
43+
</phpunit>

tests/bootstrap.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Boostrap for PHPUnit.
6+
*/
7+
8+
assert_options(ASSERT_ACTIVE, FALSE);
9+
10+
$autoloader = __DIR__ . '/../vendor/autoload.php';
11+
$loader = require $autoloader;
12+
13+
if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
14+
define('PHPUNIT_COMPOSER_INSTALL', $autoloader);
15+
}
16+
17+
date_default_timezone_set('Australia/Sydney');

0 commit comments

Comments
 (0)