Commit:    2cb7a678a1bbd310c8c6ca2c806013df4bf10f0d
Author:    donnut <erwin.po...@gmail.com>         Sun, 24 Jun 2012 06:30:24 
+0000
Committer: Stanislav Malyshev <s...@php.net>      Sat, 14 Jul 2012 19:21:34 
-0700
Parents:   8b70dd202a7c81795e788f43794e57a0108fb4d7
Branches:  PHP-5.4 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=2cb7a678a1bbd310c8c6ca2c806013df4bf10f0d

Log:
new tests from PHP TestFest June 2012

Changed paths:
  A  ext/spl/tests/SplFileObject_current_basic.phpt
  A  ext/spl/tests/SplFileObject_current_error001.phpt
  A  ext/spl/tests/SplFileObject_current_variation001.phpt
  A  ext/spl/tests/SplFileObject_getflags_basic.phpt
  A  ext/spl/tests/SplFileObject_getflags_error001.phpt
  A  ext/spl/tests/SplFileObject_getflags_variation001.phpt
  A  ext/spl/tests/SplFileObject_key_basic.phpt
  A  ext/spl/tests/SplFileObject_key_error001.phpt
  A  ext/spl/tests/SplFileObject_key_error002.phpt
  A  ext/spl/tests/SplFileObject_next_basic.phpt
  A  ext/spl/tests/SplFileObject_next_variation001.phpt
  A  ext/spl/tests/SplFileObject_rewind_basic.phpt
  A  ext/spl/tests/SplFileObject_rewind_error001.phpt
  A  ext/spl/tests/SplFileObject_rewind_variation001.phpt
  A  ext/spl/tests/SplFileObject_seek_basic.phpt
  A  ext/spl/tests/SplFileObject_seek_error002.phpt

