From bfecefbdee1d6ac97cdcd36dc6e33fc456d8279a Mon Sep 17 00:00:00 2001 From: CismonX Date: Fri, 23 Mar 2018 17:29:34 +0800 Subject: [PATCH] Add .travis.yml. Add tests. --- .travis.yml | 18 ++++++++++++++++++ README.md | 3 +++ config.m4 | 4 ++-- tests/000-loaded.phpt | 8 ++++++++ tests/001-init.phpt | 11 +++++++++++ 5 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 .travis.yml create mode 100644 tests/000-loaded.phpt create mode 100644 tests/001-init.phpt diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..cc4d3cf --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +sudo: required +dist: trusty +group: edge + +language: php + +php: + - 7.0 + - 7.1 + - 7.2 + - nightly + +script: + - phpize + - ./configure + - make + - make test + - sudo make install \ No newline at end of file diff --git a/README.md b/README.md index 19b5d9d..d507c37 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # ext-collections +[![Travis-CI](https://travis-ci.org/CismonX/ext-collections.svg?branch=master)](https://travis-ci.org/CismonX/ext-collections) +[![MIT license](https://img.shields.io/badge/licence-MIT-blue.svg)](https://opensource.org/licenses/MIT) + ## 1. Introduction This PHP extension provides a set of useful functional-style operations on PHP arrays, which makes array manipulation simple and scalable. diff --git a/config.m4 b/config.m4 index 9a8d656..6dabad8 100644 --- a/config.m4 +++ b/config.m4 @@ -1,8 +1,8 @@ PHP_ARG_ENABLE(collections, for collections support, [ --enable-collections Enable collections support]) -PHP_ARG_ENABLE(collections, for debug support, -[ --enable-collections-debug Compile with debug symbols]) +PHP_ARG_ENABLE(collections-debug, for debug support, +[ --enable-collections-debug Compile with debug symbols], no, no) if test "$PHP_COLLECTIONS" != "no"; then if test "$PHP_COLLECTIONS_DEBUG" != "no"; then diff --git a/tests/000-loaded.phpt b/tests/000-loaded.phpt new file mode 100644 index 0000000..9dbe333 --- /dev/null +++ b/tests/000-loaded.phpt @@ -0,0 +1,8 @@ +--TEST-- +Check whether the extension is loaded. +--FILE-- + +--EXPECT-- diff --git a/tests/001-init.phpt b/tests/001-init.phpt new file mode 100644 index 0000000..f70f543 --- /dev/null +++ b/tests/001-init.phpt @@ -0,0 +1,11 @@ +--TEST-- +Test Collection::init(). +--FILE-- + 'b']; +$collection = Collection::init($array); +$collection2 = Collection::init($collection); +if ($array != $collection2->toArray()) + echo 'Collection::init() failed.', PHP_EOL; +?> +--EXPECT--