diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-18 23:35:35 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-18 23:35:35 +0100 |
commit | 778561e1739a4a7ef20e85b713b4790e6be225d3 (patch) | |
tree | d1ff42f6b6f8d6aa68f88319506aba91394aded0 /tests/php/phpt | |
parent | bfaed88493de0a3ebd7f2619cb11291cd09252b1 (diff) | |
parent | da5521c2c168edc48e7d2b5dd12305c9dec85b7b (diff) |
Merge pull request #44 from valmat/unit-test
Unit tests
Diffstat (limited to 'tests/php/phpt')
-rw-r--r-- | tests/php/phpt/.gitignore | 6 | ||||
-rw-r--r-- | tests/php/phpt/base/001.phpt | 14 | ||||
-rw-r--r-- | tests/php/phpt/base/002.phpt | 14 | ||||
-rw-r--r-- | tests/php/phpt/base/readme | 1 | ||||
-rw-r--r-- | tests/php/phpt/valueiterator/001.phpt | 22 | ||||
-rw-r--r-- | tests/php/phpt/valueiterator/002.phpt | 22 | ||||
-rw-r--r-- | tests/php/phpt/valueiterator/003.phpt | 18 | ||||
-rw-r--r-- | tests/php/phpt/valueiterator/004.phpt | 20 | ||||
-rw-r--r-- | tests/php/phpt/valueiterator/005.phpt | 19 | ||||
-rw-r--r-- | tests/php/phpt/valueiterator/006.phpt | 21 | ||||
-rw-r--r-- | tests/php/phpt/valueiterator/readme | 1 |
11 files changed, 158 insertions, 0 deletions
diff --git a/tests/php/phpt/.gitignore b/tests/php/phpt/.gitignore new file mode 100644 index 0000000..08989fa --- /dev/null +++ b/tests/php/phpt/.gitignore @@ -0,0 +1,6 @@ +*.diff +*.exp +*.log +*.out +*.php +*.sh diff --git a/tests/php/phpt/base/001.phpt b/tests/php/phpt/base/001.phpt new file mode 100644 index 0000000..91175d7 --- /dev/null +++ b/tests/php/phpt/base/001.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test constructor & destructor +--SKIPIF-- +<?php if (!extension_loaded("extention_for_tests")) print "skip"; ?> +--FILEEOF-- +<?php + +new TestBaseClass\MyClass(); + + +echo PHP_EOL; +--EXPECT-- +MyCustomClass::MyCustomClass() +MyCustomClass::~MyCustomClass
\ No newline at end of file diff --git a/tests/php/phpt/base/002.phpt b/tests/php/phpt/base/002.phpt new file mode 100644 index 0000000..a6f611b --- /dev/null +++ b/tests/php/phpt/base/002.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test constructor & destructor +--SKIPIF-- +<?php if (!extension_loaded("extention_for_tests")) print "skip"; ?> +--FILEEOF-- +<?php + +echo count(new TestBaseClass\MyClass($x)); + +echo PHP_EOL; +--EXPECT-- +MyCustomClass::MyCustomClass() +MyCustomClass::~MyCustomClass +33
\ No newline at end of file diff --git a/tests/php/phpt/base/readme b/tests/php/phpt/base/readme new file mode 100644 index 0000000..6c89a94 --- /dev/null +++ b/tests/php/phpt/base/readme @@ -0,0 +1 @@ +tests iterator diff --git a/tests/php/phpt/valueiterator/001.phpt b/tests/php/phpt/valueiterator/001.phpt new file mode 100644 index 0000000..ae85e23 --- /dev/null +++ b/tests/php/phpt/valueiterator/001.phpt @@ -0,0 +1,22 @@ +--TEST-- +Iterate array +--DESCRIPTION-- +Iterate regular php array +--SKIPIF-- +<?php if (!extension_loaded("extention_for_tests")) print "skip"; ?> +--FILEEOF-- +<?php +require dirname(__FILE__) . '/../../include/valueiterator/1.php'; + +$arr = array('qwe' => 'qweqweqweqw',5,'asd' => '«£¥§©®°±¶⅐⅒⅓⅘⅞Ⅻↆ❄❅❆⚑⚐⌛⌚〰»', 'zxccvx' => 'sdfsecvyh6bug6yfty',); + +TestValueIterator\loopValue($arr); + +echo PHP_EOL; +--EXPECT-- +Array/Object contains 4 items +[qwe]=qweqweqweqw +[0]=5 +[asd]=«£¥§©®°±¶⅐⅒⅓⅘⅞Ⅻↆ❄❅❆⚑⚐⌛⌚〰» +[zxccvx]=sdfsecvyh6bug6yfty + diff --git a/tests/php/phpt/valueiterator/002.phpt b/tests/php/phpt/valueiterator/002.phpt new file mode 100644 index 0000000..59d5dad --- /dev/null +++ b/tests/php/phpt/valueiterator/002.phpt @@ -0,0 +1,22 @@ +--TEST-- +Iterate object of stdClass +--DESCRIPTION-- +Iterate object of stdClass +--SKIPIF-- +<?php if (!extension_loaded("extention_for_tests")) print "skip"; ?> +--FILEEOF-- +<?php +require dirname(__FILE__) . '/../../include/valueiterator/1.php'; + +$arr = array('qwe' => 'qweqweqweqw',5,'asd' => '«£¥§©®°±¶⅐⅒⅓⅘⅞Ⅻↆ❄❅❆⚑⚐⌛⌚〰»', 'zxccvx' => 'sdfsecvyh6bug6yfty',); +$obj = (object)$arr; + +TestValueIterator\loopValue($obj); + +echo PHP_EOL; +--EXPECT-- +Array/Object contains 0 items +[qwe]=qweqweqweqw +[0]=5 +[asd]=«£¥§©®°±¶⅐⅒⅓⅘⅞Ⅻↆ❄❅❆⚑⚐⌛⌚〰» +[zxccvx]=sdfsecvyh6bug6yfty
\ No newline at end of file diff --git a/tests/php/phpt/valueiterator/003.phpt b/tests/php/phpt/valueiterator/003.phpt new file mode 100644 index 0000000..4155a2d --- /dev/null +++ b/tests/php/phpt/valueiterator/003.phpt @@ -0,0 +1,18 @@ +--TEST-- +Iterate object +--DESCRIPTION-- +Iterate regular php object +--SKIPIF-- +<?php if (!extension_loaded("extention_for_tests")) print "skip"; ?> +--FILEEOF-- +<?php +require dirname(__FILE__) . '/../../include/valueiterator/1.php'; + +$smpl = new SimpleClass; + +TestValueIterator\loopValue($smpl); + +--EXPECT-- +Array/Object contains 0 items +[cl0_float]=3.14 +[cl0_str1]=public str1
\ No newline at end of file diff --git a/tests/php/phpt/valueiterator/004.phpt b/tests/php/phpt/valueiterator/004.phpt new file mode 100644 index 0000000..3e6afb7 --- /dev/null +++ b/tests/php/phpt/valueiterator/004.phpt @@ -0,0 +1,20 @@ +--TEST-- +Iterate itarable oblect +--DESCRIPTION-- +class impIterator implements Iterator +--SKIPIF-- +<?php if (!extension_loaded("extention_for_tests")) print "skip"; ?> +--FILEEOF-- +<?php +require dirname(__FILE__) . '/../../include/valueiterator/1.php'; + +$it = new impIterator; + +TestValueIterator\loopValue($it); + +--EXPECT-- +Array/Object contains 0 items +[key_0]=firstElement +[key_1]=secondElement +[key_2]=lastelEment +~impIterator
\ No newline at end of file diff --git a/tests/php/phpt/valueiterator/005.phpt b/tests/php/phpt/valueiterator/005.phpt new file mode 100644 index 0000000..e5df91e --- /dev/null +++ b/tests/php/phpt/valueiterator/005.phpt @@ -0,0 +1,19 @@ +--TEST-- +Iterate itarable oblect +--DESCRIPTION-- +class impIterAggr1 implements IteratorAggregate +--SKIPIF-- +<?php if (!extension_loaded("extention_for_tests")) print "skip"; ?> +--FILEEOF-- +<?php +require dirname(__FILE__) . '/../../include/valueiterator/1.php'; + +$iag1 = new impIterAggr1; + +TestValueIterator\loopValue($iag1); + +--EXPECT-- +Array/Object contains 0 items +[cl0_float]=3.14 +[cl0_str1]=public str1 +~impIterAggr1
\ No newline at end of file diff --git a/tests/php/phpt/valueiterator/006.phpt b/tests/php/phpt/valueiterator/006.phpt new file mode 100644 index 0000000..d31cdda --- /dev/null +++ b/tests/php/phpt/valueiterator/006.phpt @@ -0,0 +1,21 @@ +--TEST-- +Iterate itarable oblect +--DESCRIPTION-- +class impIterAggr1 implements IteratorAggregate +--SKIPIF-- +<?php if (!extension_loaded("extention_for_tests")) print "skip"; ?> +--FILEEOF-- +<?php +require dirname(__FILE__) . '/../../include/valueiterator/1.php'; + +$iag2 = new impIterAggr2; + +TestValueIterator\loopValue($iag2); + +--EXPECT-- +Array/Object contains 0 items +[key_0]=firstElement +[key_1]=secondElement +[key_2]=lastelEment +~impIterAggr2 +~impIterator
\ No newline at end of file diff --git a/tests/php/phpt/valueiterator/readme b/tests/php/phpt/valueiterator/readme new file mode 100644 index 0000000..0156308 --- /dev/null +++ b/tests/php/phpt/valueiterator/readme @@ -0,0 +1 @@ +Tests of basic capabilities |