chore(ci): test against PHP 7.4
* Updated to test again PHP 7.4 and to use that for coverage reporting. * Added PHP nightly builds as an allowable failure. * Added a git ignore as well as a `phpunit` configuration. * Updated the tests and CI configuration to better handle the juggling of PHP and `phpunit` versions. * Updated the coveralls dependency to be the latest and greatest instead of the deprecated package. * Tweaked the README, updated the LICENSE years and bumped this package's version. * Dropped Patreon link in favor of using Github Sponsors.
This commit is contained in:
parent
e41f4f7630
commit
cdb2e05cf4
9 changed files with 106 additions and 70 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
composer.lock
|
||||||
|
composer.phar
|
||||||
|
.phpunit.result.cache
|
||||||
|
/vendor/
|
22
.travis.yml
22
.travis.yml
|
@ -14,27 +14,27 @@ matrix:
|
||||||
dist: trusty
|
dist: trusty
|
||||||
- php: 7.0
|
- php: 7.0
|
||||||
dist: xenial
|
dist: xenial
|
||||||
env: PHPUNIT=5.7
|
|
||||||
- php: 7.1
|
- php: 7.1
|
||||||
- php: 7.2
|
- php: 7.2
|
||||||
- php: 7.3
|
- php: 7.3
|
||||||
|
- php: 7.4
|
||||||
|
env: COVERAGE=true
|
||||||
|
- php: nightly
|
||||||
|
allow_failures:
|
||||||
|
- php: nightly
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
- php --version
|
||||||
- composer install
|
- composer install
|
||||||
- if [[ $PHPUNIT == 5.7 ]]; then composer require "phpunit/phpunit:5.7"; fi
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- mkdir -p build/logs
|
- mkdir -p build/logs
|
||||||
- cd tests
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- |
|
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml
|
||||||
if [[ $PHPUNIT == 5.7 ]]; then
|
|
||||||
../vendor/bin/phpunit --colors --coverage-clover ../build/logs/clover.xml .
|
|
||||||
else
|
|
||||||
phpunit --colors --coverage-clover ../build/logs/clover.xml .
|
|
||||||
fi
|
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- cd ..
|
- |
|
||||||
- php vendor/bin/coveralls --config .coveralls.yml -v
|
if [[ $COVERAGE ]]; then
|
||||||
|
travis_retry php vendor/bin/php-coveralls --config .coveralls.yml -v
|
||||||
|
fi
|
||||||
|
|
1
FUNDING.yml
Normal file
1
FUNDING.yml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
patreon: joshtronic
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019 Josh Sherman
|
Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019, 2020 Josh Sherman
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
12
README.md
12
README.md
|
@ -1,13 +1,13 @@
|
||||||
# php-loremipsum
|
# php-loremipsum
|
||||||
|
|
||||||
[](https://travis-ci.org/joshtronic/php-loremipsum)
|
[](https://github.com/joshtronic/php-loremipsum/blob/master/LICENSE)
|
||||||
[](https://coveralls.io/github/joshtronic/php-loremipsum?branch=master)
|

|
||||||
[](https://packagist.org/packages/joshtronic/php-loremipsum)
|
[](https://travis-ci.org/joshtronic/php-loremipsum)
|
||||||
|
[](https://coveralls.io/github/joshtronic/php-loremipsum?branch=master)
|
||||||
|
[](https://packagist.org/packages/joshtronic/php-loremipsum)
|
||||||
|
|
||||||
Lorem ipsum generator in PHP without dependencies. Compatible with PHP 5.3+.
|
Lorem ipsum generator in PHP without dependencies. Compatible with PHP 5.3+.
|
||||||
|
|
||||||
[](https://www.patreon.com/joshtronic)
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
The preferred installation method is via `composer`. First add the following to
|
The preferred installation method is via `composer`. First add the following to
|
||||||
|
@ -105,7 +105,7 @@ Suggestions and bug reports are always welcome, but karma points are earned for
|
||||||
pull requests.
|
pull requests.
|
||||||
|
|
||||||
Unit tests are required for all contributions. You can run the test suite from
|
Unit tests are required for all contributions. You can run the test suite from
|
||||||
the `tests` directory simply by running `phpunit .`
|
the project's root directory simply by running `phpunit`.
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "joshtronic/php-loremipsum",
|
"name": "joshtronic/php-loremipsum",
|
||||||
"description": "Lorem ipsum generator in PHP without dependencies",
|
"description": "Lorem ipsum generator in PHP without dependencies",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"lorem",
|
"lorem",
|
||||||
|
@ -10,18 +10,17 @@
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/joshtronic/php-loremipsum",
|
"homepage": "https://github.com/joshtronic/php-loremipsum",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"authors": [
|
"authors": [{
|
||||||
{
|
|
||||||
"name": "Josh Sherman",
|
"name": "Josh Sherman",
|
||||||
"email": "hello@joshtronic.com",
|
"email": "hello@joshtronic.com",
|
||||||
"homepage": "https://joshtronic.com"
|
"homepage": "https://joshtronic.com"
|
||||||
}
|
}],
|
||||||
],
|
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.0"
|
"php": ">=5.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"satooshi/php-coveralls": "~1.0"
|
"php-coveralls/php-coveralls": ">=1",
|
||||||
|
"phpunit/phpunit": ">=4"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|
23
phpunit.xml
Normal file
23
phpunit.xml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit
|
||||||
|
colors="true"
|
||||||
|
convertErrorsToExceptions="true"
|
||||||
|
convertNoticesToExceptions="true"
|
||||||
|
convertWarningsToExceptions="true"
|
||||||
|
failOnRisky="true"
|
||||||
|
stopOnError="true"
|
||||||
|
stopOnFailure="true"
|
||||||
|
stopOnIncomplete="true"
|
||||||
|
verbose="true"
|
||||||
|
>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Lorem Ipsum">
|
||||||
|
<directory>tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<filter>
|
||||||
|
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||||
|
<directory>./src</directory>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
|
</phpunit>
|
|
@ -9,7 +9,7 @@
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Josh Sherman <hello@joshtronic.com>
|
* @author Josh Sherman <hello@joshtronic.com>
|
||||||
* @copyright Copyright 2014, 2015, 2016, 2017, 2018, 2019 Josh Sherman
|
* @copyright Copyright 2014, 2015, 2016, 2017, 2018, 2019, 2020 Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @link https://github.com/joshtronic/php-loremipsum
|
* @link https://github.com/joshtronic/php-loremipsum
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
require_once './src/LoremIpsum.php';
|
||||||
require_once '../src/LoremIpsum.php';
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!class_exists('\PHPUnit_Framework_TestCase')
|
!class_exists('\PHPUnit_Framework_TestCase')
|
||||||
|
@ -11,29 +10,25 @@ if (
|
||||||
|
|
||||||
class LoremIpsumTest extends PHPUnit_Framework_TestCase
|
class LoremIpsumTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
private $lipsum;
|
|
||||||
|
|
||||||
public function setUp()
|
|
||||||
{
|
|
||||||
$this->lipsum = new joshtronic\LoremIpsum();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testWord()
|
public function testWord()
|
||||||
{
|
{
|
||||||
$this->assertRegExp('/^[a-z]+$/i', $this->lipsum->word());
|
$lipsum = new joshtronic\LoremIpsum();
|
||||||
|
$this->assertRegExp('/^[a-z]+$/i', $lipsum->word());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWords()
|
public function testWords()
|
||||||
{
|
{
|
||||||
|
$lipsum = new joshtronic\LoremIpsum();
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
'/^[a-z]+ [a-z]+ [a-z]+$/i',
|
'/^[a-z]+ [a-z]+ [a-z]+$/i',
|
||||||
$this->lipsum->words(3)
|
$lipsum->words(3)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWordsArray()
|
public function testWordsArray()
|
||||||
{
|
{
|
||||||
$words = $this->lipsum->wordsArray(3);
|
$lipsum = new joshtronic\LoremIpsum();
|
||||||
|
$words = $lipsum->wordsArray(3);
|
||||||
$this->assertTrue(is_array($words));
|
$this->assertTrue(is_array($words));
|
||||||
$this->assertCount(3, $words);
|
$this->assertCount(3, $words);
|
||||||
|
|
||||||
|
@ -44,22 +39,29 @@ class LoremIpsumTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testWordsExceedingVocab()
|
public function testWordsExceedingVocab()
|
||||||
{
|
{
|
||||||
$this->assertCount(500, $this->lipsum->wordsArray(500));
|
$lipsum = new joshtronic\LoremIpsum();
|
||||||
|
$this->assertCount(500, $lipsum->wordsArray(500));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSentence()
|
public function testSentence()
|
||||||
{
|
{
|
||||||
$this->assertRegExp('/^[a-z, ]+\.$/i', $this->lipsum->sentence());
|
$lipsum = new joshtronic\LoremIpsum();
|
||||||
|
$this->assertRegExp('/^[a-z, ]+\.$/i', $lipsum->sentence());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSentences()
|
public function testSentences()
|
||||||
{
|
{
|
||||||
$this->assertRegExp('/^[a-z, ]+\. [a-z, ]+\. [a-z, ]+\.$/i', $this->lipsum->sentences(3));
|
$lipsum = new joshtronic\LoremIpsum();
|
||||||
|
$this->assertRegExp(
|
||||||
|
'/^[a-z, ]+\. [a-z, ]+\. [a-z, ]+\.$/i',
|
||||||
|
$lipsum->sentences(3)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSentencesArray()
|
public function testSentencesArray()
|
||||||
{
|
{
|
||||||
$sentences = $this->lipsum->sentencesArray(3);
|
$lipsum = new joshtronic\LoremIpsum();
|
||||||
|
$sentences = $lipsum->sentencesArray(3);
|
||||||
$this->assertTrue(is_array($sentences));
|
$this->assertTrue(is_array($sentences));
|
||||||
$this->assertCount(3, $sentences);
|
$this->assertCount(3, $sentences);
|
||||||
|
|
||||||
|
@ -70,20 +72,23 @@ class LoremIpsumTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testParagraph()
|
public function testParagraph()
|
||||||
{
|
{
|
||||||
$this->assertRegExp('/^([a-z, ]+\.)+$/i', $this->lipsum->paragraph());
|
$lipsum = new joshtronic\LoremIpsum();
|
||||||
|
$this->assertRegExp('/^([a-z, ]+\.)+$/i', $lipsum->paragraph());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testParagraphs()
|
public function testParagraphs()
|
||||||
{
|
{
|
||||||
|
$lipsum = new joshtronic\LoremIpsum();
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
'/^([a-z, ]+\.)+\n\n([a-z, ]+\.)+\n\n([a-z, ]+\.)+$/i',
|
'/^([a-z, ]+\.)+\n\n([a-z, ]+\.)+\n\n([a-z, ]+\.)+$/i',
|
||||||
$this->lipsum->paragraphs(3)
|
$lipsum->paragraphs(3)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testParagraphsArray()
|
public function testParagraphsArray()
|
||||||
{
|
{
|
||||||
$paragraphs = $this->lipsum->paragraphsArray(3);
|
$lipsum = new joshtronic\LoremIpsum();
|
||||||
|
$paragraphs = $lipsum->paragraphsArray(3);
|
||||||
$this->assertTrue(is_array($paragraphs));
|
$this->assertTrue(is_array($paragraphs));
|
||||||
$this->assertCount(3, $paragraphs);
|
$this->assertCount(3, $paragraphs);
|
||||||
|
|
||||||
|
@ -94,31 +99,35 @@ class LoremIpsumTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testMarkupString()
|
public function testMarkupString()
|
||||||
{
|
{
|
||||||
|
$lipsum = new joshtronic\LoremIpsum();
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
'/^<li>[a-z]+<\/li>$/i',
|
'/^<li>[a-z]+<\/li>$/i',
|
||||||
$this->lipsum->word('li')
|
$lipsum->word('li')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMarkupArray()
|
public function testMarkupArray()
|
||||||
{
|
{
|
||||||
|
$lipsum = new joshtronic\LoremIpsum();
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
'/^<div><p>[a-z]+<\/p><\/div>$/i',
|
'/^<div><p>[a-z]+<\/p><\/div>$/i',
|
||||||
$this->lipsum->word(array('div', 'p'))
|
$lipsum->word(array('div', 'p'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMarkupBackReference()
|
public function testMarkupBackReference()
|
||||||
{
|
{
|
||||||
|
$lipsum = new joshtronic\LoremIpsum();
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
'/^<li><a href="[a-z]+">[a-z]+<\/a><\/li>$/i',
|
'/^<li><a href="[a-z]+">[a-z]+<\/a><\/li>$/i',
|
||||||
$this->lipsum->word('<li><a href="$1">$1</a></li>')
|
$lipsum->word('<li><a href="$1">$1</a></li>')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMarkupArrayReturn()
|
public function testMarkupArrayReturn()
|
||||||
{
|
{
|
||||||
$words = $this->lipsum->wordsArray(3, 'li');
|
$lipsum = new joshtronic\LoremIpsum();
|
||||||
|
$words = $lipsum->wordsArray(3, 'li');
|
||||||
$this->assertTrue(is_array($words));
|
$this->assertTrue(is_array($words));
|
||||||
$this->assertCount(3, $words);
|
$this->assertCount(3, $words);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue