Add .travis.yml. Add tests.

This commit is contained in:
CismonX 2018-03-23 17:29:34 +08:00
parent 4498f7f5a9
commit bfecefbdee
5 changed files with 42 additions and 2 deletions

18
.travis.yml Normal file
View File

@ -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

View File

@ -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.

View File

@ -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

8
tests/000-loaded.phpt Normal file
View File

@ -0,0 +1,8 @@
--TEST--
Check whether the extension is loaded.
--FILE--
<?php
if (!extension_loaded('collections'))
echo "Extension not loaded.", PHP_EOL;
?>
--EXPECT--

11
tests/001-init.phpt Normal file
View File

@ -0,0 +1,11 @@
--TEST--
Test Collection::init().
--FILE--
<?php
$array = ['a' => 'b'];
$collection = Collection::init($array);
$collection2 = Collection::init($collection);
if ($array != $collection2->toArray())
echo 'Collection::init() failed.', PHP_EOL;
?>
--EXPECT--