diff --git a/ext/spl/tests/SplFileObject_current_basic.phpt 
b/ext/spl/tests/SplFileObject_current_basic.phpt
new file mode 100644
index 0000000..d3f4802
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_current_basic.phpt
@@ -0,0 +1,18 @@
+--TEST--
+SPL: SplFileObject::current basic
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+echo $s->current();
+
+?>
+--EXPECT--
+<?php
diff --git a/ext/spl/tests/SplFileObject_current_error001.phpt 
b/ext/spl/tests/SplFileObject_current_error001.phpt
new file mode 100644
index 0000000..23c1266
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_current_error001.phpt
@@ -0,0 +1,19 @@
+--TEST--
+SPL: SplFileObject::current variation error
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+$s->seek(2);
+
+echo $s->current('foo');
+?>
+--EXPECTF--
+Warning: SplFileObject::current() expects exactly 0 parameters, 1 given in %s 
on line %d
diff --git a/ext/spl/tests/SplFileObject_current_variation001.phpt 
b/ext/spl/tests/SplFileObject_current_variation001.phpt
new file mode 100644
index 0000000..0cc588a
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_current_variation001.phpt
@@ -0,0 +1,21 @@
+--TEST--
+SPL: SplFileObject::current variation
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+$s->seek(2);
+
+echo $s->current();
+echo $s->current();
+?>
+--EXPECT--
+//line 3
+//line 3
diff --git a/ext/spl/tests/SplFileObject_getflags_basic.phpt 
b/ext/spl/tests/SplFileObject_getflags_basic.phpt
new file mode 100644
index 0000000..5addadf
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_getflags_basic.phpt
@@ -0,0 +1,22 @@
+--TEST--
+SPL: SplFileObject::getFlags basic
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+
+file_put_contents('testdata.csv', 'eerste;tweede;derde');
+
+$fo = new SplFileObject('testdata.csv');
+
+$fo->setFlags(SplFileObject::DROP_NEW_LINE);
+var_dump($fo->getFlags());
+?>
+--CLEAN--
+<?php
+unlink('testdata.csv');
+?>
+--EXPECT--
+int(1)
diff --git a/ext/spl/tests/SplFileObject_getflags_error001.phpt 
b/ext/spl/tests/SplFileObject_getflags_error001.phpt
new file mode 100644
index 0000000..1602f88
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_getflags_error001.phpt
@@ -0,0 +1,26 @@
+--TEST--
+SPL: SplFileObject::getFlags error 001
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+
+file_put_contents('testdata.csv', 'eerste;tweede;derde');
+
+
+$fo = new SplFileObject('testdata.csv');
+$fo->setFlags(SplFileObject::READ_CSV);
+
+$fo->setFlags(SplFileObject::DROP_NEW_LINE);
+
+var_dump($fo->getFlags());
+
+?>
+--CLEAN--
+<?php
+unlink('testdata.csv');
+?>
+--EXPECT--
+int(1)
diff --git a/ext/spl/tests/SplFileObject_getflags_variation001.phpt 
b/ext/spl/tests/SplFileObject_getflags_variation001.phpt
new file mode 100644
index 0000000..30e5984
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_getflags_variation001.phpt
@@ -0,0 +1,40 @@
+--TEST--
+SPL: SplFileObject::getFlags
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+
+$aFlags = array(
+
+       'DROP_NEW_LINE',
+       'READ_AHEAD',
+       'SKIP_EMPTY',
+       'READ_CSV',
+);
+
+$fo = new SplFileObject(__FILE__);
+
+$aResult = array();
+
+
+$fo->setFlags(SplFileObject::DROP_NEW_LINE);
+var_dump($fo->getFlags());
+
+$fo->setFlags(SplFileObject::READ_AHEAD);
+var_dump($fo->getFlags());
+
+$fo->setFlags(SplFileObject::SKIP_EMPTY);
+var_dump($fo->getFlags());
+
+$fo->setFlags(SplFileObject::READ_CSV);
+var_dump($fo->getFlags());
+
+?>
+--EXPECT--
+int(1)
+int(2)
+int(4)
+int(8)
diff --git a/ext/spl/tests/SplFileObject_key_basic.phpt 
b/ext/spl/tests/SplFileObject_key_basic.phpt
new file mode 100644
index 0000000..4081d31
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_key_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+SPL: SplFileObject::key basic
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->seek(3);
+echo $s->key();
+?>
+--EXPECT--
+3
diff --git a/ext/spl/tests/SplFileObject_key_error001.phpt 
b/ext/spl/tests/SplFileObject_key_error001.phpt
new file mode 100644
index 0000000..b0834f0
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_key_error001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+SPL: SplFileObject::key error
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->seek(12);
+$s->next();
+var_dump($s->key());
+var_dump($s->valid());
+?>
+--EXPECT--
+int(13)
+bool(false)
diff --git a/ext/spl/tests/SplFileObject_key_error002.phpt 
b/ext/spl/tests/SplFileObject_key_error002.phpt
new file mode 100644
index 0000000..8fc9b7f
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_key_error002.phpt
@@ -0,0 +1,22 @@
+--TEST--
+SPL: SplFileObject::key error
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->seek(120);
+$s->next();
+var_dump($s->key());
+var_dump($s->valid());
+?>
+--EXPECT--
+int(13)
+bool(false)
diff --git a/ext/spl/tests/SplFileObject_next_basic.phpt 
b/ext/spl/tests/SplFileObject_next_basic.phpt
new file mode 100644
index 0000000..59dc7ab
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_next_basic.phpt
@@ -0,0 +1,22 @@
+--TEST--
+SPL: SplFileObject::next basic
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+echo $s->current();
+$s->next();
+
+echo $s->current();
+
+?>
+--EXPECT--
+<?php
+//line 2
diff --git a/ext/spl/tests/SplFileObject_next_variation001.phpt 
b/ext/spl/tests/SplFileObject_next_variation001.phpt
new file mode 100644
index 0000000..34771dd
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_next_variation001.phpt
@@ -0,0 +1,24 @@
+--TEST--
+SPL: SplFileObject::next variation 001
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->seek(13);
+echo $s->current();
+
+$s->next();
+echo $s->current();
+var_dump($s->valid());
+?>
+--EXPECT--
+?>
+bool(false)
diff --git a/ext/spl/tests/SplFileObject_rewind_basic.phpt 
b/ext/spl/tests/SplFileObject_rewind_basic.phpt
new file mode 100644
index 0000000..331c587
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_rewind_basic.phpt
@@ -0,0 +1,21 @@
+--TEST--
+SPL: SplFileObject::rewind basic
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->seek(3);
+
+$s->rewind();
+echo $s->current();
+?>
+--EXPECT--
+<?php
diff --git a/ext/spl/tests/SplFileObject_rewind_error001.phpt 
b/ext/spl/tests/SplFileObject_rewind_error001.phpt
new file mode 100644
index 0000000..bdb3301
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_rewind_error001.phpt
@@ -0,0 +1,18 @@
+--TEST--
+SPL: SplFileObject::rewind() with a parameter. 
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+
+file_put_contents('testdata.csv', 'eerste;tweede;derde');
+
+$fo = new SplFileObject('testdata.csv');
+
+$fo->rewind( "invalid" );
+
+?>
+--EXPECTF--
+Warning: SplFileObject::rewind() expects exactly 0 parameters, 1 given in %s 
on line %d
diff --git a/ext/spl/tests/SplFileObject_rewind_variation001.phpt 
b/ext/spl/tests/SplFileObject_rewind_variation001.phpt
new file mode 100644
index 0000000..d835c44
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_rewind_variation001.phpt
@@ -0,0 +1,28 @@
+--TEST--
+SPL: SplFileObject::rewind variation 001
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->seek(15);
+echo $s->current();
+$s->next();
+echo $s->current();
+var_dump($s->valid());
+$s->rewind();
+var_dump($s->valid());
+echo $s->current();
+?>
+--EXPECT--
+?>
+bool(false)
+bool(true)
+<?php
diff --git a/ext/spl/tests/SplFileObject_seek_basic.phpt 
b/ext/spl/tests/SplFileObject_seek_basic.phpt
new file mode 100644
index 0000000..7106f70
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_seek_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+SPL: SplFileObject::seek basic
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->seek(2);
+echo $s->current();
+?>
+--EXPECT--
+//line 3
diff --git a/ext/spl/tests/SplFileObject_seek_error002.phpt 
b/ext/spl/tests/SplFileObject_seek_error002.phpt
new file mode 100644
index 0000000..057c8d3
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_seek_error002.phpt
@@ -0,0 +1,18 @@
+--TEST--
+SPL: SplFileObject::seek error 001
+--CREDITS--
+Ricardo Oedietram <rica...@odracir.nl>
+Erwin Poeze <erwin.po...@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->seek(20);
+echo $s->current();
+?>
+--EXPECT--
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to