[186] r373@phpspec (orig r186): padraic.brady | 2008-01-11 03:17:17 -0700

0 views
Skip to first unread message

nor...@domain51.com

unread,
Jan 11, 2008, 5:17:35 AM1/11/08
to phpspec...@googlegroups.com
Revision
186
Author
phpspec
Date
2008-01-11 03:17:35 -0700 (Fri, 11 Jan 2008)

Log Message

 r373@phpspec (orig r186):  padraic.brady | 2008-01-11 03:17:17 -0700
 * Applying Predicate patch from Takagi Masahiro

Modified Paths

Property Changed

Diff

Property changes:


Name: svk:merge
   - d6e91ea2-e33a-0410-98df-1d493bd67c58:/:185
   + d6e91ea2-e33a-0410-98df-1d493bd67c58:/:186

Modified: trunk/src/PHPSpec/Specification.php (185 => 186)


--- trunk/src/PHPSpec/Specification.php	2008-01-10 14:34:17 UTC (rev 185)
+++ trunk/src/PHPSpec/Specification.php	2008-01-11 10:17:35 UTC (rev 186)
@@ -132,13 +132,10 @@
         }
 
         // check for any predicate style matching
-        $result = preg_match("/^((be)|(have)|(beA)|(haveA)|(haveAn)|(beAn))*/", $method, $matches);
+        $result = preg_match("/^((?:be|have)A?n?)(.*)/", $method, $matches);
         if ($result && empty($args) && $this instanceof PHPSpec_Specification_Object) {
-            $predicate = $matches[0];
-            $predicateSuffix = substr($method, strlen($predicate));
-            if (!isset($predicateSuffix) || empty($predicateSuffix)) {
-            	$predicateSuffix = '';
-            }
+            $predicate = $matches[1];
+            $predicateSuffix = $matches[2];
 
             if (strpos($predicate, 'have') !== false) {
                 $predicateMethodPrefixes = array('has', 'hasA', 'hasAn');
@@ -369,4 +366,4 @@
         }
     }
 
-}
\ No newline at end of file
+}
Reply all
Reply to author
Forward
0 new messages