com gtk/php-gtk: Added unittest for the crash reported earlier: test/unittests/GtkListStoreTest.php

[email protected] (David Soria Parra)
Newsgroups php.gtk.cvs
Message-ID <[email protected]>
Commit:    049cf4a53d3973aedd59b4442599112df1a884aa
Author:    Christian Weiske <[email protected]>         Mon, 22 May 2006 20:13:46 +0000
Parents:   5c4954a96d720b44aee39108aad972568b729018
Branches:  master

Link:       http://git.php.net/?p=gtk/php-gtk.git;a=commitdiff;h=049cf4a53d3973aedd59b4442599112df1a884aa

Log:
Added unittest for the crash reported earlier

Changed paths:
  M  test/unittests/GtkListStoreTest.php


Diff:
049cf4a53d3973aedd59b4442599112df1a884aa
diff --git a/test/unittests/GtkListStoreTest.php b/test/unittests/GtkListStoreTest.php
index 987a341..41a444d 100644
--- a/test/unittests/GtkListStoreTest.php
+++ b/test/unittests/GtkListStoreTest.php
@@ -37,6 +37,7 @@ class GtkListStoreTest extends PHPUnit2_Framework_TestCase {
      * @access protected
      */
     protected function setUp() {
+        $this->ls = new GtkListStore(Gtk::TYPE_STRING);
     }
 
     /**
@@ -153,11 +154,16 @@ class GtkListStoreTest extends PHPUnit2_Framework_TestCase {
     }
 
     /**
-     * @todo Implement testForeach().
+     * foreach() lets you specify a callback that is called for
+     * every row
      */
     public function testForeach() {
-        // Remove the following line when you implement this test.
-        throw new PHPUnit2_Framework_IncompleteTestError;
+        $this->ls->append(array('test'));
+        $this->ls->foreach(array($this, 'foreachCallback'));
+    }
+
+    public function foreachCallback($ls, $path, $iter) {
+        $ls->remove($iter);
     }
 
     /**
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.