diff --git a/.gitignore b/.gitignore index 477de25..1b85d46 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,13 @@ -.settings -.buildpath -.project -*bak* -*draft* -*phprbac.sqlite3* -*Doxygen* -*phpdoc* -index.php \ No newline at end of file +.settings +.buildpath +.project +*bak* +*draft* +*phprbac.sqlite3* +*Doxygen* +*phpdoc* +/nbproject/ +/vendor/ +/build +phpunit.xml +composer.lock diff --git a/PhpRbac/autoload.php b/PhpRbac/autoload.php deleted file mode 100644 index c668107..0000000 --- a/PhpRbac/autoload.php +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - PHP-RBAC Installation - - - - - - - -
-
- -
- - - - - -

PHP-RBAC Quick Install

- -

Database information

- - - -

- All Fields Are Required -

- - - -

- Passwords Do Not Match -

- - - -
- -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- -
- -
- -
- - - - - - - - reset(true);' - $rbac->reset(true); - - // Send to Success Message - header('Location: install.php?success=1'); - exit; - - ?> - - - -

Installation Successful!

- -

Congratulations: You are now ready to use PHP-RBAC!

- -

- Warning - Please remove 'install.php' for security reasons! -

- - - -
- -
- -
- - - \ No newline at end of file diff --git a/PhpRbac/src/PhpRbac/Rbac.php b/PhpRbac/src/PhpRbac/Rbac.php deleted file mode 100644 index 0002cf2..0000000 --- a/PhpRbac/src/PhpRbac/Rbac.php +++ /dev/null @@ -1,57 +0,0 @@ -Permissions = Jf::$Rbac->Permissions; - $this->Roles = Jf::$Rbac->Roles; - $this->Users = Jf::$Rbac->Users; - } - - public function assign($role, $permission) - { - return Jf::$Rbac->assign($role, $permission); - } - - public function check($permission, $user_id) - { - return Jf::$Rbac->check($permission, $user_id); - } - - public function enforce($permission, $user_id) - { - return Jf::$Rbac->enforce($permission, $user_id); - } - - public function reset($ensure = false) - { - return Jf::$Rbac->reset($ensure); - } - - public function tablePrefix() - { - return Jf::$Rbac->tablePrefix(); - } -} - -/** @} */ // End group phprbac */ diff --git a/PhpRbac/src/PhpRbac/core/README.md b/PhpRbac/src/PhpRbac/core/README.md deleted file mode 100644 index cccde8a..0000000 --- a/PhpRbac/src/PhpRbac/core/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This directory contains the core components of PHP-RBAC. The v2.x Public PSR Compliant API wraps around these core components to do it's magic. - -The contents of this directory will be updated in the future to meet modern 'OOP Best Practices' while complying with PSR recommendations. \ No newline at end of file diff --git a/PhpRbac/src/PhpRbac/core/lib/Jf.php b/PhpRbac/src/PhpRbac/core/lib/Jf.php deleted file mode 100644 index a769ea8..0000000 --- a/PhpRbac/src/PhpRbac/core/lib/Jf.php +++ /dev/null @@ -1,207 +0,0 @@ -=1 to check for insert - * - * @param string $Query - * @throws Exception - * @return array|integer|null - */ - static function sql($Query) - { - $args = func_get_args (); - if (get_class ( self::$Db ) == "PDO") - return call_user_func_array ( "self::sqlPdo", $args ); - else - if (get_class ( self::$Db ) == "mysqli") - return call_user_func_array ( "self::sqlMysqli", $args ); - else - throw new Exception ( "Unknown database interface type." ); - } - - static function sqlPdo($Query) - { - $debug_backtrace = debug_backtrace(); - - if((isset($debug_backtrace[3])) && ($debug_backtrace[3]['function'] == 'pathId')) { - if (!self::$groupConcatLimitChanged) { - $success = self::$Db->query ("SET SESSION group_concat_max_len = 1000000"); - - if ($success) { - self::$groupConcatLimitChanged = true; - } - } - } - - $args = func_get_args (); - - if (count ( $args ) == 1) - { - $result = self::$Db->query ( $Query ); - if ($result===false) - return null; - $res=$result->fetchAll ( PDO::FETCH_ASSOC ); - if ($res===array()) - return null; - return $res; - } - else - { - if (! $stmt = self::$Db->prepare ( $Query )) - { - return false; - } - array_shift ( $args ); // remove $Query from args - $i = 0; - foreach ( $args as &$v ) - $stmt->bindValue ( ++ $i, $v ); - - $success=$stmt->execute (); - - $type = substr ( trim ( strtoupper ( $Query ) ), 0, 6 ); - if ($type == "INSERT") - { - if (!$success) - return null; - $res = self::$Db->lastInsertId (); - if ($res == 0) - return $stmt->rowCount (); - return $res; - } - elseif ($type == "DELETE" or $type == "UPDATE" or $type == "REPLACE") - return $stmt->rowCount(); - elseif ($type == "SELECT") - { - $res=$stmt->fetchAll ( PDO::FETCH_ASSOC ); - if ($res===array()) - return null; - else - return $res; - } - } - } - - static function sqlMysqli( $Query) - { - $debug_backtrace = debug_backtrace(); - - if((isset($debug_backtrace[3])) && ($debug_backtrace[3]['function'] == 'pathId')) { - if (!self::$groupConcatLimitChanged) { - $success = self::$Db->query ("SET SESSION group_concat_max_len = 1000000"); - - if ($success) { - self::$groupConcatLimitChanged = true; - } - } - } - - $args = func_get_args (); - if (count ( $args ) == 1) - { - $result = self::$Db->query ( $Query ); - if ($result===true) - return true; - if ($result && $result->num_rows) - { - $out = array (); - while ( null != ($r = $result->fetch_array ( MYSQLI_ASSOC )) ) - $out [] = $r; - return $out; - } - return null; - } - else - { - if (! $preparedStatement = self::$Db->prepare ( $Query )) - trigger_error ( "Unable to prepare statement: {$Query}, reason: ".self::$Db->error ); - array_shift ( $args ); // remove $Query from args - $a = array (); - foreach ( $args as $k => &$v ) - $a [$k] = &$v; - $types = str_repeat ( "s", count ( $args ) ); // all params are - // strings, works well on - // MySQL - // and SQLite - array_unshift ( $a, $types ); - call_user_func_array ( array ($preparedStatement, 'bind_param' ), $a ); - $preparedStatement->execute (); - - $type = substr ( trim ( strtoupper ( $Query ) ), 0, 6 ); - if ($type == "INSERT") - { - $res = self::$Db->insert_id; - if ($res == 0) - return self::$Db->affected_rows; - return $res; - } - elseif ($type == "DELETE" or $type == "UPDATE" or $type == "REPLAC") - return self::$Db->affected_rows; - elseif ($type == "SELECT") - { - // fetching all results in a 2D array - $metadata = $preparedStatement->result_metadata (); - $out = array (); - $fields = array (); - if (! $metadata) - return null; - while ( null != ($field = $metadata->fetch_field ()) ) - $fields [] = &$out [$field->name]; - call_user_func_array ( array ($preparedStatement, "bind_result" ), $fields ); - $output = array (); - $count = 0; - while ( $preparedStatement->fetch () ) - { - foreach ( $out as $k => $v ) - $output [$count] [$k] = $v; - $count ++; - } - $preparedStatement->free_result (); - return ($count == 0) ? null : $output; - } - else - return null; - } - } - - static function time() - { - return time(); - } -} - -Jf::setTablePrefix($tablePrefix); -Jf::$Rbac=new RbacManager(); -require_once __DIR__."/../setup.php"; \ No newline at end of file diff --git a/PhpRbac/src/PhpRbac/core/lib/nestedset/base.php b/PhpRbac/src/PhpRbac/core/lib/nestedset/base.php deleted file mode 100644 index 4bf64df..0000000 --- a/PhpRbac/src/PhpRbac/core/lib/nestedset/base.php +++ /dev/null @@ -1,397 +0,0 @@ -assign($Table,$IDField,$LeftField,$RightField); - } - private $Table; - private $Left,$Right; - private $ID; - protected function id() - { - return $this->ID; - } - protected function table() - { - return $this->Table; - } - protected function left() - { - return $this->Left; - } - protected function right() - { - return $this->Right; - } - /** - * Assigns fields of the table - * - * @param String $Table - * @param String $ID - * @param String $Left - * @param String $Right - */ - protected function assign($Table,$ID,$Left,$Right) - { - $this->Table=$Table; - $this->ID=$ID; - $this->Left=$Left; - $this->Right=$Right; - } - - /** - * Returns number of descendants - * - * @param Integer $ID - * @return Integer Count - */ - function descendantCount($ID) - { - $Res=Jf::sql("SELECT ({$this->right()}-{$this->left()}-1)/2 AS `Count` FROM - {$this->table()} WHERE {$this->id()}=?",$ID); - return sprintf("%d",$Res[0]["Count"])*1; - } - - /** - * Returns the depth of a node in the tree - * Note: this uses path - * @param Integer $ID - * @return Integer Depth from zero upwards - * @seealso path - */ - function depth($ID) - { - return count($this->path($ID))-1; - } - /** - * Returns a sibling of the current node - * Note: You can't find siblings of roots - * Note: this is a heavy function on nested sets, uses both children (which is quite heavy) and path - * @param Integer $ID - * @param Integer $SiblingDistance from current node (negative or positive) - * @return Array Node on success, null on failure - */ - function sibling($ID,$SiblingDistance=1) - { - $Parent=$this->parentNode($ID); - $Siblings=$this->children($Parent[$this->id()]); - if (!$Siblings) return null; - foreach ($Siblings as &$Sibling) - { - if ($Sibling[$this->id()]==$ID) break; - $n++; - } - return $Siblings[$n+$SiblingDistance]; - } - /** - * Returns the parent of a node - * Note: this uses path - * @param Integer $ID - * @return Array parentNode (null on failure) - * @seealso path - */ - function parentNode($ID) - { - $Path=$this->path($ID); - if (count($Path)<2) return null; - else return $Path[count($Path)-2]; - } - /** - * Deletes a node and shifts the children up - * - * @param Integer $ID - */ - function delete($ID) - { - $Info=Jf::sql("SELECT {$this->left()} AS `Left`,{$this->right()} AS `Right` - FROM {$this->table()} - WHERE {$this->id()} = ?; - ",$ID); - $Info=$Info[0]; - - $count=Jf::sql("DELETE FROM {$this->table()} WHERE {$this->left()} = ?",$Info["Left"]); - - - Jf::sql("UPDATE {$this->table()} SET {$this->right()} = {$this->right()} - 1, `". - $this->left."` = {$this->left()} - 1 WHERE {$this->left()} BETWEEN ? AND ?",$Info["Left"],$Info["Right"]); - Jf::sql("UPDATE {$this->table()} SET {$this->right()} = {$this->right()} - 2 WHERE `". - $this->Right."` > ?",$Info["Right"]); - Jf::sql("UPDATE {$this->table()} SET {$this->left()} = {$this->left()} - 2 WHERE `". - $this->left."` > ?",$Info["Right"]); - return $count; - } - /** - * Deletes a node and all its descendants - * - * @param Integer $ID - */ - function deleteSubtree($ID) - { - $Info=Jf::sql("SELECT {$this->left()} AS `Left`,{$this->right()} AS `Right` ,{$this->right()}-{$this->left()}+ 1 AS Width - FROM {$this->table()} - WHERE {$this->id()} = ?; - ",$ID); - $Info=$Info[0]; - - $count=Jf::sql(" - DELETE FROM {$this->table()} WHERE {$this->left()} BETWEEN ? AND ? - ",$Info["Left"],$Info["Right"]); - - Jf::sql(" - UPDATE {$this->table()} SET {$this->right()} = {$this->right()} - ? WHERE {$this->right()} > ? - ",$Info["Width"],$Info["Right"]); - Jf::sql(" - UPDATE {$this->table()} SET {$this->left()} = {$this->left()} - ? WHERE {$this->left()} > ? - ",$Info["Width"],$Info["Right"]); - return $count; - - } - /** - * Returns all descendants of a node - * - * @param Integer $ID - * @param Boolean $AbsoluteDepths to return Depth of sub-tree from zero or absolutely from the whole tree - * @return Rowset including Depth field - * @seealso children - */ - function descendants($ID,$AbsoluteDepths=false) - { - if (!$AbsoluteDepths) - $DepthConcat="- (sub_tree.depth )"; - $Res=Jf::sql(" - SELECT node.*, (COUNT(parent.{$this->id()})-1 $DepthConcat ) AS Depth - FROM {$this->table()} AS node, - {$this->table()} AS parent, - {$this->table()} AS sub_parent, - ( - SELECT node.{$this->id()}, (COUNT(parent.{$this->id()}) - 1) AS depth - FROM {$this->table()} AS node, - {$this->table()} AS parent - WHERE node.{$this->left()} BETWEEN parent.{$this->left()} AND parent.{$this->right()} - AND node.{$this->id()} = ? - GROUP BY node.{$this->id()} - ORDER BY node.{$this->left()} - ) AS sub_tree - WHERE node.{$this->left()} BETWEEN parent.{$this->left()} AND parent.{$this->right()} - AND node.{$this->left()} BETWEEN sub_parent.{$this->left()} AND sub_parent.{$this->right()} - AND sub_parent.{$this->id()} = sub_tree.{$this->id()} - GROUP BY node.{$this->id()} - HAVING Depth > 0 - ORDER BY node.{$this->left()}",$ID); - return $Res; - } - /** - * Returns immediate children of a node - * Note: this function performs the same as descendants but only returns results with Depth=1 - * @param Integer $ID - * @return Rowset not including Depth - * @seealso descendants - */ - function children($ID) - { - $Res=Jf::sql(" - SELECT node.*, (COUNT(parent.{$this->id()})-1 - (sub_tree.depth )) AS Depth - FROM {$this->table()} AS node, - {$this->table()} AS parent, - {$this->table()} AS sub_parent, - ( - SELECT node.{$this->id()}, (COUNT(parent.{$this->id()}) - 1) AS depth - FROM {$this->table()} AS node, - {$this->table()} AS parent - WHERE node.{$this->left()} BETWEEN parent.{$this->left()} AND parent.{$this->right()} - AND node.{$this->id()} = ? - GROUP BY node.{$this->id()} - ORDER BY node.{$this->left()} - ) AS sub_tree - WHERE node.{$this->left()} BETWEEN parent.{$this->left()} AND parent.{$this->right()} - AND node.{$this->left()} BETWEEN sub_parent.{$this->left()} AND sub_parent.{$this->right()} - AND sub_parent.{$this->id()} = sub_tree.{$this->id()} - GROUP BY node.{$this->id()} - HAVING Depth = 1 - ORDER BY node.{$this->left()}; - ",$ID); - if ($Res) - foreach ($Res as &$v) - unset($v["Depth"]); - return $Res; - } - /** - * Returns the path to a node, including the node - * - * @param Integer $ID - * @return Rowset nodes in path - */ - function path($ID) - { - $Res=Jf::sql(" - SELECT parent.* - FROM {$this->table()} AS node, - ".$this->table." AS parent - WHERE node.{$this->left()} BETWEEN parent.{$this->left()} AND parent.{$this->right()} - AND node.{$this->id()} = ? - ORDER BY parent.{$this->left()}",$ID); - return $Res; - } - - /** - * Finds all leaves of a parent - * Note: if you don' specify $PID, There would be one less AND in the SQL Query - * @param Integer $PID - * @return Rowset Leaves - */ - function leaves($PID=null) - { - if ($PID) - $Res=Jf::sql("SELECT * - FROM {$this->table()} - WHERE {$this->right()} = {$this->left()} + 1 - AND {$this->left()} BETWEEN - (SELECT {$this->left()} FROM {$this->table()} WHERE {$this->id()}=?) - AND - (SELECT {$this->right()} FROM {$this->table()} WHERE {$this->id()}=?)",$PID,$PID); - else - $Res=Jf::sql("SELECT * - FROM {$this->table()} - WHERE {$this->right()} = {$this->left()} + 1"); - return $Res; - } - /** - * Adds a sibling after a node - * - * @param Integer $ID - * @return Integer SiblingID - */ - function insertSibling($ID=0) - { -// $this->DB->AutoQuery("LOCK TABLE {$this->table()} WRITE;"); - //Find the Sibling - $Sibl=Jf::sql("SELECT {$this->right()} AS `Right`". - " FROM {$this->table()} WHERE {$this->id()} = ?",$ID); - $Sibl=$Sibl[0]; - if ($Sibl==null) - { - $Sibl["Right"]=0; - } - Jf::sql("UPDATE {$this->table()} SET {$this->right()} = {$this->right()} + 2 WHERE {$this->right()} > ?",$Sibl["Right"]); - Jf::sql("UPDATE {$this->table()} SET {$this->left()} = {$this->left()} + 2 WHERE {$this->left()} > ?",$Sibl["Right"]); - $Res= Jf::sql("INSERT INTO {$this->table()} ({$this->left()},{$this->right()}) ". - "VALUES(?,?)",$Sibl["Right"]+1,$Sibl["Right"]+2); -// $this->DB->AutoQuery("UNLOCK TABLES"); - return $Res; - } - /** - * Adds a child to the beginning of a node's children - * - * @param Integer $PID - * @return Integer ChildID - */ - function insertChild($PID=0) - { - //Find the Sibling - $Sibl=Jf::sql("SELECT {$this->left()} AS `Left`". - " FROM {$this->table()} WHERE {$this->id()} = ?",$PID); - $Sibl=$Sibl[0]; - if ($Sibl==null) - { - $Sibl["Left"]=0; - } - Jf::sql("UPDATE {$this->table()} SET {$this->right()} = {$this->right()} + 2 WHERE {$this->right()} > ?",$Sibl["Left"]); - Jf::sql("UPDATE {$this->table()} SET {$this->left()} = {$this->left()} + 2 WHERE {$this->left()} > ?",$Sibl["Left"]); - $Res=Jf::sql("INSERT INTO {$this->table()} ({$this->left()},{$this->right()}) ". - "VALUES(?,?)",$Sibl["Left"]+1,$Sibl["Left"]+2); - return $Res; - } - /** - * Retrives the full tree including Depth field. - * - * @return 2DArray Rowset - */ - function fullTree() - { - $Res=Jf::sql("SELECT node.*, (COUNT(parent.{$this->id()}) - 1) AS Depth - FROM {$this->table()} AS node, - {$this->table()} AS parent - WHERE node.{$this->left()} BETWEEN parent.{$this->left()} AND parent.{$this->right()} - GROUP BY node.{$this->id()} - ORDER BY node.{$this->left()}"); - return $Res; - } - /** - * This function converts a 2D array with Depth fields into a multidimensional tree in an associative array - * - * @param Array $Result - * @return Array Tree - */ - #FIXME: think how to implement this! - /** - function Result2Tree($Result) - { - $out=array(); - $stack=array(); - $cur=&$out; - foreach($Result as $R) - { - if ($cur[$LastKey]['Depth']==$R['Depth']) - { - echo "adding 0 ".$R['Title'].BR; - $cur[$R[$this->id()]]=$R; - $LastKey=$R[$this->id()]; - } - elseif ($cur[$LastKey]['Depth']<$R['Depth']) - { - echo "adding 1 ".$R['Title'].BR; - array_push($stack,$cur); - $cur=&$cur[$LastKey]; - $cur[$R[$this->id()]]=$R; - $LastKey=$R[$this->id()]; - } - elseif ($cur[$LastKey]['Depth']>$R['Depth']) - { - echo "adding 2 ".$R['Title'].BR; - $cur=array_pop($stack); - $cur[$R[$this->id()]]=$R; - $LastKey=$R[$this->id()]; - } - - } - return $out; - } - /**/ -} - -?> \ No newline at end of file diff --git a/PhpRbac/src/PhpRbac/core/lib/nestedset/full.php b/PhpRbac/src/PhpRbac/core/lib/nestedset/full.php deleted file mode 100644 index b2a2616..0000000 --- a/PhpRbac/src/PhpRbac/core/lib/nestedset/full.php +++ /dev/null @@ -1,494 +0,0 @@ -AutoRipRightLeft && $ResultSet) - foreach ($ResultSet as &$v) - { - if (isset($v[$this->Left])) - unset($v[$this->Left]); - if (isset($v[$this->Right])) - unset($v[$this->Right]); - } - } - **/ - protected function lock() - { - Jf::sql("LOCK TABLE {$this->table()} WRITE"); - } - protected function unlock() - { - Jf::sql("UNLOCK TABLES"); - } - /** - * Returns the ID of a node based on a SQL conditional string - * It accepts other params in the PreparedStatements format - * @param string $Condition the SQL condition, such as Title=? - * @param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition - * @return Integer ID - */ - function getID($ConditionString,$Rest=null) - { - $args=func_get_args(); - array_shift($args); - $Query="SELECT {$this->id()} AS ID FROM {$this->table()} WHERE $ConditionString LIMIT 1"; - array_unshift($args,$Query); - $Res=call_user_func_array(("Jf::sql"),$args); - if ($Res) - return $Res[0]["ID"]; - else - return null; - } - /** - * Returns the record of a node based on a SQL conditional string - * It accepts other params in the PreparedStatements format - * @param String $Condition - * @param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition - * @return Array Record - */ - function getRecord($ConditionString,$Rest=null) - { - $args=func_get_args(); - array_shift($args); - $Query="SELECT * FROM {$this->table()} WHERE $ConditionString"; - array_unshift($args,$Query); - $Res=call_user_func_array(("Jf::sql"),$args); - if ($Res) - return $Res[0]; - else - return null; - } - /** - * Returns the depth of a node in the tree - * Note: this uses path - * @param String $ConditionString - * @param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition - * @return Integer Depth from zero upwards - * @seealso path - */ - function depthConditional($ConditionString,$Rest=null) - { - $Arguments=func_get_args(); - $Path=call_user_func_array(array($this,"pathConditional"),$Arguments); - - return count($Path)-1; - } - /** - * Returns a sibling of the current node - * Note: You can't find siblings of roots - * Note: this is a heavy function on nested sets, uses both children (which is quite heavy) and path - * @param Integer $SiblingDistance from current node (negative or positive) - * @param string $ConditionString - * @param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition - * @return Array Node on success, null on failure - */ - function siblingConditional($SiblingDistance=1,$ConditionString,$Rest=null) - { - $Arguments=func_get_args(); - $ConditionString=$ConditionString; //prevent warning - array_shift($Arguments); //Rid $SiblingDistance - $Parent=call_user_func_array(array($this,"parentNodeConditional"),$Arguments); - $Siblings=$this->children($Parent[$this->id()]); - if (!$Siblings) return null; - $ID=call_user_func_array(array($this,"getID"),$Arguments); - foreach ($Siblings as &$Sibling) - { - if ($Sibling[$this->id()]==$ID) break; - $n++; - } - return $Siblings[$n+$SiblingDistance]; - } - /** - * Returns the parent of a node - * Note: this uses path - * @param string $ConditionString - * @param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition - * @return Array parentNode (null on failure) - * @seealso path - */ - function parentNodeConditional($ConditionString,$Rest=null) - { - $Arguments=func_get_args(); - $Path=call_user_func_array(array($this,"pathConditional"),$Arguments); - if (count($Path)<2) return null; - else return $Path[count($Path)-2]; - } - /** - * Deletes a node and shifts the children up - * Note: use a condition to support only 1 row, LIMIT 1 used. - * @param String $ConditionString - * @param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition - * @return boolean - */ - function deleteConditional($ConditionString,$Rest=null) - { - $this->lock(); - $Arguments=func_get_args(); - array_shift($Arguments); - $Query="SELECT {$this->left()} AS `Left`,{$this->right()} AS `Right` - FROM {$this->table()} - WHERE $ConditionString LIMIT 1"; - - array_unshift($Arguments,$Query); - $Info=call_user_func_array("Jf::sql",$Arguments); - if (!$Info) - { - $this->unlock(); - return false; - } - $Info=$Info[0]; - - $count=Jf::sql("DELETE FROM {$this->table()} WHERE {$this->left()} = ?",$Info["Left"]); - - Jf::sql("UPDATE {$this->table()} SET {$this->right()} = {$this->right()} - 1, {$this->left()} = {$this->left()} - 1 WHERE {$this->left()} BETWEEN ? AND ?",$Info["Left"],$Info["Right"]); - Jf::sql("UPDATE {$this->table()} SET {$this->right()} = {$this->right()} - 2 WHERE {$this->right()} > ?",$Info["Right"]); - Jf::sql("UPDATE {$this->table()} SET {$this->left()} = {$this->left()} - 2 WHERE {$this->left()} > ?",$Info["Right"]); - $this->unlock(); - return $count==1; - } - /** - * Deletes a node and all its descendants - * - * @param String $ConditionString - * @param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition - */ - function deleteSubtreeConditional($ConditionString,$Rest=null) - { - $this->lock(); - $Arguments=func_get_args(); - array_shift($Arguments); - $Query="SELECT {$this->left()} AS `Left`,{$this->right()} AS `Right` ,{$this->right()}-{$this->left()}+ 1 AS Width - FROM {$this->table()} - WHERE $ConditionString"; - - array_unshift($Arguments,$Query); - $Info=call_user_func_array("Jf::sql",$Arguments); - - $Info=$Info[0]; - - $count=Jf::sql(" - DELETE FROM {$this->table()} WHERE {$this->left()} BETWEEN ? AND ? - ",$Info["Left"],$Info["Right"]); - - Jf::sql(" - UPDATE {$this->table()} SET {$this->right()} = {$this->right()} - ? WHERE {$this->right()} > ? - ",$Info["Width"],$Info["Right"]); - Jf::sql(" - UPDATE {$this->table()} SET {$this->left()} = {$this->left()} - ? WHERE {$this->left()} > ? - ",$Info["Width"],$Info["Right"]); - $this->unlock(); - return $count>=1; - } - /** - * Returns all descendants of a node - * Note: use only a sinlge condition here - * @param boolean $AbsoluteDepths to return Depth of sub-tree from zero or absolutely from the whole tree - * @param string $Condition - * @param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition - * @return Rowset including Depth field - * @seealso children - */ - function descendantsConditional($AbsoluteDepths=false,$ConditionString,$Rest=null) - { - if (!$AbsoluteDepths) - $DepthConcat="- (sub_tree.innerDepth )"; - $Arguments=func_get_args(); - array_shift($Arguments); - array_shift($Arguments); //second argument, $AbsoluteDepths - $Query=" - SELECT node.*, (COUNT(parent.{$this->id()})-1 $DepthConcat) AS Depth - FROM {$this->table()} AS node, - {$this->table()} AS parent, - {$this->table()} AS sub_parent, - ( - SELECT node.{$this->id()}, (COUNT(parent.{$this->id()}) - 1) AS innerDepth - FROM {$this->table()} AS node, - {$this->table()} AS parent - WHERE node.{$this->left()} BETWEEN parent.{$this->left()} AND parent.{$this->right()} - AND (node.$ConditionString) - GROUP BY node.{$this->id()} - ORDER BY node.{$this->left()} - ) AS sub_tree - WHERE node.{$this->left()} BETWEEN parent.{$this->left()} AND parent.{$this->right()} - AND node.{$this->left()} BETWEEN sub_parent.{$this->left()} AND sub_parent.{$this->right()} - AND sub_parent.{$this->id()} = sub_tree.{$this->id()} - GROUP BY node.{$this->id()} - HAVING Depth > 0 - ORDER BY node.{$this->left()}"; - - array_unshift($Arguments,$Query); - $Res=call_user_func_array("Jf::sql",$Arguments); - - return $Res; - } - /** - * Returns immediate children of a node - * Note: this function performs the same as descendants but only returns results with Depth=1 - * Note: use only a sinlge condition here - * @param string $ConditionString - * @param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition - * @return Rowset not including Depth - * @seealso descendants - */ - function childrenConditional($ConditionString,$Rest=null) - { - $Arguments=func_get_args(); - array_shift($Arguments); - $Query=" - SELECT node.*, (COUNT(parent.{$this->id()})-1 - (sub_tree.innerDepth )) AS Depth - FROM {$this->table()} AS node, - {$this->table()} AS parent, - {$this->table()} AS sub_parent, - ( - SELECT node.{$this->id()}, (COUNT(parent.{$this->id()}) - 1) AS innerDepth - FROM {$this->table()} AS node, - {$this->table()} AS parent - WHERE node.{$this->left()} BETWEEN parent.{$this->left()} AND parent.{$this->right()} - AND (node.$ConditionString) - GROUP BY node.{$this->id()} - ORDER BY node.{$this->left()} - ) AS sub_tree - WHERE node.{$this->left()} BETWEEN parent.{$this->left()} AND parent.{$this->right()} - AND node.{$this->left()} BETWEEN sub_parent.{$this->left()} AND sub_parent.{$this->right()} - AND sub_parent.{$this->id()} = sub_tree.{$this->id()} - GROUP BY node.{$this->id()} - HAVING Depth = 1 - ORDER BY node.{$this->left()}"; - - array_unshift($Arguments,$Query); - $Res=call_user_func_array("Jf::sql",$Arguments); - if ($Res) - foreach ($Res as &$v) - unset($v["Depth"]); - return $Res; - } - /** - * Returns the path to a node, including the node - * Note: use a single condition, or supply "node." before condition fields. - * @param string $ConditionString - * @param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition - * @return Rowset nodes in path - */ - function pathConditional($ConditionString,$Rest=null) - { - $Arguments=func_get_args(); - array_shift($Arguments); - $Query=" - SELECT parent.* - FROM {$this->table()} AS node, - {$this->table()} AS parent - WHERE node.{$this->left()} BETWEEN parent.{$this->left()} AND parent.{$this->right()} - AND ( node.$ConditionString ) - ORDER BY parent.{$this->left()}"; - - array_unshift($Arguments,$Query); - $Res=call_user_func_array("Jf::sql",$Arguments); - return $Res; - } - - /** - * Finds all leaves of a parent - * Note: if you don' specify $PID, There would be one less AND in the SQL Query - * @param String $ConditionString - * @param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition - * @return Rowset Leaves - */ - function leavesConditional($ConditionString=null,$Rest=null) - { - if ($ConditionString) - { - $Arguments=func_get_args(); - array_shift($Arguments); - if ($ConditionString) $ConditionString="WHERE $ConditionString"; - - $Query="SELECT * - FROM {$this->table()} - WHERE {$this->right()} = {$this->left()} + 1 - AND {$this->left()} BETWEEN - (SELECT {$this->left()} FROM {$this->table()} $ConditionString) - AND - (SELECT {$this->right()} FROM {$this->table()} $ConditionString)"; - - $Arguments=array_merge($Arguments,$Arguments); - array_unshift($Arguments,$Query); - $Res=call_user_func_array("Jf::sql",$Arguments); - } - else - $Res=Jf::sql("SELECT * - FROM {$this->table()} - WHERE {$this->right()} = {$this->left()} + 1"); - return $Res; - } - /** - * Adds a sibling after a node - * - * @param array $FieldValueArray Pairs of Key/Value as Field/Value in the table - * @param string $ConditionString - * @param string $Rest optional, rest of variables to fill in placeholders of condition string - * @return Integer SiblingID - */ - function insertSiblingData($FieldValueArray=array(),$ConditionString=null,$Rest=null) - { - $this->lock(); - //Find the Sibling - $Arguments=func_get_args(); - array_shift($Arguments); //first argument, the array - array_shift($Arguments); - if ($ConditionString) $ConditionString="WHERE $ConditionString"; - $Query="SELECT {$this->right()} AS `Right`". - " FROM {$this->table()} $ConditionString"; - - array_unshift($Arguments,$Query); - $Sibl=call_user_func_array("Jf::sql",$Arguments); - - $Sibl=$Sibl[0]; - if ($Sibl==null) - { - $Sibl["Left"]=$Sibl["Right"]=0; - } - Jf::sql("UPDATE {$this->table()} SET {$this->right()} = {$this->right()} + 2 WHERE {$this->right()} > ?",$Sibl["Right"]); - Jf::sql("UPDATE {$this->table()} SET {$this->left()} = {$this->left()} + 2 WHERE {$this->left()} > ?",$Sibl["Right"]); - - $FieldsString=$ValuesString=""; - $Values=array(); - if ($FieldValueArray) - foreach($FieldValueArray as $k=>$v) - { - $FieldsString.=","; - $FieldsString.="`".$k."`"; - $ValuesString.=",?"; - $Values[]=$v; - } - - $Query= "INSERT INTO {$this->table()} ({$this->left()},{$this->right()} $FieldsString) ". - "VALUES(?,? $ValuesString)"; - array_unshift($Values,$Sibl["Right"]+2); - array_unshift($Values,$Sibl["Right"]+1); - array_unshift($Values,$Query); - - $Res=call_user_func_array("Jf::sql",$Values); - $this->unlock(); - return $Res; - } - /** - * Adds a child to the beginning of a node's children - * - * @param Array $FieldValueArray key-paired field-values to insert - * @param string $ConditionString of the parent node - * @param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition - * @return Integer ChildID - */ - function insertChildData($FieldValueArray=array(),$ConditionString=null,$Rest=null) - { - $this->lock(); - //Find the Sibling - $Arguments=func_get_args(); - array_shift($Arguments); //first argument, the array - array_shift($Arguments); - if ($ConditionString) $ConditionString="WHERE $ConditionString"; - $Query="SELECT {$this->right()} AS `Right`, {$this->left()} AS `Left`". - " FROM {$this->table()} $ConditionString"; - array_unshift($Arguments,$Query); - $Parent=call_user_func_array("Jf::sql",$Arguments); - - $Parent=$Parent[0]; - if ($Parent==null) - { - $Parent["Left"]=$Parent["Right"]=0; - } - Jf::sql("UPDATE {$this->table()} SET {$this->right()} = {$this->right()} + 2 WHERE {$this->right()} >= ?",$Parent["Right"]); - Jf::sql("UPDATE {$this->table()} SET {$this->left()} = {$this->left()} + 2 WHERE {$this->left()} > ?",$Parent["Right"]); - - $FieldsString=$ValuesString=""; - $Values=array(); - if ($FieldValueArray) - foreach($FieldValueArray as $k=>$v) - { - $FieldsString.=","; - $FieldsString.="`".$k."`"; - $ValuesString.=",?"; - $Values[]=$v; - } - $Query= "INSERT INTO {$this->table()} ({$this->left()},{$this->right()} $FieldsString) ". - "VALUES(?,? $ValuesString)"; - array_unshift($Values,$Parent["Right"]+1); - array_unshift($Values,$Parent["Right"]); - array_unshift($Values,$Query); - $Res=call_user_func_array("Jf::sql",$Values); - $this->unlock(); - return $Res; - } - /** - * Edits a node - * - * @param Array $FieldValueArray Pairs of Key/Value as Field/Value in the table to edit - * @param string $ConditionString - * @param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition - * @return Integer SiblingID - */ - function editData($FieldValueArray=array(),$ConditionString=null,$Rest=null) - { - //Find the Sibling - $Arguments=func_get_args(); - array_shift($Arguments); //first argument, the array - array_shift($Arguments); - if ($ConditionString) $ConditionString="WHERE $ConditionString"; - - - - $FieldsString=""; - $Values=array(); - if ($FieldValueArray) - foreach($FieldValueArray as $k=>$v) - { - if ($FieldsString!="") $FieldsString.=","; - $FieldsString.="`".$k."`=?"; - $Values[]=$v; - } - $Query="UPDATE {$this->table()} SET $FieldsString $ConditionString"; - - array_unshift($Values,$Query); - $Arguments=array_merge($Values,$Arguments); - - return call_user_func_array("Jf::sql",$Arguments); - } - -} - -?> \ No newline at end of file diff --git a/PhpRbac/src/PhpRbac/core/lib/rbac.php b/PhpRbac/src/PhpRbac/core/lib/rbac.php deleted file mode 100644 index 9c2dc3e..0000000 --- a/PhpRbac/src/PhpRbac/core/lib/rbac.php +++ /dev/null @@ -1,1120 +0,0 @@ -getAttribute(PDO::ATTR_DRIVER_NAME)=="sqlite"; - } - protected function isMySql() - { - $Adapter=get_class(Jf::$Db); - return $Adapter == "mysqli" or ($Adapter == "PDO" and Jf::$Db->getAttribute(PDO::ATTR_DRIVER_NAME)=="mysql"); - } -} - -/** - * Rbac base class, it contains operations that are essentially the same for - * permissions and roles - * and is inherited by both - * - * @author abiusx - * @version 1.0 - */ -abstract class BaseRbac extends JModel -{ - - function rootId() - { - return 1; - } - - /** - * Return type of current instance, e.g roles, permissions - * - * @return string - */ - abstract protected function type(); - - /** - * Adds a new role or permission - * Returns new entry's ID - * - * @param string $Title - * Title of the new entry - * @param string $Description - * Description of the new entry - * @param integer $ParentID - * optional ID of the parent node in the hierarchy - * @return integer ID of the new entry - */ - function add($Title, $Description, $ParentID = null) - { - if ($ParentID === null) - $ParentID = $this->rootId (); - return (int)$this->{$this->type ()}->insertChildData ( array ("Title" => $Title, "Description" => $Description ), "ID=?", $ParentID ); - } - - /** - * Adds a path and all its components. - * Will not replace or create siblings if a component exists. - * - * @param string $Path - * such as /some/role/some/where - Must begin with a / (slash) - * @param array $Descriptions - * array of descriptions (will add with empty description if not available) - * - * @return integer Number of nodes created (0 if none created) - */ - function addPath($Path, array $Descriptions = null) - { - if ($Path[0] !== "/") - throw new \Exception ("The path supplied is not valid."); - - $Path = substr ( $Path, 1 ); - $Parts = explode ( "/", $Path ); - $Parent = 1; - $index = 0; - $CurrentPath = ""; - $NodesCreated = 0; - - foreach ($Parts as $p) - { - if (isset ($Descriptions[$index])) - $Description = $Descriptions[$index]; - else - $Description = ""; - $CurrentPath .= "/{$p}"; - $t = $this->pathId($CurrentPath); - if (! $t) - { - $IID = $this->add($p, $Description, $Parent); - $Parent = $IID; - $NodesCreated++; - } - else - { - $Parent = $t; - } - - $index += 1; - } - - return (int)$NodesCreated; - } - - /** - * Return count of the entity - * - * @return integer - */ - function count() - { - $Res = Jf::sql ( "SELECT COUNT(*) FROM {$this->tablePrefix()}{$this->type()}" ); - return (int)$Res [0] ['COUNT(*)']; - } - - /** - * Returns ID of entity - * - * @param string $entity (Path or Title) - * - * @return mixed ID of entity or null - */ - public function returnId($entity = null) - { - if (substr ($entity, 0, 1) == "/") { - $entityID = $this->pathId($entity); - } else { - $entityID = $this->titleId($entity); - } - - return $entityID; - } - - /** - * Returns ID of a path - * - * @todo this has a limit of 1000 characters on $Path - * @param string $Path - * such as /role1/role2/role3 ( a single slash is root) - * @return integer NULL - */ - public function pathId($Path) - { - $Path = "root" . $Path; - - if ($Path [strlen ( $Path ) - 1] == "/") - $Path = substr ( $Path, 0, strlen ( $Path ) - 1 ); - $Parts = explode ( "/", $Path ); - - $Adapter = get_class(Jf::$Db); - if ($Adapter == "mysqli" or ($Adapter == "PDO" and Jf::$Db->getAttribute(PDO::ATTR_DRIVER_NAME)=="mysql")) { - $GroupConcat="GROUP_CONCAT(parent.Title ORDER BY parent.Lft SEPARATOR '/')"; - } elseif ($Adapter == "PDO" and Jf::$Db->getAttribute(PDO::ATTR_DRIVER_NAME)=="sqlite") { - $GroupConcat="GROUP_CONCAT(parent.Title,'/')"; - } else { - throw new \Exception ("Unknown Group_Concat on this type of database: {$Adapter}"); - } - - $res = Jf::sql ( "SELECT node.ID,{$GroupConcat} AS Path - FROM {$this->tablePrefix()}{$this->type()} AS node, - {$this->tablePrefix()}{$this->type()} AS parent - WHERE node.Lft BETWEEN parent.Lft AND parent.Rght - AND node.Title=? - GROUP BY node.ID - HAVING Path = ? - ", $Parts [count ( $Parts ) - 1], $Path ); - - if ($res) - return $res [0] ['ID']; - else - return null; - // TODO: make the below SQL work, so that 1024 limit is over - - $QueryBase = ("SELECT n0.ID \nFROM {$this->tablePrefix()}{$this->type()} AS n0"); - $QueryCondition = "\nWHERE n0.Title=?"; - - for($i = 1; $i < count ( $Parts ); ++ $i) - { - $j = $i - 1; - $QueryBase .= "\nJOIN {$this->tablePrefix()}{$this->type()} AS n{$i} ON (n{$j}.Lft BETWEEN n{$i}.Lft+1 AND n{$i}.Rght)"; - $QueryCondition .= "\nAND n{$i}.Title=?"; - // Forcing middle elements - $QueryBase .= "\nLEFT JOIN {$this->tablePrefix()}{$this->type()} AS nn{$i} ON (nn{$i}.Lft BETWEEN n{$i}.Lft+1 AND n{$j}.Lft-1)"; - $QueryCondition .= "\nAND nn{$i}.Lft IS NULL"; - } - $Query = $QueryBase . $QueryCondition; - $PartsRev = array_reverse ( $Parts ); - array_unshift ( $PartsRev, $Query ); - - print_ ( $PartsRev ); - $res = call_user_func_array ( "Jf::sql", $PartsRev ); - - if ($res) - return $res [0] ['ID']; - else - return null; - } - - /** - * Returns ID belonging to a title, and the first one on that - * - * @param string $Title - * @return integer Id of specified Title - */ - public function titleId($Title) - { - return $this->{$this->type ()}->getID ( "Title=?", $Title ); - } - - /** - * Return the whole record of a single entry (including Rght and Lft fields) - * - * @param integer $ID - */ - protected function getRecord($ID) - { - $args = func_get_args (); - return call_user_func_array ( array ($this->{$this->type ()}, "getRecord" ), $args ); - } - - /** - * Returns title of entity - * - * @param integer $ID - * @return string NULL - */ - function getTitle($ID) - { - $r = $this->getRecord ( "ID=?", $ID ); - if ($r) - return $r ['Title']; - else - return null; - } - - /** - * Returns path of a node - * - * @param integer $ID - * @return string path - */ - function getPath($ID) - { - $res = $this->{$this->type ()}->pathConditional ( "ID=?", $ID ); - $out = null; - if (is_array ( $res )) - foreach ( $res as $r ) - if ($r ['ID'] == 1) - $out = '/'; - else - $out .= "/" . $r ['Title']; - if (strlen ( $out ) > 1) - return substr ( $out, 1 ); - else - return $out; - } - - /** - * Return description of entity - * - * @param integer $ID - * @return string NULL - */ - function getDescription($ID) - { - $r = $this->getRecord ( "ID=?", $ID ); - if ($r) - return $r ['Description']; - else - return null; - } - - /** - * Edits an entity, changing title and/or description. Maintains Id. - * - * @param integer $ID - * @param string $NewTitle - * @param string $NewDescription - * - */ - function edit($ID, $NewTitle = null, $NewDescription = null) - { - $Data = array (); - - if ($NewTitle !== null) - $Data ['Title'] = $NewTitle; - - if ($NewDescription !== null) - $Data ['Description'] = $NewDescription; - - return $this->{$this->type ()}->editData ( $Data, "ID=?", $ID ) == 1; - } - - /** - * Returns children of an entity - * - * @param integer $ID - * @return array - * - */ - function children($ID) - { - return $this->{$this->type ()}->childrenConditional ( "ID=?", $ID ); - } - - /** - * Returns descendants of a node, with their depths in integer - * - * @param integer $ID - * @return array with keys as titles and Title,ID, Depth and Description - * - */ - function descendants($ID) - { - $res = $this->{$this->type ()}->descendantsConditional(/* absolute depths*/false, "ID=?", $ID ); - $out = array (); - if (is_array ( $res )) - foreach ( $res as $v ) - $out [$v ['Title']] = $v; - return $out; - } - - /** - * Return depth of a node - * - * @param integer $ID - */ - function depth($ID) - { - return $this->{$this->type ()}->depthConditional ( "ID=?", $ID ); - } - - /** - * Returns parent of a node - * - * @param integer $ID - * @return array including Title, Description and ID - * - */ - function parentNode($ID) - { - return $this->{$this->type ()}->parentNodeConditional ( "ID=?", $ID ); - } - - /** - * Reset the table back to its initial state - * Keep in mind that this will not touch relations - * - * @param boolean $Ensure - * must be true to work, otherwise an \Exception is thrown - * @throws \Exception - * @return integer number of deleted entries - * - */ - function reset($Ensure = false) - { - if ($Ensure !== true) - { - throw new \Exception ("You must pass true to this function, otherwise it won't work."); - return; - } - $res = Jf::sql ( "DELETE FROM {$this->tablePrefix()}{$this->type()}" ); - $Adapter = get_class(Jf::$Db); - if ($this->isMySql()) - Jf::sql ( "ALTER TABLE {$this->tablePrefix()}{$this->type()} AUTO_INCREMENT=1 " ); - elseif ($this->isSQLite()) - Jf::sql ( "delete from sqlite_sequence where name=? ", $this->tablePrefix () . "{$this->type()}" ); - else - throw new \Exception ( "Rbac can not reset table on this type of database: {$Adapter}" ); - $iid = Jf::sql ( "INSERT INTO {$this->tablePrefix()}{$this->type()} (Title,Description,Lft,Rght) VALUES (?,?,?,?)", "root", "root",0,1 ); - return (int)$res; - } - - /** - * Assigns a role to a permission (or vice-verse) - * - * @param mixed $Role - * Id, Title and Path - * @param mixed $Permission - * Id, Title and Path - * @return boolean inserted or existing - * - * @todo: Check for valid permissions/roles - * @todo: Implement custom error handler - */ - function assign($Role, $Permission) - { - if (is_numeric($Role)) - { - $RoleID = $Role; - } else { - if (substr($Role, 0, 1) == "/") - $RoleID = Jf::$Rbac->Roles->pathId($Role); - else - $RoleID = Jf::$Rbac->Roles->titleId($Role); - } - - if (is_numeric($Permission)) - { - $PermissionID = $Permission; - } else { - if (substr($Permission, 0, 1) == "/") - $PermissionID = Jf::$Rbac->Permissions->pathId($Permission); - else - $PermissionID = Jf::$Rbac->Permissions->titleId($Permission); - } - - return Jf::sql("INSERT INTO {$this->tablePrefix()}rolepermissions - (RoleID,PermissionID,AssignmentDate) - VALUES (?,?,?)", $RoleID, $PermissionID, Jf::time()) >= 1; - } - - /** - * Unassigns a role-permission relation - * - * @param mixed $Role - * Id, Title and Path - * @param mixed $Permission: - * Id, Title and Path - * @return boolean - */ - function unassign($Role, $Permission) - { - if (is_numeric($Role)) - { - $RoleID = $Role; - } else { - if (substr($Role, 0, 1) == "/") - $RoleID = Jf::$Rbac->Roles->pathId($Role); - else - $RoleID = Jf::$Rbac->Roles->titleId($Role); - } - - if (is_numeric($Permission)) - { - $PermissionID = $Permission; - } else { - if (substr($Permission, 0, 1) == "/") - $PermissionID = Jf::$Rbac->Permissions->pathId($Permission); - else - $PermissionID = Jf::$Rbac->Permissions->titleId($Permission); - } - - return Jf::sql("DELETE FROM {$this->tablePrefix()}rolepermissions WHERE - RoleID=? AND PermissionID=?", $RoleID, $PermissionID) == 1; - } - - /** - * Remove all role-permission relations - * mostly used for testing - * - * @param boolean $Ensure - * must be set to true or throws an \Exception - * @return number of deleted assignments - */ - function resetAssignments($Ensure = false) - { - if ($Ensure !== true) - { - throw new \Exception ("You must pass true to this function, otherwise it won't work."); - return; - } - $res = Jf::sql ( "DELETE FROM {$this->tablePrefix()}rolepermissions" ); - - $Adapter = get_class(Jf::$Db); - if ($this->isMySql()) - Jf::sql ( "ALTER TABLE {$this->tablePrefix()}rolepermissions AUTO_INCREMENT =1 " ); - elseif ($this->isSQLite()) - Jf::sql ( "delete from sqlite_sequence where name=? ", $this->tablePrefix () . "_rolepermissions" ); - else - throw new \Exception ( "Rbac can not reset table on this type of database: {$Adapter}" ); - $this->assign ( $this->rootId(), $this->rootId()); - return $res; - } -} - -/** - * @defgroup phprbac_manager Documentation regarding Rbac Manager Functionality - * @ingroup phprbac - * @{ - * - * Documentation regarding Rbac Manager functionality. - * - * Rbac Manager: Provides NIST Level 2 Standard Hierarchical Role Based Access Control - * - * Has three members, Roles, Users and Permissions for specific operations - * - * @author abiusx - * @version 1.0 - */ -class RbacManager extends JModel -{ - function __construct() - { - $this->Users = new RbacUserManager (); - $this->Roles = new RoleManager (); - $this->Permissions = new PermissionManager (); - } - - /** - * - * @var \Jf\PermissionManager - */ - public $Permissions; - - /** - * - * @var \Jf\RoleManager - */ - public $Roles; - - /** - * - * @var \Jf\RbacUserManager - */ - public $Users; - - /** - * Assign a role to a permission. - * Alias for what's in the base class - * - * @param string|integer $Role - * Id, Title or Path - * @param string|integer $Permission - * Id, Title or Path - * @return boolean - */ - function assign($Role, $Permission) - { - return $this->Roles->assign($Role, $Permission); - } - - /** - * Prepared statement for check query - * - * @var BaseDatabaseStatement - */ - private $ps_Check = null; - - /** - * Checks whether a user has a permission or not. - * - * @param string|integer $Permission - * you can provide a path like /some/permission, a title, or the - * permission ID. - * in case of ID, don't forget to provide integer (not a string - * containing a number) - * @param string|integer $UserID - * User ID of a user - * - * @throws RbacPermissionNotFoundException - * @throws RbacUserNotProvidedException - * @return boolean - */ - function check($Permission, $UserID = null) - { - if ($UserID === null) - throw new \RbacUserNotProvidedException ("\$UserID is a required argument."); - - // convert permission to ID - if (is_numeric ( $Permission )) - { - $PermissionID = $Permission; - } - else - { - if (substr ( $Permission, 0, 1 ) == "/") - $PermissionID = $this->Permissions->pathId ( $Permission ); - else - $PermissionID = $this->Permissions->titleId ( $Permission ); - } - - // if invalid, throw exception - if ($PermissionID === null) - throw new RbacPermissionNotFoundException ( "The permission '{$Permission}' not found." ); - - if ($this->isSQLite()) - { - $LastPart="AS Temp ON ( TR.ID = Temp.RoleID) - WHERE - TUrel.UserID=? - AND - Temp.ID=?"; - } - else //mysql - { - $LastPart="ON ( TR.ID = TRel.RoleID) - WHERE - TUrel.UserID=? - AND - TPdirect.ID=?"; - } - $Res=Jf::sql ( "SELECT COUNT(*) AS Result - FROM - {$this->tablePrefix()}userroles AS TUrel - - JOIN {$this->tablePrefix()}roles AS TRdirect ON (TRdirect.ID=TUrel.RoleID) - JOIN {$this->tablePrefix()}roles AS TR ON ( TR.Lft BETWEEN TRdirect.Lft AND TRdirect.Rght) - JOIN - ( {$this->tablePrefix()}permissions AS TPdirect - JOIN {$this->tablePrefix()}permissions AS TP ON ( TPdirect.Lft BETWEEN TP.Lft AND TP.Rght) - JOIN {$this->tablePrefix()}rolepermissions AS TRel ON (TP.ID=TRel.PermissionID) - ) $LastPart", - $UserID, $PermissionID ); - - return $Res [0] ['Result'] >= 1; - } - - /** - * Enforce a permission on a user - * - * @param string|integer $Permission - * path or title or ID of permission - * - * @param integer $UserID - * - * @throws RbacUserNotProvidedException - */ - function enforce($Permission, $UserID = null) - { - if ($UserID === null) - throw new \RbacUserNotProvidedException ("\$UserID is a required argument."); - - if (! $this->check($Permission, $UserID)) { - header('HTTP/1.1 403 Forbidden'); - die("Forbidden: You do not have permission to access this resource."); - } - - return true; - } - - /** - * Remove all roles, permissions and assignments - * mostly used for testing - * - * @param boolean $Ensure - * must set or throws error - * @return boolean - */ - function reset($Ensure = false) - { - if ($Ensure !== true) { - throw new \Exception ("You must pass true to this function, otherwise it won't work."); - return; - } - - $res = true; - $res = $res and $this->Roles->resetAssignments ( true ); - $res = $res and $this->Roles->reset ( true ); - $res = $res and $this->Permissions->reset ( true ); - $res = $res and $this->Users->resetAssignments ( true ); - - return $res; - } -} - -/** @} */ // End group phprbac_manager */ - -/** - * @defgroup phprbac_permission_manager Documentation regarding Permission Manager Functionality - * @ingroup phprbac - * @{ - * - * Documentation regarding Permission Manager functionality. - * - * Permission Manager: Contains functionality specific to Permissions - * - * @author abiusx - * @version 1.0 - */ -class PermissionManager extends BaseRbac -{ - /** - * Permissions Nested Set - * - * @var FullNestedSet - */ - protected $permissions; - - protected function type() - { - return "permissions"; - } - - function __construct() - { - $this->permissions = new FullNestedSet ( $this->tablePrefix () . "permissions", "ID", "Lft", "Rght" ); - } - - /** - * Remove permissions from system - * - * @param integer $ID - * permission id - * @param boolean $Recursive - * delete all descendants - * - */ - function remove($ID, $Recursive = false) - { - $this->unassignRoles ( $ID ); - if (! $Recursive) - return $this->permissions->deleteConditional ( "ID=?", $ID ); - else - return $this->permissions->deleteSubtreeConditional ( "ID=?", $ID ); - } - - /** - * Unassignes all roles of this permission, and returns their number - * - * @param integer $ID - * Permission Id - * @return integer - */ - function unassignRoles($ID) - { - $res = Jf::sql ( "DELETE FROM {$this->tablePrefix()}rolepermissions WHERE - PermissionID=?", $ID ); - return (int)$res; - } - - /** - * Returns all roles assigned to a permission - * - * @param mixed $Permission - * Id, Title, Path - * @param boolean $OnlyIDs - * if true, result will be a 1D array of IDs - * @return Array 2D or 1D or null - */ - function roles($Permission, $OnlyIDs = true) - { - if (!is_numeric($Permission)) - $Permission = $this->returnId($Permission); - - if ($OnlyIDs) - { - $Res = Jf::sql ( "SELECT RoleID AS `ID` FROM - {$this->tablePrefix()}rolepermissions WHERE PermissionID=? ORDER BY RoleID", $Permission ); - - if (is_array ( $Res )) - { - $out = array (); - foreach ( $Res as $R ) - $out [] = $R ['ID']; - return $out; - } - else - return null; - } else { - return Jf::sql ( "SELECT `TP`.ID, `TP`.Title, `TP`.Description FROM {$this->tablePrefix()}roles AS `TP` - LEFT JOIN {$this->tablePrefix()}rolepermissions AS `TR` ON (`TR`.RoleID=`TP`.ID) - WHERE PermissionID=? ORDER BY TP.ID", $Permission ); - } - } -} - -/** @} */ // End group phprbac_permission_manager */ - -/** - * @defgroup phprbac_role_manager Documentation regarding Role Manager Functionality - * @ingroup phprbac - * @{ - * - * Documentation regarding Role Manager functionality. - * - * Role Manager: Contains functionality specific to Roles - * - * @author abiusx - * @version 1.0 - */ -class RoleManager extends BaseRbac -{ - /** - * Roles Nested Set - * - * @var FullNestedSet - */ - protected $roles = null; - - protected function type() - { - return "roles"; - } - - function __construct() - { - $this->type = "roles"; - $this->roles = new FullNestedSet ( $this->tablePrefix () . "roles", "ID", "Lft", "Rght" ); - } - - /** - * Remove roles from system - * - * @param integer $ID - * role id - * @param boolean $Recursive - * delete all descendants - * - */ - function remove($ID, $Recursive = false) - { - $this->unassignPermissions ( $ID ); - $this->unassignUsers ( $ID ); - if (! $Recursive) - return $this->roles->deleteConditional ( "ID=?", $ID ); - else - return $this->roles->deleteSubtreeConditional ( "ID=?", $ID ); - } - - /** - * Unassigns all permissions belonging to a role - * - * @param integer $ID - * role ID - * @return integer number of assignments deleted - */ - function unassignPermissions($ID) - { - $r = Jf::sql ( "DELETE FROM {$this->tablePrefix()}rolepermissions WHERE - RoleID=? ", $ID ); - return $r; - } - - /** - * Unassign all users that have a certain role - * - * @param integer $ID - * role ID - * @return integer number of deleted assignments - */ - function unassignUsers($ID) - { - return Jf::sql ( "DELETE FROM {$this->tablePrefix()}userroles WHERE - RoleID=?", $ID ); - } - - /** - * Checks to see if a role has a permission or not - * - * @param integer $Role - * ID - * @param integer $Permission - * ID - * @return boolean - * - * @todo: If we pass a Role that doesn't exist the method just returns false. We may want to check for a valid Role. - */ - function hasPermission($Role, $Permission) - { - $Res = Jf::sql ( " - SELECT COUNT(*) AS Result - FROM {$this->tablePrefix()}rolepermissions AS TRel - JOIN {$this->tablePrefix()}permissions AS TP ON ( TP.ID= TRel.PermissionID) - JOIN {$this->tablePrefix()}roles AS TR ON ( TR.ID = TRel.RoleID) - WHERE TR.Lft BETWEEN - (SELECT Lft FROM {$this->tablePrefix()}roles WHERE ID=?) - AND - (SELECT Rght FROM {$this->tablePrefix()}roles WHERE ID=?) - /* the above section means any row that is a descendants of our role (if descendant roles have some permission, then our role has it two) */ - AND TP.ID IN ( - SELECT parent.ID - FROM {$this->tablePrefix()}permissions AS node, - {$this->tablePrefix()}permissions AS parent - WHERE node.Lft BETWEEN parent.Lft AND parent.Rght - AND ( node.ID=? ) - ORDER BY parent.Lft - ); - /* - the above section returns all the parents of (the path to) our permission, so if one of our role or its descendants - has an assignment to any of them, we're good. - */ - ", $Role, $Role, $Permission ); - return $Res [0] ['Result'] >= 1; - } - - /** - * Returns all permissions assigned to a role - * - * @param integer $Role - * ID - * @param boolean $OnlyIDs - * if true, result would be a 1D array of IDs - * @return Array 2D or 1D or null - * the two dimensional array would have ID,Title and Description of permissions - */ - function permissions($Role, $OnlyIDs = true) - { - if (! is_numeric ($Role)) - $Role = $this->returnId($Role); - - if ($OnlyIDs) - { - $Res = Jf::sql ( "SELECT PermissionID AS `ID` FROM {$this->tablePrefix()}rolepermissions WHERE RoleID=? ORDER BY PermissionID", $Role ); - if (is_array ( $Res )) - { - $out = array (); - foreach ( $Res as $R ) - $out [] = $R ['ID']; - return $out; - } - else - return null; - } else { - return Jf::sql ( "SELECT `TP`.ID, `TP`.Title, `TP`.Description FROM {$this->tablePrefix()}permissions AS `TP` - LEFT JOIN {$this->tablePrefix()}rolepermissions AS `TR` ON (`TR`.PermissionID=`TP`.ID) - WHERE RoleID=? ORDER BY TP.ID", $Role ); - } - } -} - -/** @} */ // End group phprbac_role_manager */ - -/** - * @defgroup phprbac_user_manager Documentation regarding Rbac User Manager Functionality - * @ingroup phprbac - * @{ - * - * Documentation regarding Rbac User Manager functionality. - * - * Rbac User Manager: Contains functionality specific to Users - * - * @author abiusx - * @version 1.0 - */ -class RbacUserManager extends JModel -{ - /** - * Checks to see whether a user has a role or not - * - * @param integer|string $Role - * id, title or path - * @param integer $User - * UserID, not optional - * - * @throws RbacUserNotProvidedException - * @return boolean success - */ - function hasRole($Role, $UserID = null) - { - if ($UserID === null) - throw new \RbacUserNotProvidedException ("\$UserID is a required argument."); - - if (is_numeric ( $Role )) - { - $RoleID = $Role; - } - else - { - if (substr ( $Role, 0, 1 ) == "/") - $RoleID = Jf::$Rbac->Roles->pathId ( $Role ); - else - $RoleID = Jf::$Rbac->Roles->titleId ( $Role ); - } - - $R = Jf::sql ( "SELECT * FROM {$this->tablePrefix()}userroles AS TUR - JOIN {$this->tablePrefix()}roles AS TRdirect ON (TRdirect.ID=TUR.RoleID) - JOIN {$this->tablePrefix()}roles AS TR ON (TR.Lft BETWEEN TRdirect.Lft AND TRdirect.Rght) - - WHERE - TUR.UserID=? AND TR.ID=?", $UserID, $RoleID ); - return $R !== null; - } - - /** - * Assigns a role to a user - * - * @param mixed $Role - * Id, Path or Title - * @param integer $UserID - * UserID (use 0 for guest) - * - * @throws RbacUserNotProvidedException - * @return boolean inserted or existing - */ - function assign($Role, $UserID = null) - { - if ($UserID === null) - throw new \RbacUserNotProvidedException ("\$UserID is a required argument."); - - if (is_numeric($Role)) - { - $RoleID = $Role; - } else { - if (substr($Role, 0, 1) == "/") - $RoleID = Jf::$Rbac->Roles->pathId($Role); - else - $RoleID = Jf::$Rbac->Roles->titleId($Role); - } - - $res = Jf::sql ( "INSERT INTO {$this->tablePrefix()}userroles - (UserID,RoleID,AssignmentDate) - VALUES (?,?,?) - ", $UserID, $RoleID, Jf::time () ); - return $res >= 1; - } - - /** - * Unassigns a role from a user - * - * @param mixed $Role - * Id, Title, Path - * @param integer $UserID - * UserID (use 0 for guest) - * - * @throws RbacUserNotProvidedException - * @return boolean success - */ - function unassign($Role, $UserID = null) - { - if ($UserID === null) - throw new \RbacUserNotProvidedException ("\$UserID is a required argument."); - - if (is_numeric($Role)) - { - $RoleID = $Role; - - } else { - - if (substr($Role, 0, 1) == "/") - $RoleID = Jf::$Rbac->Roles->pathId($Role); - else - $RoleID = Jf::$Rbac->Roles->titleId($Role); - } - - return Jf::sql("DELETE FROM {$this->tablePrefix()}userroles WHERE UserID=? AND RoleID=?", $UserID, $RoleID) >= 1; - } - - /** - * Returns all roles of a user - * - * @param integer $UserID - * Not optional - * - * @throws RbacUserNotProvidedException - * @return array null - * - */ - function allRoles($UserID = null) - { - if ($UserID === null) - throw new \RbacUserNotProvidedException ("\$UserID is a required argument."); - - return Jf::sql ( "SELECT TR.* - FROM - {$this->tablePrefix()}userroles AS `TRel` - JOIN {$this->tablePrefix()}roles AS `TR` ON - (`TRel`.RoleID=`TR`.ID) - WHERE TRel.UserID=?", $UserID ); - } - - /** - * Return count of roles assigned to a user - * - * @param integer $UserID - * - * @throws RbacUserNotProvidedException - * @return integer Count of Roles assigned to a User - */ - function roleCount($UserID = null) - { - if ($UserID === null) - throw new \RbacUserNotProvidedException ("\$UserID is a required argument."); - - $Res = Jf::sql ( "SELECT COUNT(*) AS Result FROM {$this->tablePrefix()}userroles WHERE UserID=?", $UserID ); - return (int)$Res [0] ['Result']; - } - - /** - * Remove all role-user relations - * mostly used for testing - * - * @param boolean $Ensure - * must set to true or throws an Exception - * @return number of deleted relations - */ - function resetAssignments($Ensure = false) - { - if ($Ensure !== true) - { - throw new \Exception ("You must pass true to this function, otherwise it won't work."); - return; - } - $res = Jf::sql ( "DELETE FROM {$this->tablePrefix()}userroles" ); - - $Adapter = get_class(Jf::$Db); - if ($this->isMySql()) - Jf::sql ( "ALTER TABLE {$this->tablePrefix()}userroles AUTO_INCREMENT =1 " ); - elseif ($this->isSQLite()) - Jf::sql ( "delete from sqlite_sequence where name=? ", $this->tablePrefix () . "_userroles" ); - else - throw new \Exception ("Rbac can not reset table on this type of database: {$Adapter}"); - $this->assign ( "root", 1 /* root user */ ); - return $res; - } -} - -/** @} */ // End group phprbac_user_manager */ diff --git a/PhpRbac/src/PhpRbac/core/setup.php b/PhpRbac/src/PhpRbac/core/setup.php deleted file mode 100644 index eb0ec89..0000000 --- a/PhpRbac/src/PhpRbac/core/setup.php +++ /dev/null @@ -1,69 +0,0 @@ -getCode()==1049) //database not found - installPdoMysql($host,$user,$pass,$dbname); - else - throw $e; - } -} -elseif ($adapter=="pdo_sqlite") -{ - if (!file_exists($dbname)) - installPdoSqlite($host,$user,$pass,$dbname); - else - Jf::$Db=new PDO("sqlite:{$dbname}",$user,$pass); -// Jf::$Db=new PDO("sqlite::memory:",$user,$pass); -} -else # default to mysqli -{ - @Jf::$Db=new mysqli($host,$user,$pass,$dbname); - if(jf::$Db->connect_errno==1049) - installMysqli($host,$user,$pass,$dbname); -} -function getSqls($dbms) -{ - $sql=file_get_contents(dirname(dirname(dirname(__DIR__))) . "/database/{$dbms}.sql"); - $sql=str_replace("PREFIX_",Jf::tablePrefix(),$sql); - return explode(";",$sql); -} -function installPdoMysql($host,$user,$pass,$dbname) -{ - $sqls=getSqls("mysql"); - $db=new PDO("mysql:host={$host};",$user,$pass); - $db->query("CREATE DATABASE {$dbname}"); - $db->query("USE {$dbname}"); - if (is_array($sqls)) - foreach ($sqls as $query) - $db->query($query); - Jf::$Db=new PDO("mysql:host={$host};dbname={$dbname}",$user,$pass); - Jf::$Rbac->reset(true); -} -function installPdoSqlite($host,$user,$pass,$dbname) -{ - Jf::$Db=new PDO("sqlite:{$dbname}",$user,$pass); - $sqls=getSqls("sqlite"); - if (is_array($sqls)) - foreach ($sqls as $query) - Jf::$Db->query($query); - Jf::$Rbac->reset(true); -} -function installMysqli($host,$user,$pass,$dbname) -{ - $sqls=getSqls("mysql"); - $db=new mysqli($host,$user,$pass); - $db->query("CREATE DATABASE {$dbname}"); - $db->select_db($dbname); - if (is_array($sqls)) - foreach ($sqls as $query) - $db->query($query); - Jf::$Db=new mysqli($host,$user,$pass,$dbname); - Jf::$Rbac->reset(true); -} diff --git a/PhpRbac/tests/README.md b/PhpRbac/tests/README.md deleted file mode 100644 index 603ae95..0000000 --- a/PhpRbac/tests/README.md +++ /dev/null @@ -1,43 +0,0 @@ -#Instructions for running Unit Tests. - -##Front Matter - -* The Unit Tests should be run using a database specific for Unit Testing. This way your dev/testing/production data will not be affected. -* To run the Unit Tests using the MySQL adapter you will need to have an existing database with the proper tables and default data prior to running the tests. -* If you are running the Unit Tests for the SQLite adapter the database will be created/overwritten for you automatically. - -##The Setup - -* Create the database and tables - * MySQL - * Execute the queries located in the 'mysql.sql' file in the 'rbac/PhpRbac/database/' directory - * **WARNING:** Make sure you replace 'PREFIX_' appropriately - * SQLite - * The database will be created/overwritten for you automatically when you run the Unit Tests -* Navigate to 'rbac/PhpRbac/tests/database' and open up 'database.config'. Change the database connection info accordingly -* Navigate to 'rbac/PhpRbac/tests' and open up 'phpunit_mysql.xml'. Change the database connection info accordingly. Don't forget to change the database name in the DNS string (this is for the DBUnit connection, fixture and datasets) - -##Run The Unit Tests - -* You will need to navigate to 'rbac/PhpRbac/tests/' in order to execute the following commands. - -###On Linux - -**Note:** Make sure you make 'mysql_tests.sh' and 'sqlite_tests.sh' executable - -* To run the tests for MySQL: ./mysql_tests.sh -* To run the tests for SQLite: ./sqlite_tests.sh - -###On Windows - -* To run the tests for MySQL: mysql_tests.bat -* To run the tests for SQLite: sqlite_tests.bat - -##Notes - -* Make sure you alter the 'rbac/PhpRbac/tests/database/database.config' file (see above) before switching between MySQL and SQLite tests. -* We've created scripts for Windows and Linux (any OS that has sh/bash available). All scripts will: - * Execute PHPUnit with the proper xml configuration file. - * Accept additional PHPUnit parameters (i.e. --colors). - * Pause after tests so they can be run from a GUI directory/file explorer application. -* **Thanks to the AuraPHP team for helping us bootstrap our Unit Testing methods** \ No newline at end of file diff --git a/PhpRbac/tests/bootstrap.php b/PhpRbac/tests/bootstrap.php deleted file mode 100644 index 121e833..0000000 --- a/PhpRbac/tests/bootstrap.php +++ /dev/null @@ -1,6 +0,0 @@ - '/DbUnit-1.2.3/Samples/BankAccountDB/BankAccount.php', - 'bankaccountdbtest' => '/DbUnit-1.2.3/Samples/BankAccountDB/BankAccountDBTest.php', - 'bankaccountdbtestmysql' => '/DbUnit-1.2.3/Samples/BankAccountDB/BankAccountDBTestMySQL.php', - 'bankaccountexception' => '/DbUnit-1.2.3/Samples/BankAccountDB/BankAccount.php', - 'file_iterator' => '/File_Iterator-1.3.3/File/Iterator.php', - 'file_iterator_facade' => '/File_Iterator-1.3.3/File/Iterator/Facade.php', - 'file_iterator_factory' => '/File_Iterator-1.3.3/File/Iterator/Factory.php', - 'php_codecoverage' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage.php', - 'php_codecoverage_driver' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Driver.php', - 'php_codecoverage_driver_xdebug' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Driver/Xdebug.php', - 'php_codecoverage_exception' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Exception.php', - 'php_codecoverage_filter' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Filter.php', - 'php_codecoverage_report_clover' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/Clover.php', - 'php_codecoverage_report_factory' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/Factory.php', - 'php_codecoverage_report_html' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML.php', - 'php_codecoverage_report_html_renderer' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer.php', - 'php_codecoverage_report_html_renderer_dashboard' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Dashboard.php', - 'php_codecoverage_report_html_renderer_directory' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Directory.php', - 'php_codecoverage_report_html_renderer_file' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/File.php', - 'php_codecoverage_report_node' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/Node.php', - 'php_codecoverage_report_node_directory' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/Node/Directory.php', - 'php_codecoverage_report_node_file' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/Node/File.php', - 'php_codecoverage_report_node_iterator' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/Node/Iterator.php', - 'php_codecoverage_report_php' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/PHP.php', - 'php_codecoverage_report_text' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/Text.php', - 'php_codecoverage_util' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Util.php', - 'php_codecoverage_util_invalidargumenthelper' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Util/InvalidArgumentHelper.php', - 'php_codecoverage_version' => '/PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Version.php', - 'php_invoker' => '/PHP_Invoker-1.1.2/PHP/Invoker.php', - 'php_invoker_timeoutexception' => '/PHP_Invoker-1.1.2/PHP/Invoker/TimeoutException.php', - 'php_timer' => '/PHP_Timer-1.0.5/PHP/Timer.php', - 'php_token' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_abstract' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_ampersand' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_and_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_array' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_array_cast' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_as' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_at' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_backtick' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_bad_character' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_bool_cast' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_boolean_and' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_boolean_or' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_break' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_callable' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_caret' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_case' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_catch' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_character' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_class' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_class_c' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_clone' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_close_bracket' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_close_curly' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_close_square' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_close_tag' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_colon' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_comma' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_comment' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_concat_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_const' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_constant_encapsed_string' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_continue' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_curly_open' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_dec' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_declare' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_default' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_dir' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_div' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_div_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_dnumber' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_do' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_doc_comment' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_dollar' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_dollar_open_curly_braces' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_dot' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_double_arrow' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_double_cast' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_double_colon' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_double_quotes' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_echo' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_else' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_elseif' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_empty' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_encapsed_and_whitespace' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_end_heredoc' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_enddeclare' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_endfor' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_endforeach' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_endif' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_endswitch' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_endwhile' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_eval' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_exclamation_mark' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_exit' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_extends' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_file' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_final' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_finally' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_for' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_foreach' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_func_c' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_function' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_global' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_goto' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_gt' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_halt_compiler' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_if' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_implements' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_inc' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_include' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_include_once' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_includes' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_inline_html' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_instanceof' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_insteadof' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_int_cast' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_interface' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_is_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_is_greater_or_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_is_identical' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_is_not_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_is_not_identical' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_is_smaller_or_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_isset' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_line' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_list' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_lnumber' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_logical_and' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_logical_or' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_logical_xor' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_lt' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_method_c' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_minus' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_minus_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_mod_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_mul_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_mult' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_namespace' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_new' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_ns_c' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_ns_separator' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_num_string' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_object_cast' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_object_operator' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_open_bracket' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_open_curly' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_open_square' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_open_tag' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_open_tag_with_echo' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_or_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_paamayim_nekudotayim' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_percent' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_pipe' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_plus' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_plus_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_print' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_private' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_protected' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_public' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_question_mark' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_require' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_require_once' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_return' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_semicolon' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_sl' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_sl_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_sr' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_sr_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_start_heredoc' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_static' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_stream' => '/PHP_TokenStream-1.1.8/PHP/Token/Stream.php', - 'php_token_stream_cachingfactory' => '/PHP_TokenStream-1.1.8/PHP/Token/Stream/CachingFactory.php', - 'php_token_string' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_string_cast' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_string_varname' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_switch' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_throw' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_tilde' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_trait' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_trait_c' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_try' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_unset' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_unset_cast' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_use' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_var' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_variable' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_while' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_whitespace' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_xor_equal' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_token_yield' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_tokenwithscope' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'php_tokenwithscopeandvisibility' => '/PHP_TokenStream-1.1.8/PHP/Token.php', - 'phpunit_extensions_database_abstracttester' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/AbstractTester.php', - 'phpunit_extensions_database_constraint_datasetisequal' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Constraint/DataSetIsEqual.php', - 'phpunit_extensions_database_constraint_tableisequal' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Constraint/TableIsEqual.php', - 'phpunit_extensions_database_constraint_tablerowcount' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Constraint/TableRowCount.php', - 'phpunit_extensions_database_dataset_abstractdataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/AbstractDataSet.php', - 'phpunit_extensions_database_dataset_abstracttable' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/AbstractTable.php', - 'phpunit_extensions_database_dataset_abstracttablemetadata' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/AbstractTableMetaData.php', - 'phpunit_extensions_database_dataset_abstractxmldataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/AbstractXmlDataSet.php', - 'phpunit_extensions_database_dataset_compositedataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/CompositeDataSet.php', - 'phpunit_extensions_database_dataset_csvdataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/CsvDataSet.php', - 'phpunit_extensions_database_dataset_datasetfilter' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/DataSetFilter.php', - 'phpunit_extensions_database_dataset_defaultdataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/DefaultDataSet.php', - 'phpunit_extensions_database_dataset_defaulttable' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/DefaultTable.php', - 'phpunit_extensions_database_dataset_defaulttableiterator' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/DefaultTableIterator.php', - 'phpunit_extensions_database_dataset_defaulttablemetadata' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/DefaultTableMetaData.php', - 'phpunit_extensions_database_dataset_flatxmldataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/FlatXmlDataSet.php', - 'phpunit_extensions_database_dataset_idataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/IDataSet.php', - 'phpunit_extensions_database_dataset_ipersistable' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/IPersistable.php', - 'phpunit_extensions_database_dataset_ispec' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/ISpec.php', - 'phpunit_extensions_database_dataset_itable' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/ITable.php', - 'phpunit_extensions_database_dataset_itableiterator' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/ITableIterator.php', - 'phpunit_extensions_database_dataset_itablemetadata' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/ITableMetaData.php', - 'phpunit_extensions_database_dataset_mysqlxmldataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/MysqlXmlDataSet.php', - 'phpunit_extensions_database_dataset_persistors_abstract' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Persistors/Abstract.php', - 'phpunit_extensions_database_dataset_persistors_factory' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Persistors/Factory.php', - 'phpunit_extensions_database_dataset_persistors_flatxml' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Persistors/FlatXml.php', - 'phpunit_extensions_database_dataset_persistors_mysqlxml' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Persistors/MysqlXml.php', - 'phpunit_extensions_database_dataset_persistors_xml' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Persistors/Xml.php', - 'phpunit_extensions_database_dataset_persistors_yaml' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Persistors/Yaml.php', - 'phpunit_extensions_database_dataset_querydataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/QueryDataSet.php', - 'phpunit_extensions_database_dataset_querytable' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/QueryTable.php', - 'phpunit_extensions_database_dataset_replacementdataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/ReplacementDataSet.php', - 'phpunit_extensions_database_dataset_replacementtable' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/ReplacementTable.php', - 'phpunit_extensions_database_dataset_replacementtableiterator' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/ReplacementTableIterator.php', - 'phpunit_extensions_database_dataset_specs_csv' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/Csv.php', - 'phpunit_extensions_database_dataset_specs_dbquery' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/DbQuery.php', - 'phpunit_extensions_database_dataset_specs_dbtable' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/DbTable.php', - 'phpunit_extensions_database_dataset_specs_factory' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/Factory.php', - 'phpunit_extensions_database_dataset_specs_flatxml' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/FlatXml.php', - 'phpunit_extensions_database_dataset_specs_ifactory' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/IFactory.php', - 'phpunit_extensions_database_dataset_specs_xml' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/Xml.php', - 'phpunit_extensions_database_dataset_specs_yaml' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/Yaml.php', - 'phpunit_extensions_database_dataset_tablefilter' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/TableFilter.php', - 'phpunit_extensions_database_dataset_tablemetadatafilter' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/TableMetaDataFilter.php', - 'phpunit_extensions_database_dataset_xmldataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/XmlDataSet.php', - 'phpunit_extensions_database_dataset_yamldataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/YamlDataSet.php', - 'phpunit_extensions_database_db_dataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/DataSet.php', - 'phpunit_extensions_database_db_defaultdatabaseconnection' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/DefaultDatabaseConnection.php', - 'phpunit_extensions_database_db_filtereddataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/FilteredDataSet.php', - 'phpunit_extensions_database_db_idatabaseconnection' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/IDatabaseConnection.php', - 'phpunit_extensions_database_db_imetadata' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/IMetaData.php', - 'phpunit_extensions_database_db_metadata' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/MetaData.php', - 'phpunit_extensions_database_db_metadata_informationschema' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/MetaData/InformationSchema.php', - 'phpunit_extensions_database_db_metadata_mysql' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/MetaData/MySQL.php', - 'phpunit_extensions_database_db_metadata_oci' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/MetaData/Oci.php', - 'phpunit_extensions_database_db_metadata_pgsql' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/MetaData/PgSQL.php', - 'phpunit_extensions_database_db_metadata_sqlite' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/MetaData/Sqlite.php', - 'phpunit_extensions_database_db_metadata_sqlsrv' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/MetaData/SqlSrv.php', - 'phpunit_extensions_database_db_resultsettable' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/ResultSetTable.php', - 'phpunit_extensions_database_db_table' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/Table.php', - 'phpunit_extensions_database_db_tableiterator' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/TableIterator.php', - 'phpunit_extensions_database_db_tablemetadata' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/TableMetaData.php', - 'phpunit_extensions_database_defaulttester' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/DefaultTester.php', - 'phpunit_extensions_database_exception' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Exception.php', - 'phpunit_extensions_database_idatabaselistconsumer' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/IDatabaseListConsumer.php', - 'phpunit_extensions_database_itester' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/ITester.php', - 'phpunit_extensions_database_operation_composite' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Composite.php', - 'phpunit_extensions_database_operation_delete' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Delete.php', - 'phpunit_extensions_database_operation_deleteall' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/DeleteAll.php', - 'phpunit_extensions_database_operation_exception' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Exception.php', - 'phpunit_extensions_database_operation_factory' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Factory.php', - 'phpunit_extensions_database_operation_idatabaseoperation' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/IDatabaseOperation.php', - 'phpunit_extensions_database_operation_insert' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Insert.php', - 'phpunit_extensions_database_operation_null' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Null.php', - 'phpunit_extensions_database_operation_replace' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Replace.php', - 'phpunit_extensions_database_operation_rowbased' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/RowBased.php', - 'phpunit_extensions_database_operation_truncate' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Truncate.php', - 'phpunit_extensions_database_operation_update' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Update.php', - 'phpunit_extensions_database_testcase' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/TestCase.php', - 'phpunit_extensions_database_ui_command' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/Command.php', - 'phpunit_extensions_database_ui_context' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/Context.php', - 'phpunit_extensions_database_ui_imedium' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/IMedium.php', - 'phpunit_extensions_database_ui_imediumprinter' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/IMediumPrinter.php', - 'phpunit_extensions_database_ui_imode' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/IMode.php', - 'phpunit_extensions_database_ui_imodefactory' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/IModeFactory.php', - 'phpunit_extensions_database_ui_invalidmodeexception' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/InvalidModeException.php', - 'phpunit_extensions_database_ui_mediums_text' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/Mediums/Text.php', - 'phpunit_extensions_database_ui_modefactory' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/ModeFactory.php', - 'phpunit_extensions_database_ui_modes_exportdataset' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/Modes/ExportDataSet.php', - 'phpunit_extensions_database_ui_modes_exportdataset_arguments' => '/DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/Modes/ExportDataSet/Arguments.php', - 'phpunit_extensions_grouptestsuite' => '/PHPUnit/Extensions/GroupTestSuite.php', - 'phpunit_extensions_phpttestcase' => '/PHPUnit/Extensions/PhptTestCase.php', - 'phpunit_extensions_phpttestcase_logger' => '/PHPUnit/Extensions/PhptTestCase/Logger.php', - 'phpunit_extensions_phpttestsuite' => '/PHPUnit/Extensions/PhptTestSuite.php', - 'phpunit_extensions_repeatedtest' => '/PHPUnit/Extensions/RepeatedTest.php', - 'phpunit_extensions_selenium2testcase' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase.php', - 'phpunit_extensions_selenium2testcase_command' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Command.php', - 'phpunit_extensions_selenium2testcase_commandsholder' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/CommandsHolder.php', - 'phpunit_extensions_selenium2testcase_driver' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Driver.php', - 'phpunit_extensions_selenium2testcase_element' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Element.php', - 'phpunit_extensions_selenium2testcase_element_accessor' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Element/Accessor.php', - 'phpunit_extensions_selenium2testcase_element_select' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Element/Select.php', - 'phpunit_extensions_selenium2testcase_elementcommand_attribute' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Attribute.php', - 'phpunit_extensions_selenium2testcase_elementcommand_click' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Click.php', - 'phpunit_extensions_selenium2testcase_elementcommand_css' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Css.php', - 'phpunit_extensions_selenium2testcase_elementcommand_equals' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Equals.php', - 'phpunit_extensions_selenium2testcase_elementcommand_genericaccessor' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/GenericAccessor.php', - 'phpunit_extensions_selenium2testcase_elementcommand_genericpost' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/GenericPost.php', - 'phpunit_extensions_selenium2testcase_elementcommand_value' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Value.php', - 'phpunit_extensions_selenium2testcase_elementcriteria' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCriteria.php', - 'phpunit_extensions_selenium2testcase_exception' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Exception.php', - 'phpunit_extensions_selenium2testcase_keys' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Keys.php', - 'phpunit_extensions_selenium2testcase_keysholder' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/KeysHolder.php', - 'phpunit_extensions_selenium2testcase_noseleniumexception' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/NoSeleniumException.php', - 'phpunit_extensions_selenium2testcase_response' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Response.php', - 'phpunit_extensions_selenium2testcase_screenshotlistener' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ScreenshotListener.php', - 'phpunit_extensions_selenium2testcase_session' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Session.php', - 'phpunit_extensions_selenium2testcase_session_cookie' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Session/Cookie.php', - 'phpunit_extensions_selenium2testcase_session_cookie_builder' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Session/Cookie/Builder.php', - 'phpunit_extensions_selenium2testcase_session_storage' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Session/Storage.php', - 'phpunit_extensions_selenium2testcase_session_timeouts' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Session/Timeouts.php', - 'phpunit_extensions_selenium2testcase_sessioncommand_acceptalert' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/AcceptAlert.php', - 'phpunit_extensions_selenium2testcase_sessioncommand_alerttext' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/AlertText.php', - 'phpunit_extensions_selenium2testcase_sessioncommand_click' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Click.php', - 'phpunit_extensions_selenium2testcase_sessioncommand_dismissalert' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/DismissAlert.php', - 'phpunit_extensions_selenium2testcase_sessioncommand_frame' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Frame.php', - 'phpunit_extensions_selenium2testcase_sessioncommand_genericaccessor' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/GenericAccessor.php', - 'phpunit_extensions_selenium2testcase_sessioncommand_genericattribute' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/GenericAttribute.php', - 'phpunit_extensions_selenium2testcase_sessioncommand_keys' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Keys.php', - 'phpunit_extensions_selenium2testcase_sessioncommand_location' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Location.php', - 'phpunit_extensions_selenium2testcase_sessioncommand_moveto' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/MoveTo.php', - 'phpunit_extensions_selenium2testcase_sessioncommand_orientation' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Orientation.php', - 'phpunit_extensions_selenium2testcase_sessioncommand_url' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Url.php', - 'phpunit_extensions_selenium2testcase_sessioncommand_window' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Window.php', - 'phpunit_extensions_selenium2testcase_sessionstrategy' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionStrategy.php', - 'phpunit_extensions_selenium2testcase_sessionstrategy_isolated' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionStrategy/Isolated.php', - 'phpunit_extensions_selenium2testcase_sessionstrategy_shared' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionStrategy/Shared.php', - 'phpunit_extensions_selenium2testcase_statecommand' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/StateCommand.php', - 'phpunit_extensions_selenium2testcase_url' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/URL.php', - 'phpunit_extensions_selenium2testcase_waituntil' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/WaitUntil.php', - 'phpunit_extensions_selenium2testcase_webdriverexception' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/WebDriverException.php', - 'phpunit_extensions_selenium2testcase_window' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Window.php', - 'phpunit_extensions_seleniumbrowsersuite' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/SeleniumBrowserSuite.php', - 'phpunit_extensions_seleniumcommon_remotecoverage' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/SeleniumCommon/RemoteCoverage.php', - 'phpunit_extensions_seleniumtestcase' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/SeleniumTestCase.php', - 'phpunit_extensions_seleniumtestcase_driver' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/SeleniumTestCase/Driver.php', - 'phpunit_extensions_seleniumtestsuite' => '/PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/SeleniumTestSuite.php', - 'phpunit_extensions_testdecorator' => '/PHPUnit/Extensions/TestDecorator.php', - 'phpunit_extensions_ticketlistener' => '/PHPUnit/Extensions/TicketListener.php', - 'phpunit_framework_assert' => '/PHPUnit/Framework/Assert.php', - 'phpunit_framework_assertionfailederror' => '/PHPUnit/Framework/AssertionFailedError.php', - 'phpunit_framework_comparator' => '/PHPUnit/Framework/Comparator.php', - 'phpunit_framework_comparator_array' => '/PHPUnit/Framework/Comparator/Array.php', - 'phpunit_framework_comparator_domdocument' => '/PHPUnit/Framework/Comparator/DOMDocument.php', - 'phpunit_framework_comparator_double' => '/PHPUnit/Framework/Comparator/Double.php', - 'phpunit_framework_comparator_exception' => '/PHPUnit/Framework/Comparator/Exception.php', - 'phpunit_framework_comparator_mockobject' => '/PHPUnit/Framework/Comparator/MockObject.php', - 'phpunit_framework_comparator_numeric' => '/PHPUnit/Framework/Comparator/Numeric.php', - 'phpunit_framework_comparator_object' => '/PHPUnit/Framework/Comparator/Object.php', - 'phpunit_framework_comparator_resource' => '/PHPUnit/Framework/Comparator/Resource.php', - 'phpunit_framework_comparator_scalar' => '/PHPUnit/Framework/Comparator/Scalar.php', - 'phpunit_framework_comparator_splobjectstorage' => '/PHPUnit/Framework/Comparator/SplObjectStorage.php', - 'phpunit_framework_comparator_type' => '/PHPUnit/Framework/Comparator/Type.php', - 'phpunit_framework_comparatorfactory' => '/PHPUnit/Framework/ComparatorFactory.php', - 'phpunit_framework_comparisonfailure' => '/PHPUnit/Framework/ComparisonFailure.php', - 'phpunit_framework_constraint' => '/PHPUnit/Framework/Constraint.php', - 'phpunit_framework_constraint_and' => '/PHPUnit/Framework/Constraint/And.php', - 'phpunit_framework_constraint_arrayhaskey' => '/PHPUnit/Framework/Constraint/ArrayHasKey.php', - 'phpunit_framework_constraint_attribute' => '/PHPUnit/Framework/Constraint/Attribute.php', - 'phpunit_framework_constraint_callback' => '/PHPUnit/Framework/Constraint/Callback.php', - 'phpunit_framework_constraint_classhasattribute' => '/PHPUnit/Framework/Constraint/ClassHasAttribute.php', - 'phpunit_framework_constraint_classhasstaticattribute' => '/PHPUnit/Framework/Constraint/ClassHasStaticAttribute.php', - 'phpunit_framework_constraint_composite' => '/PHPUnit/Framework/Constraint/Composite.php', - 'phpunit_framework_constraint_count' => '/PHPUnit/Framework/Constraint/Count.php', - 'phpunit_framework_constraint_exception' => '/PHPUnit/Framework/Constraint/Exception.php', - 'phpunit_framework_constraint_exceptioncode' => '/PHPUnit/Framework/Constraint/ExceptionCode.php', - 'phpunit_framework_constraint_exceptionmessage' => '/PHPUnit/Framework/Constraint/ExceptionMessage.php', - 'phpunit_framework_constraint_fileexists' => '/PHPUnit/Framework/Constraint/FileExists.php', - 'phpunit_framework_constraint_greaterthan' => '/PHPUnit/Framework/Constraint/GreaterThan.php', - 'phpunit_framework_constraint_isanything' => '/PHPUnit/Framework/Constraint/IsAnything.php', - 'phpunit_framework_constraint_isempty' => '/PHPUnit/Framework/Constraint/IsEmpty.php', - 'phpunit_framework_constraint_isequal' => '/PHPUnit/Framework/Constraint/IsEqual.php', - 'phpunit_framework_constraint_isfalse' => '/PHPUnit/Framework/Constraint/IsFalse.php', - 'phpunit_framework_constraint_isidentical' => '/PHPUnit/Framework/Constraint/IsIdentical.php', - 'phpunit_framework_constraint_isinstanceof' => '/PHPUnit/Framework/Constraint/IsInstanceOf.php', - 'phpunit_framework_constraint_isjson' => '/PHPUnit/Framework/Constraint/IsJson.php', - 'phpunit_framework_constraint_isnull' => '/PHPUnit/Framework/Constraint/IsNull.php', - 'phpunit_framework_constraint_istrue' => '/PHPUnit/Framework/Constraint/IsTrue.php', - 'phpunit_framework_constraint_istype' => '/PHPUnit/Framework/Constraint/IsType.php', - 'phpunit_framework_constraint_jsonmatches' => '/PHPUnit/Framework/Constraint/JsonMatches.php', - 'phpunit_framework_constraint_jsonmatches_errormessageprovider' => '/PHPUnit/Framework/Constraint/JsonMatches/ErrorMessageProvider.php', - 'phpunit_framework_constraint_lessthan' => '/PHPUnit/Framework/Constraint/LessThan.php', - 'phpunit_framework_constraint_not' => '/PHPUnit/Framework/Constraint/Not.php', - 'phpunit_framework_constraint_objecthasattribute' => '/PHPUnit/Framework/Constraint/ObjectHasAttribute.php', - 'phpunit_framework_constraint_or' => '/PHPUnit/Framework/Constraint/Or.php', - 'phpunit_framework_constraint_pcrematch' => '/PHPUnit/Framework/Constraint/PCREMatch.php', - 'phpunit_framework_constraint_samesize' => '/PHPUnit/Framework/Constraint/SameSize.php', - 'phpunit_framework_constraint_stringcontains' => '/PHPUnit/Framework/Constraint/StringContains.php', - 'phpunit_framework_constraint_stringendswith' => '/PHPUnit/Framework/Constraint/StringEndsWith.php', - 'phpunit_framework_constraint_stringmatches' => '/PHPUnit/Framework/Constraint/StringMatches.php', - 'phpunit_framework_constraint_stringstartswith' => '/PHPUnit/Framework/Constraint/StringStartsWith.php', - 'phpunit_framework_constraint_traversablecontains' => '/PHPUnit/Framework/Constraint/TraversableContains.php', - 'phpunit_framework_constraint_traversablecontainsonly' => '/PHPUnit/Framework/Constraint/TraversableContainsOnly.php', - 'phpunit_framework_constraint_xor' => '/PHPUnit/Framework/Constraint/Xor.php', - 'phpunit_framework_error' => '/PHPUnit/Framework/Error.php', - 'phpunit_framework_error_deprecated' => '/PHPUnit/Framework/Error/Deprecated.php', - 'phpunit_framework_error_notice' => '/PHPUnit/Framework/Error/Notice.php', - 'phpunit_framework_error_warning' => '/PHPUnit/Framework/Error/Warning.php', - 'phpunit_framework_exception' => '/PHPUnit/Framework/Exception.php', - 'phpunit_framework_expectationfailedexception' => '/PHPUnit/Framework/ExpectationFailedException.php', - 'phpunit_framework_incompletetest' => '/PHPUnit/Framework/IncompleteTest.php', - 'phpunit_framework_incompletetesterror' => '/PHPUnit/Framework/IncompleteTestError.php', - 'phpunit_framework_mockobject_builder_identity' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Builder/Identity.php', - 'phpunit_framework_mockobject_builder_invocationmocker' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Builder/InvocationMocker.php', - 'phpunit_framework_mockobject_builder_match' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Builder/Match.php', - 'phpunit_framework_mockobject_builder_methodnamematch' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Builder/MethodNameMatch.php', - 'phpunit_framework_mockobject_builder_namespace' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Builder/Namespace.php', - 'phpunit_framework_mockobject_builder_parametersmatch' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Builder/ParametersMatch.php', - 'phpunit_framework_mockobject_builder_stub' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Builder/Stub.php', - 'phpunit_framework_mockobject_generator' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Generator.php', - 'phpunit_framework_mockobject_invocation' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Invocation.php', - 'phpunit_framework_mockobject_invocation_object' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Invocation/Object.php', - 'phpunit_framework_mockobject_invocation_static' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Invocation/Static.php', - 'phpunit_framework_mockobject_invocationmocker' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/InvocationMocker.php', - 'phpunit_framework_mockobject_invokable' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Invokable.php', - 'phpunit_framework_mockobject_matcher' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher.php', - 'phpunit_framework_mockobject_matcher_anyinvokedcount' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/AnyInvokedCount.php', - 'phpunit_framework_mockobject_matcher_anyparameters' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/AnyParameters.php', - 'phpunit_framework_mockobject_matcher_invocation' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/Invocation.php', - 'phpunit_framework_mockobject_matcher_invokedatindex' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/InvokedAtIndex.php', - 'phpunit_framework_mockobject_matcher_invokedatleastonce' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/InvokedAtLeastOnce.php', - 'phpunit_framework_mockobject_matcher_invokedcount' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/InvokedCount.php', - 'phpunit_framework_mockobject_matcher_invokedrecorder' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/InvokedRecorder.php', - 'phpunit_framework_mockobject_matcher_methodname' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/MethodName.php', - 'phpunit_framework_mockobject_matcher_parameters' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/Parameters.php', - 'phpunit_framework_mockobject_matcher_statelessinvocation' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/StatelessInvocation.php', - 'phpunit_framework_mockobject_mockbuilder' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/MockBuilder.php', - 'phpunit_framework_mockobject_mockobject' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/MockObject.php', - 'phpunit_framework_mockobject_stub' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub.php', - 'phpunit_framework_mockobject_stub_consecutivecalls' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/ConsecutiveCalls.php', - 'phpunit_framework_mockobject_stub_exception' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/Exception.php', - 'phpunit_framework_mockobject_stub_matchercollection' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/MatcherCollection.php', - 'phpunit_framework_mockobject_stub_return' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/Return.php', - 'phpunit_framework_mockobject_stub_returnargument' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/ReturnArgument.php', - 'phpunit_framework_mockobject_stub_returncallback' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/ReturnCallback.php', - 'phpunit_framework_mockobject_stub_returnself' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/ReturnSelf.php', - 'phpunit_framework_mockobject_stub_returnvaluemap' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/ReturnValueMap.php', - 'phpunit_framework_mockobject_verifiable' => '/PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Verifiable.php', - 'phpunit_framework_outputerror' => '/PHPUnit/Framework/OutputError.php', - 'phpunit_framework_selfdescribing' => '/PHPUnit/Framework/SelfDescribing.php', - 'phpunit_framework_skippedtest' => '/PHPUnit/Framework/SkippedTest.php', - 'phpunit_framework_skippedtesterror' => '/PHPUnit/Framework/SkippedTestError.php', - 'phpunit_framework_skippedtestsuiteerror' => '/PHPUnit/Framework/SkippedTestSuiteError.php', - 'phpunit_framework_syntheticerror' => '/PHPUnit/Framework/SyntheticError.php', - 'phpunit_framework_test' => '/PHPUnit/Framework/Test.php', - 'phpunit_framework_testcase' => '/PHPUnit/Framework/TestCase.php', - 'phpunit_framework_testfailure' => '/PHPUnit/Framework/TestFailure.php', - 'phpunit_framework_testlistener' => '/PHPUnit/Framework/TestListener.php', - 'phpunit_framework_testresult' => '/PHPUnit/Framework/TestResult.php', - 'phpunit_framework_testsuite' => '/PHPUnit/Framework/TestSuite.php', - 'phpunit_framework_testsuite_dataprovider' => '/PHPUnit/Framework/TestSuite/DataProvider.php', - 'phpunit_framework_warning' => '/PHPUnit/Framework/Warning.php', - 'phpunit_runner_basetestrunner' => '/PHPUnit/Runner/BaseTestRunner.php', - 'phpunit_runner_standardtestsuiteloader' => '/PHPUnit/Runner/StandardTestSuiteLoader.php', - 'phpunit_runner_testsuiteloader' => '/PHPUnit/Runner/TestSuiteLoader.php', - 'phpunit_runner_version' => '/PHPUnit/Runner/Version.php', - 'phpunit_textui_command' => '/PHPUnit/TextUI/Command.php', - 'phpunit_textui_resultprinter' => '/PHPUnit/TextUI/ResultPrinter.php', - 'phpunit_textui_testrunner' => '/PHPUnit/TextUI/TestRunner.php', - 'phpunit_util_class' => '/PHPUnit/Util/Class.php', - 'phpunit_util_configuration' => '/PHPUnit/Util/Configuration.php', - 'phpunit_util_deprecatedfeature' => '/PHPUnit/Util/DeprecatedFeature.php', - 'phpunit_util_deprecatedfeature_logger' => '/PHPUnit/Util/DeprecatedFeature/Logger.php', - 'phpunit_util_diff' => '/PHPUnit/Util/Diff.php', - 'phpunit_util_errorhandler' => '/PHPUnit/Util/ErrorHandler.php', - 'phpunit_util_fileloader' => '/PHPUnit/Util/Fileloader.php', - 'phpunit_util_filesystem' => '/PHPUnit/Util/Filesystem.php', - 'phpunit_util_filter' => '/PHPUnit/Util/Filter.php', - 'phpunit_util_getopt' => '/PHPUnit/Util/Getopt.php', - 'phpunit_util_globalstate' => '/PHPUnit/Util/GlobalState.php', - 'phpunit_util_invalidargumenthelper' => '/PHPUnit/Util/InvalidArgumentHelper.php', - 'phpunit_util_log_json' => '/PHPUnit/Util/Log/JSON.php', - 'phpunit_util_log_junit' => '/PHPUnit/Util/Log/JUnit.php', - 'phpunit_util_log_tap' => '/PHPUnit/Util/Log/TAP.php', - 'phpunit_util_php' => '/PHPUnit/Util/PHP.php', - 'phpunit_util_php_default' => '/PHPUnit/Util/PHP/Default.php', - 'phpunit_util_php_windows' => '/PHPUnit/Util/PHP/Windows.php', - 'phpunit_util_printer' => '/PHPUnit/Util/Printer.php', - 'phpunit_util_string' => '/PHPUnit/Util/String.php', - 'phpunit_util_test' => '/PHPUnit/Util/Test.php', - 'phpunit_util_testdox_nameprettifier' => '/PHPUnit/Util/TestDox/NamePrettifier.php', - 'phpunit_util_testdox_resultprinter' => '/PHPUnit/Util/TestDox/ResultPrinter.php', - 'phpunit_util_testdox_resultprinter_html' => '/PHPUnit/Util/TestDox/ResultPrinter/HTML.php', - 'phpunit_util_testdox_resultprinter_text' => '/PHPUnit/Util/TestDox/ResultPrinter/Text.php', - 'phpunit_util_testsuiteiterator' => '/PHPUnit/Util/TestSuiteIterator.php', - 'phpunit_util_type' => '/PHPUnit/Util/Type.php', - 'phpunit_util_xml' => '/PHPUnit/Util/XML.php', - 'symfony\\component\\yaml\\dumper' => '/Yaml-2.2.0/Symfony/Component/Yaml/Dumper.php', - 'symfony\\component\\yaml\\escaper' => '/Yaml-2.2.0/Symfony/Component/Yaml/Escaper.php', - 'symfony\\component\\yaml\\exception\\dumpexception' => '/Yaml-2.2.0/Symfony/Component/Yaml/Exception/DumpException.php', - 'symfony\\component\\yaml\\exception\\exceptioninterface' => '/Yaml-2.2.0/Symfony/Component/Yaml/Exception/ExceptionInterface.php', - 'symfony\\component\\yaml\\exception\\parseexception' => '/Yaml-2.2.0/Symfony/Component/Yaml/Exception/ParseException.php', - 'symfony\\component\\yaml\\exception\\runtimeexception' => '/Yaml-2.2.0/Symfony/Component/Yaml/Exception/RuntimeException.php', - 'symfony\\component\\yaml\\inline' => '/Yaml-2.2.0/Symfony/Component/Yaml/Inline.php', - 'symfony\\component\\yaml\\parser' => '/Yaml-2.2.0/Symfony/Component/Yaml/Parser.php', - 'symfony\\component\\yaml\\tests\\a' => '/Yaml-2.2.0/Symfony/Component/Yaml/Tests/DumperTest.php', - 'symfony\\component\\yaml\\tests\\b' => '/Yaml-2.2.0/Symfony/Component/Yaml/Tests/ParserTest.php', - 'symfony\\component\\yaml\\tests\\dumpertest' => '/Yaml-2.2.0/Symfony/Component/Yaml/Tests/DumperTest.php', - 'symfony\\component\\yaml\\tests\\inlinetest' => '/Yaml-2.2.0/Symfony/Component/Yaml/Tests/InlineTest.php', - 'symfony\\component\\yaml\\tests\\parsertest' => '/Yaml-2.2.0/Symfony/Component/Yaml/Tests/ParserTest.php', - 'symfony\\component\\yaml\\tests\\yamltest' => '/Yaml-2.2.0/Symfony/Component/Yaml/Tests/YamlTest.php', - 'symfony\\component\\yaml\\unescaper' => '/Yaml-2.2.0/Symfony/Component/Yaml/Unescaper.php', - 'symfony\\component\\yaml\\yaml' => '/Yaml-2.2.0/Symfony/Component/Yaml/Yaml.php', - 'text_template' => '/Text_Template-1.1.4/Text/Template.php' - ); - } - - $class = strtolower($class); - - if (isset($classes[$class])) { - require 'phar://phpunit-3.7.24.phar' . $classes[$class]; - } - } -); - -Phar::mapPhar('phpunit-3.7.24.phar'); - -if ($GLOBALS['_SERVER']['SCRIPT_NAME'] != '-') { - PHPUnit_TextUI_Command::main(); -} - -__HALT_COMPILER(); ?> -™­phpunit-3.7.24.pharFile_Iterator-1.3.3/LICENSE /“R  þæ¶&File_Iterator-1.3.3/ChangeLog.markdownT/“RTÇŽÌX¶#File_Iterator-1.3.3/README.markdownF/“RF_h'¶%File_Iterator-1.3.3/File/Iterator.phpk/“RkÂM¶,File_Iterator-1.3.3/File/Iterator/Facade.php­/“R­žmɶ-File_Iterator-1.3.3/File/Iterator/Factory.phpC/“RCÏ=—ˆ¶*PHP_TokenStream-1.1.8/PHP/Token/Stream.php“=/“R“=©éJv¶9PHP_TokenStream-1.1.8/PHP/Token/Stream/CachingFactory.phpì /“Rì ÄÔ¯¶#PHP_TokenStream-1.1.8/PHP/Token.phpL[/“RL[Öâ¶PHP_TokenStream-1.1.8/LICENSE/“RÅQ)[¶(PHP_TokenStream-1.1.8/ChangeLog.markdown¢/“R¢ÈžÁ¶%PHP_TokenStream-1.1.8/README.markdowne/“ReXžsF¶ PHPUnit_MockObject-1.2.3/LICENSE/“RBÒ¶CPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Invokable.php= /“R= °‹²¶SPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Generator/wsdl_class.tpl.distµ/“RµŽ§¶WPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Generator/unmocked_clone.tpl.distŸ/“RŸ8W}ض]PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Generator/mocked_object_method.tpl.dist„/“R„ãbVæ¶TPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Generator/wsdl_method.tpl.dist</“R<¾Ði‰¶]PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Generator/mocked_static_method.tpl.dist‰/“R‰>¦K¶UPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Generator/mocked_class.tpl.dist‚/“R‚Àb)¶UPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Generator/mocked_clone.tpl.dist„/“R„œaT¶TPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Generator/trait_class.tpl.dist-/“R-˜1°,¶CPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Generator.php%i/“R%ipúp)¶LPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/MethodName.phpJ/“RJÔk¶TPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/InvokedAtLeastOnce.php7 /“R7 ‡äßQ¶QPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/InvokedRecorder.phpÓ/“RÓŠ?ïd¶OPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/AnyParameters.php® /“R® g‚Œ¾¶NPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/InvokedCount.phpz/“Rz³_F¶QPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/AnyInvokedCount.phpI /“RI ™çDH¶LPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/Parameters.php£/“R£¸¦¶LPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/Invocation.php/“Réan¶UPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/StatelessInvocation.php/“RtšÅ¶PPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher/InvokedAtIndex.php}/“R}£Ó骶EPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/MockBuilder.php‡/“R‡ q¶APHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Matcher.php´&/“R´&$q¶JPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/InvocationMocker.php/“Rfû¬¶KPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Invocation/Static.phpF/“RF (ü™¶KPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Invocation/Object.php - /“R - ­Ò¥‹¶EPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/Return.phpÇ /“RÇ #£àʶPPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/MatcherCollection.phpj /“Rj ÍôÙ_¶MPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/ReturnArgument.phpm /“Rm #D j¶IPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/ReturnSelf.php˜ /“R˜ pžWʶHPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/Exception.phpb /“Rb +«`¶OPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/ConsecutiveCalls.php /“R ì®G—¶MPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/ReturnCallback.phpû /“Rû ’+­¶MPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub/ReturnValueMap.phpê /“Rê `ËY¸¶DPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Verifiable.php /“R |¶DPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Invocation.phpö /“Rö ²7ù°¶>PHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Stub.php] /“R] ¹…íǶQPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Builder/ParametersMatch.phpi/“Ri’9¶GPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Builder/Match.phpx /“Rx h“þ¶RPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Builder/InvocationMocker.phpÄ/“RÄ–*¬b¶KPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Builder/Namespace.phpŽ /“RŽ ÃG“¶QPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Builder/MethodNameMatch.php /“R ·6»¶JPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Builder/Identity.phpý /“Rý ÊÚh_¶FPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/Builder/Stub.phpË /“RË 0üĶDPHPUnit_MockObject-1.2.3/PHPUnit/Framework/MockObject/MockObject.php¡/“R¡ǧü4¶+PHPUnit_MockObject-1.2.3/ChangeLog.markdownã/“RãU¬z¶PHPUnit_Selenium-1.3.1/LICENSE/“Rvç Þ¶?PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/SeleniumTestSuite.phpD/“RDrF™¶?PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase.phpéA/“RéA­LT϶EPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/SeleniumTestCase/Driver.phpR«/“RR«År°¶BPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/SeleniumBrowserSuite.phpæ/“Ræ¤È3”¶>PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/SeleniumTestCase.php¢–/“R¢–B Ãó¶RPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Css.php] /“R] _ç4@¶^PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/GenericAccessor.php] -/“R] -Édް¶UPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Equals.phpT /“RT ³g—›¶ZPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/GenericPost.phpK -/“RK -²û¬š¶TPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Value.phpƒ -/“Rƒ -¤º¶XPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Attribute.phph /“Rh (‡¿$¶TPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Click.php -/“R -´à&¶JPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/KeysHolder.php/“R)˪p¶PPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Element/Accessor.php¶/“R¶›!.¡¶NPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Element/Select.php0/“R0þO®¨¶GPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Command.php@ /“R@ [·ÞL¶IPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Exception.php× /“R× 2 -´c¶FPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Driver.php"/“R":0Üx¶LPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/StateCommand.phpk -/“Rk -›O©¶HPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Response.phpF /“RF ü y̶SPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/NoSeleniumException.php¹ /“R¹ -d}L¶RPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/WebDriverException.phpZ /“RZ -Àd°¶GPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Session.php2,/“R2,ªI¶XPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionStrategy/Isolated.php† /“R† 6™¥‡¶VPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionStrategy/Shared.php</“R<NÕR¶FPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Window.phpC /“RC óê+¶CPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/URL.php/“RRrê¶DPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Keys.php=/“R=ž¢¶OPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Session/Storage.php, /“R, é®Þ¶NPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Session/Cookie.phpñ/“Rñ<9.D¶VPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Session/Cookie/Builder.php/“RY¦n…¶PPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Session/Timeouts.phpM/“RMñ`â¶OPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionStrategy.php• /“R• R$³r¶OPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ElementCriteria.phpB /“RB xÄA\¶WPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Location.php¿ /“R¿ Èâ>•¶[PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/DismissAlert.php* -/“R* -漩/¶TPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Frame.phpª /“Rª ¶´Û¶^PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/GenericAccessor.phpH -/“RH -2ï µ¶RPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Url.php /“R ;¦JÛ¶XPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/AlertText.php7 /“R7 Hÿxs¶UPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Window.phpÐ -/“RÐ -Kaö¶SPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Keys.php/“R³ßF¶UPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/MoveTo.php„ /“R„ z–]¶_PHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/GenericAttribute.php“ -/“R“ -ì”â¶ZPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/AcceptAlert.php% -/“R% -OÎâ¶ZPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Orientation.phpÎ /“RÎ `Ö¸¶TPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Click.php¯ /“R¯ àɿ߶RPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/ScreenshotListener.php{/“R{6;ÁE¶GPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/Element.php½/“R½fFÄ:¶NPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/CommandsHolder.php¿/“R¿õ"Õ¶IPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/Selenium2TestCase/WaitUntil.phpx/“Rx §|†¶DPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/SeleniumCommon/prepend.phpê -/“Rê -ª%Ù±¶KPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/SeleniumCommon/RemoteCoverage.php>/“R>*dBʶMPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/SeleniumCommon/phpunit_coverage.php¥ /“R¥ ow™¶CPHPUnit_Selenium-1.3.1/PHPUnit/Extensions/SeleniumCommon/append.php /“R ›·ú÷¶)PHPUnit_Selenium-1.3.1/ChangeLog.markdown/“Rª*Ån¶DbUnit-1.2.3/dbunit.batn/“Rnq{Oª¶DbUnit-1.2.3/LICENSE/“RÓ î ¶IDbUnit-1.2.3/PHPUnit/Extensions/Database/DB/DefaultDatabaseConnection.phpý/“Rý0ë¶5DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/Table.php /“R (ZjK¶9DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/IMetaData.php*/“R*æX¶=DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/TableIterator.php~/“R~Hê"ñ¶CDbUnit-1.2.3/PHPUnit/Extensions/Database/DB/IDatabaseConnection.phpˆ/“Rˆ^p²¶7DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/DataSet.phpÑ/“RÑ?>–õ¶?DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/FilteredDataSet.phpA /“RA Ê‚‚:¶JDbUnit-1.2.3/PHPUnit/Extensions/Database/DB/MetaData/InformationSchema.phpÃ/“RÃdGT6¶<DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/MetaData/Oci.phpJ/“RJ®×[¶>DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/MetaData/PgSQL.phpv/“Rvyr¡-¶?DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/MetaData/Sqlite.php/“R³Û†&¶>DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/MetaData/MySQL.phpÊ/“RÊ÷§­Æ¶?DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/MetaData/SqlSrv.php™/“R™‡b“2¶=DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/TableMetaData.php /“R ÞYó%¶>DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/ResultSetTable.phpÝ /“RÝ žÎô -¶8DbUnit-1.2.3/PHPUnit/Extensions/Database/DB/MetaData.php±/“R±³„þʶ5DbUnit-1.2.3/PHPUnit/Extensions/Database/TestCase.php%/“R%ë×Ü=¶7DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/Command.phpF /“RF ËìÌW¶7DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/IMedium.phpM /“RM b£»Å¶MDbUnit-1.2.3/PHPUnit/Extensions/Database/UI/Modes/ExportDataSet/Arguments.php/“R#_Ñü¶CDbUnit-1.2.3/PHPUnit/Extensions/Database/UI/Modes/ExportDataSet.phpï/“Rï|àÍ ¶;DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/ModeFactory.php/“R?Š_"¶<DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/Mediums/Text.php•/“R•|ªJÁ¶7DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/Context.php /“R Ñ«’¶DDbUnit-1.2.3/PHPUnit/Extensions/Database/UI/InvalidModeException.phpÀ /“RÀ LFi¶5DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/IMode.php± -/“R± -¿W;¶>DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/IMediumPrinter.php£ -/“R£ -{4J˶<DbUnit-1.2.3/PHPUnit/Extensions/Database/UI/IModeFactory.phpè -/“Rè -cg]9¶@DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Exception.php¾/“R¾ò¾h¶=DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Delete.php÷ /“R÷ …›¦~¶=DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Insert.phpÍ/“RÍÌ~Ìù¶?DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/RowBased.php6/“R6~ -JN¶@DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/DeleteAll.php– /“R– n{¶=DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Update.php›/“R›ã3f€¶;DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Null.phpˆ -/“Rˆ -Õ˜MX¶IDbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/IDatabaseOperation.phpÇ /“RÇ >k´¶@DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Composite.phpƒ/“RƒöJ¶?DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Truncate.php² /“R² ¦kJ­¶>DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Replace.phpQ/“RQÎçȶ>DbUnit-1.2.3/PHPUnit/Extensions/Database/Operation/Factory.php¬/“R¬šÝÙ¶6DbUnit-1.2.3/PHPUnit/Extensions/Database/Exception.phpþ /“Rþ àY?¤¶DDbUnit-1.2.3/PHPUnit/Extensions/Database/Constraint/TableIsEqual.phpX/“RX}¼¶FDbUnit-1.2.3/PHPUnit/Extensions/Database/Constraint/DataSetIsEqual.phpf/“RfáÁTu¶EDbUnit-1.2.3/PHPUnit/Extensions/Database/Constraint/TableRowCount.phpW /“RW wV±¶BDbUnit-1.2.3/PHPUnit/Extensions/Database/IDatabaseListConsumer.php5 -/“R5 -ê—§c¶ADbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/QueryDataSet.phpc/“Rc{É.G¶DDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/MysqlXmlDataSet.php#/“R#Ó^N¦¶?DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/QueryTable.phpô/“Rô¾žÑG¶:DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/ISpec.php} -/“R} -šííû¶HDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/TableMetaDataFilter.php/“RîkOͶGDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/AbstractXmlDataSet.phpÇ/“RÇ]Õ喝;DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/ITable.php /“R }¬"¶ADbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/DefaultTable.phpx/“RxU—9œ¶MDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/ReplacementTableIterator.php„/“R„V(ß ¶GDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/ReplacementDataSet.phpT/“RT»øÅʶ=DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/IDataSet.phpÄ /“RÄ V€?¶CDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/DefaultDataSet.php‹ /“R‹ óª¶EDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/ReplacementTable.php/“R%Íï®¶BDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/AbstractTable.phpÊ/“RÊ4RçO¶CDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/ITableIterator.phpþ -/“Rþ -²’¶?DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/CsvDataSet.phpÌ/“RÌc4]¶IDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/DefaultTableMetaData.php– /“R– î8`¶?DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/Yaml.php§ /“R§ ˆ"Šî¶>DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/Xml.php¡ /“R¡ H%z}¶CDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/IFactory.phpE -/“RE -Pº—¶>DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/Csv.phpU/“RUhçB›¶BDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/DbTable.phpx/“Rx>ÜëжBDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/DbQuery.phpÓ/“RÓ4¶BDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/FlatXml.php» /“R» hë*¶BDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Specs/Factory.php³ /“R³ PúÙ»¶IDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/DefaultTableIterator.phpŠ/“RŠù< ¶BDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/DataSetFilter.php -/“R -•”¸7¶CDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/ITableMetaData.php, /“R, Înùû¶DDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/AbstractDataSet.php/“R¿ÙK¶?DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/XmlDataSet.php¸/“R¸þl •¶DDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Persistors/Yaml.phpá/“Rárñ¤¹¶CDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Persistors/Xml.php -/“R -_ð¶HDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Persistors/MysqlXml.php¸/“R¸V÷?I¶HDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Persistors/Abstract.phpç/“Rç;ÓŽ@¶GDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Persistors/FlatXml.php^/“R^m ×ã¶GDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/Persistors/Factory.phpÄ /“RÄ käV@¶ADbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/IPersistable.phpˆ -/“Rˆ -R®¼Î¶CDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/FlatXmlDataSet.phpJ/“RJÉ٠ζEDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/CompositeDataSet.php;/“R;|Qñù¶@DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/YamlDataSet.php÷/“R÷úc¶JDbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/AbstractTableMetaData.phpÜ/“Rܳ'nn¶@DbUnit-1.2.3/PHPUnit/Extensions/Database/DataSet/TableFilter.php°/“R°PÈ'¶;DbUnit-1.2.3/PHPUnit/Extensions/Database/AbstractTester.php/“R Ußé¶:DbUnit-1.2.3/PHPUnit/Extensions/Database/DefaultTester.php£ /“R£ ¹B»¶4DbUnit-1.2.3/PHPUnit/Extensions/Database/ITester.phpž/“RžÝ¿$¶DbUnit-1.2.3/ChangeLog.markdown /“R /¤]W¶DbUnit-1.2.3/dbunit.phpu/“Rudizt¶=DbUnit-1.2.3/Samples/BankAccountDB/BankAccountDBTestMySQL.phpò/“RòsãDÛ¶LDbUnit-1.2.3/Samples/BankAccountDB/_files/bank-account-after-new-account.xmlQ/“RQüÂ)¶IDbUnit-1.2.3/Samples/BankAccountDB/_files/bank-account-after-deposits.xml/“RCP$ƶLDbUnit-1.2.3/Samples/BankAccountDB/_files/bank-account-after-withdrawals.xml -/“R -':ݶ?DbUnit-1.2.3/Samples/BankAccountDB/_files/bank-account-seed.xml /“R ›Yaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/sfObjects.yml/“Rè<öGYaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/YtsNullsAndEmpties.yml«/“R«×>;¥¶<Yaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml÷/“R÷U“¶>Yaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/sfCompact.ymlU /“RU Ó¯¶BYaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.ymlq/“Rqtõür¶FYaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/escapedCharacters.ymlõ/“Rõá*£Â¶MYaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/YtsSpecificationExamples.yml0¢/“R0¢,x`k¶BYaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/YtsBasicTests.ymlô/“RôçõXœ¶GYaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/YtsFlowCollections.ymlX/“RXZ{kì¶?Yaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml/“RZÀܶ?Yaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml/“R@ÖÛï¶EYaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/YtsTypeTransfers.ymlä/“Rä€T -¯¶DYaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/YtsBlockMapping.yml—/“R—Œ¼õ¶CYaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/YtsAnchorAlias.yml[/“R[á5ÒR¶?Yaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/sfMergeKey.ymlJ/“RJ;:šQ¶IYaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/YtsDocumentSeparator.ymlú/“Rú%MC¶=Yaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/sfQuotes.ymlå/“Råˆì„¶:Yaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/index.yml8/“R8£ôܶEYaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/YtsFoldedScalars.ymlz/“Rzګغ¶JYaml-2.2.0/Symfony/Component/Yaml/Tests/Fixtures/unindentedCollections.yml-/“R-Çè¶/Yaml-2.2.0/Symfony/Component/Yaml/composer.jsonÓ/“RÓæùßF¶,Yaml-2.2.0/Symfony/Component/Yaml/.gitignore#/“R#Ü0å¶)Yaml-2.2.0/Symfony/Component/Yaml/LICENSE)/“R)NmòQ¶,Yaml-2.2.0/Symfony/Component/Yaml/Dumper.php” /“R” 8¹n¶0Yaml-2.2.0/Symfony/Component/Yaml/autoloader.phpú/“RúçU2¾¶2Yaml-2.2.0/Symfony/Component/Yaml/phpunit.xml.dist3/“R3ø>[¶>Yaml-2.2.0/Symfony/Component/Yaml/Exception/ParseException.php9 /“R9 ^Ÿ[¶BYaml-2.2.0/Symfony/Component/Yaml/Exception/ExceptionInterface.phpÆ/“RÆî+­l¶@Yaml-2.2.0/Symfony/Component/Yaml/Exception/RuntimeException.phpð/“RðÏ|-¶=Yaml-2.2.0/Symfony/Component/Yaml/Exception/DumpException.phpÒ/“RÒؙ՚¶,Yaml-2.2.0/Symfony/Component/Yaml/Parser.phpX/“RXÞHñ?¶/Yaml-2.2.0/Symfony/Component/Yaml/Unescaper.php™/“R™аÂn¶+Yaml-2.2.0/Symfony/Component/Yaml/README.mda/“RaŸ•#X¶,Yaml-2.2.0/Symfony/Component/Yaml/Inline.php¨>/“R¨>ßhàâ¶-Yaml-2.2.0/Symfony/Component/Yaml/Escaper.phpi /“Ri á¼¶.Yaml-2.2.0/Symfony/Component/Yaml/CHANGELOG.md²/“R²XÁl¶!PHPUnit/Framework/TestFailure.phpŸ/“RŸy…x˶'PHPUnit/Framework/ComparatorFactory.phpI/“RIèØZ\¶+PHPUnit/Framework/SkippedTestSuiteError.php: -/“R: -õ±c¶PHPUnit/Framework/Assert.phpJe/“RJe$—z¶PHPUnit/Framework/TestCase.php·Ò/“R·Ò*õͶ&PHPUnit/Framework/Assert/Functions.php ú/“R úÆ­ì8¶)PHPUnit/Framework/Assert/Functions.php.inå/“Rådx˜û¶)PHPUnit/Framework/IncompleteTestError.php9 -/“R9 -—do¶!PHPUnit/Framework/OutputError.php -/“R -ŠCÐg¶PHPUnit/Framework/Exception.php¬ /“R¬ ¿/`?¶PHPUnit/Framework/Warning.php5/“R5ež¶'PHPUnit/Framework/ComparisonFailure.php­/“R­ëÄM¶&PHPUnit/Framework/SkippedTestError.php/ -/“R/ -aà,*¶3PHPUnit/Framework/Constraint/ObjectHasAttribute.phpL /“RL »;2¶*PHPUnit/Framework/Constraint/PCREMatch.phpJ/“RJeâm¶.PHPUnit/Framework/Constraint/ExceptionCode.phpy/“Ry)V»¶-PHPUnit/Framework/Constraint/IsInstanceOf.phpã/“Rãc§¨ý¶)PHPUnit/Framework/Constraint/SameSize.php /“R !n+‘¶(PHPUnit/Framework/Constraint/IsEqual.php–/“R–çZȶ'PHPUnit/Framework/Constraint/IsNull.php /“R 8®î$¶'PHPUnit/Framework/Constraint/IsJson.phpÂ/“RÂxVZP¶'PHPUnit/Framework/Constraint/IsTrue.php /“R ,+ÜͶ,PHPUnit/Framework/Constraint/ArrayHasKey.php™/“R™'ÑFÙ¶,PHPUnit/Framework/Constraint/IsIdentical.phpI/“RIÝ¢é¶*PHPUnit/Framework/Constraint/Exception.phpD/“RD-xDɶ$PHPUnit/Framework/Constraint/And.phpÎ/“RÎQ¨ï€¶8PHPUnit/Framework/Constraint/TraversableContainsOnly.phpI/“RIê L½¶)PHPUnit/Framework/Constraint/Callback.php{/“R{‚Q™c¶$PHPUnit/Framework/Constraint/Not.phpc/“Rc`ü:¶2PHPUnit/Framework/Constraint/ClassHasAttribute.phpC/“RC­¤ô“¶APHPUnit/Framework/Constraint/JsonMatches/ErrorMessageProvider.php›/“R›nY¤¶,PHPUnit/Framework/Constraint/GreaterThan.phpY /“RY c׆¶+PHPUnit/Framework/Constraint/IsAnything.php /“R ZèµM¶/PHPUnit/Framework/Constraint/StringContains.phpÂ/“RÂõÂdj¶4PHPUnit/Framework/Constraint/TraversableContains.php/“R­µ÷¶)PHPUnit/Framework/Constraint/LessThan.phpP /“RP >”–µ¶.PHPUnit/Framework/Constraint/StringMatches.php;/“R;$–n:¶*PHPUnit/Framework/Constraint/Composite.php/“RG$a|¶1PHPUnit/Framework/Constraint/ExceptionMessage.php[/“R[h¢9¶+PHPUnit/Framework/Constraint/FileExists.phpY/“RYCÅ”©¶*PHPUnit/Framework/Constraint/Attribute.php/“RÞ ¶#PHPUnit/Framework/Constraint/Or.php/“R¸Å+¶/PHPUnit/Framework/Constraint/StringEndsWith.phpg /“Rg qR ¥¶8PHPUnit/Framework/Constraint/ClassHasStaticAttribute.php)/“R)Òîi¶(PHPUnit/Framework/Constraint/IsFalse.php$ /“R$ c{ðR¶1PHPUnit/Framework/Constraint/StringStartsWith.phpV /“RV u/<¿¶,PHPUnit/Framework/Constraint/JsonMatches.php/“Rùª$¸¶(PHPUnit/Framework/Constraint/IsEmpty.phpj/“RjØ·Eò¶&PHPUnit/Framework/Constraint/Count.phpþ/“Rþï‡È)¶$PHPUnit/Framework/Constraint/Xor.phpy/“Ry%(í¶'PHPUnit/Framework/Constraint/IsType.phpÏ/“RÏÈZ-Ÿ¶ PHPUnit/Framework/Constraint.php‹/“R‹¶PHP_Timer-1.0.5/README.md9/“R9¿Å¶,PHP_CodeCoverage-1.2.12/PHP/CodeCoverage.php*Y/“R*Y0:*U¶GPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Util/InvalidArgumentHelper.phpW /“RW “Y½)¶:PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Driver/Xdebug.php¿ /“R¿ ¦ei¶1PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Util.phpË'/“RË'jý¼š¶6PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Exception.phpú /“Rú -u:¶3PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Driver.php¸ -/“R¸ -n …¶3PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Filter.phpí'/“Rí'[‘µí¶4PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Version.php< /“R< ¨ÏY¶8PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/Node.php*%/“R*%’B©ó¶=PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/Node/File.phpR/“RR\-¡Ç¶APHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/Node/Iterator.php/“Ru¾¶BPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/Node/Directory.php#0/“R#03µ¶APHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer.phpˆ#/“Rˆ#^Qš¶FPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/File.phpQT/“RQT¯€0Ͷ]PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/coverage_bar.html.distŽ/“RŽ­¾¶cPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/img/glyphicons-halflings.pngÿ1/“Rÿ1ëV(F¶iPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/img/glyphicons-halflings-white.pngI"/“RI"¤‹€C¶ZPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/file_item.html.dist;/“R;rS¶ZPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/directory.html.dist˜/“R˜Àp¬W¶\PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/css/bootstrap.min.css’“/“R’“®ñak¶gPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/css/bootstrap-responsive.min.css©@/“R©@¢±÷T¶TPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/css/style.cssq/“Rq -¹*µ¶_PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/directory_item.html.dist /“R -“,—¶\PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/method_item.html.distX/“RX%ŽJ¶UPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/file.html.dist/“R´`Öâ¶ZPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/js/bootstrap.min.jsl{/“Rl{áôš¶VPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/js/html5shiv.jsH /“RH «Õß¶WPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/js/highcharts.jsåä/“Råä~K&¶WPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/js/jquery.min.jsÕi/“RÕi´v„¶ZPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Template/dashboard.html.dist /“R €·H¶KPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Directory.phpŽ/“RŽ[ »J¶KPHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML/Renderer/Dashboard.php¥/“R¥/MKU¶8PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/HTML.php/“RÀáz¥¶7PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/PHP.php{ /“R{ ð=Œ¶8PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/Text.php6+/“R6+ 8R¶:PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/Clover.phpÍ2/“RÍ2)†Ö¶;PHP_CodeCoverage-1.2.12/PHP/CodeCoverage/Report/Factory.php2/“R2Õö[î¶PHP_CodeCoverage-1.2.12/LICENSE/“R–õw!¶%Text_Template-1.1.4/Text/Template.phpµ/“RµW¹–y¶Text_Template-1.1.4/LICENSE/“RŒÐrȶ&Text_Template-1.1.4/ChangeLog.markdownŒ/“RŒœø‡÷¶#Text_Template-1.1.4/README.markdownF/“RF™Q¶File_Iterator - -Copyright (c) 2009-2012, Sebastian Bergmann . -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of Sebastian Bergmann nor the names of his - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -File_Iterator 1.3 -================= - -This is the list of changes for the File_Iterator 1.3 release series. - -File_Iterator 1.3.3 -------------------- - -* No changes. - -File_Iterator 1.3.2 -------------------- - -* No changes. - -File_Iterator 1.3.1 -------------------- - -* Fixed infinite loop in `File_Iterator_Facade::getCommonPath()` for empty directories. - -File_Iterator 1.3.0 -------------------- - -* Added `File_Iterator_Facade` for the most common use case. -* Moved `File_Iterator_Factory::getFilesAsArray()` to `File_Iterator_Facade::getFilesAsArray()`. -* `File_Iterator_Factory` is no longer static. -File_Iterator -============= - -Installation ------------- - -File_Iterator should be installed using the [PEAR Installer](http://pear.php.net/). This installer is the backbone of PEAR, which provides a distribution system for PHP packages, and is shipped with every release of PHP since version 4.3.0. - -The PEAR channel (`pear.phpunit.de`) that is used to distribute File_Iterator needs to be registered with the local PEAR environment: - - sb@ubuntu ~ % pear channel-discover pear.phpunit.de - Adding Channel "pear.phpunit.de" succeeded - Discovery of channel "pear.phpunit.de" succeeded - -This has to be done only once. Now the PEAR Installer can be used to install packages from the PHPUnit channel: - - sb@vmware ~ % pear install phpunit/File_Iterator - downloading File_Iterator-1.1.1.tgz ... - Starting to download File_Iterator-1.1.1.tgz (3,173 bytes) - ....done: 3,173 bytes - install ok: channel://pear.phpunit.de/File_Iterator-1.1.1 - -After the installation you can find the File_Iterator source files inside your local PEAR directory; the path is usually `/usr/lib/php/File`. -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package File - * @author Sebastian Bergmann - * @copyright 2009-2012 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @since File available since Release 1.0.0 - */ - -/** - * FilterIterator implementation that filters files based on prefix(es) and/or - * suffix(es). Hidden files and files from hidden directories are also filtered. - * - * @author Sebastian Bergmann - * @copyright 2009-2012 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.3 - * @link http://github.com/sebastianbergmann/php-file-iterator/tree - * @since Class available since Release 1.0.0 - */ -class File_Iterator extends FilterIterator -{ - const PREFIX = 0; - const SUFFIX = 1; - - /** - * @var array - */ - protected $suffixes = array(); - - /** - * @var array - */ - protected $prefixes = array(); - - /** - * @var array - */ - protected $exclude = array(); - - /** - * @var string - */ - protected $basepath; - - /** - * @param Iterator $iterator - * @param array $suffixes - * @param array $prefixes - * @param array $exclude - * @param string $basepath - */ - public function __construct(Iterator $iterator, array $suffixes = array(), array $prefixes = array(), array $exclude = array(), $basepath = NULL) - { - $exclude = array_filter(array_map('realpath', $exclude)); - - if ($basepath !== NULL) { - $basepath = realpath($basepath); - } - - if ($basepath === FALSE) { - $basepath = NULL; - } else { - foreach ($exclude as &$_exclude) { - $_exclude = str_replace($basepath, '', $_exclude); - } - } - - $this->prefixes = $prefixes; - $this->suffixes = $suffixes; - $this->exclude = $exclude; - $this->basepath = $basepath; - - parent::__construct($iterator); - } - - /** - * @return boolean - */ - public function accept() - { - $current = $this->getInnerIterator()->current(); - $filename = $current->getFilename(); - $realpath = $current->getRealPath(); - - if ($this->basepath !== NULL) { - $realpath = str_replace($this->basepath, '', $realpath); - } - - // Filter files in hidden directories. - if (preg_match('=/\.[^/]*/=', $realpath)) { - return FALSE; - } - - return $this->acceptPath($realpath) && - $this->acceptPrefix($filename) && - $this->acceptSuffix($filename); - } - - /** - * @param string $path - * @return boolean - * @since Method available since Release 1.1.0 - */ - protected function acceptPath($path) - { - foreach ($this->exclude as $exclude) { - if (strpos($path, $exclude) === 0) { - return FALSE; - } - } - - return TRUE; - } - - /** - * @param string $filename - * @return boolean - * @since Method available since Release 1.1.0 - */ - protected function acceptPrefix($filename) - { - return $this->acceptSubString($filename, $this->prefixes, self::PREFIX); - } - - /** - * @param string $filename - * @return boolean - * @since Method available since Release 1.1.0 - */ - protected function acceptSuffix($filename) - { - return $this->acceptSubString($filename, $this->suffixes, self::SUFFIX); - } - - /** - * @param string $filename - * @param array $subString - * @param integer $type - * @return boolean - * @since Method available since Release 1.1.0 - */ - protected function acceptSubString($filename, array $subStrings, $type) - { - if (empty($subStrings)) { - return TRUE; - } - - $matched = FALSE; - - foreach ($subStrings as $string) { - if (($type == self::PREFIX && strpos($filename, $string) === 0) || - ($type == self::SUFFIX && - substr($filename, -1 * strlen($string)) == $string)) { - $matched = TRUE; - break; - } - } - - return $matched; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package File - * @author Sebastian Bergmann - * @copyright 2009-2012 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @since File available since Release 1.3.0 - */ - -/** - * Façade implementation that uses File_Iterator_Factory to create a - * File_Iterator that operates on an AppendIterator that contains an - * RecursiveDirectoryIterator for each given path. The list of unique - * files is returned as an array. - * - * @author Sebastian Bergmann - * @copyright 2009-2012 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.3 - * @link http://github.com/sebastianbergmann/php-file-iterator/tree - * @since Class available since Release 1.3.0 - */ -class File_Iterator_Facade -{ - /** - * @param array|string $paths - * @param array|string $suffixes - * @param array|string $prefixes - * @param array $exclude - * @param boolean $commonPath - * @return array - */ - public function getFilesAsArray($paths, $suffixes = '', $prefixes = '', array $exclude = array(), $commonPath = FALSE) - { - if (is_string($paths)) { - $paths = array($paths); - } - - $factory = new File_Iterator_Factory; - $iterator = $factory->getFileIterator( - $paths, $suffixes, $prefixes, $exclude - ); - - $files = array(); - - foreach ($iterator as $file) { - $file = $file->getRealPath(); - - if ($file) { - $files[] = $file; - } - } - - foreach ($paths as $path) { - if (is_file($path)) { - $files[] = realpath($path); - } - } - - $files = array_unique($files); - sort($files); - - if ($commonPath) { - return array( - 'commonPath' => $this->getCommonPath($files), - 'files' => $files - ); - } else { - return $files; - } - } - - /** - * Returns the common path of a set of files. - * - * @param array $files - * @return string - */ - protected function getCommonPath(array $files) - { - $count = count($files); - - if ($count == 0) { - return ''; - } - - if ($count == 1) { - return dirname($files[0]) . DIRECTORY_SEPARATOR; - } - - $_files = array(); - - foreach ($files as $file) { - $_files[] = $_fileParts = explode(DIRECTORY_SEPARATOR, $file); - - if (empty($_fileParts[0])) { - $_fileParts[0] = DIRECTORY_SEPARATOR; - } - } - - $common = ''; - $done = FALSE; - $j = 0; - $count--; - - while (!$done) { - for ($i = 0; $i < $count; $i++) { - if ($_files[$i][$j] != $_files[$i+1][$j]) { - $done = TRUE; - break; - } - } - - if (!$done) { - $common .= $_files[0][$j]; - - if ($j > 0) { - $common .= DIRECTORY_SEPARATOR; - } - } - - $j++; - } - - return DIRECTORY_SEPARATOR . $common; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package File - * @author Sebastian Bergmann - * @copyright 2009-2012 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @since File available since Release 1.1.0 - */ - -/** - * Factory Method implementation that creates a File_Iterator that operates on - * an AppendIterator that contains an RecursiveDirectoryIterator for each given - * path. - * - * @author Sebastian Bergmann - * @copyright 2009-2012 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.3 - * @link http://github.com/sebastianbergmann/php-file-iterator/tree - * @since Class available since Release 1.1.0 - */ -class File_Iterator_Factory -{ - /** - * @param array|string $paths - * @param array|string $suffixes - * @param array|string $prefixes - * @param array $exclude - * @return AppendIterator - */ - public function getFileIterator($paths, $suffixes = '', $prefixes = '', array $exclude = array()) - { - if (is_string($paths)) { - $paths = array($paths); - } - - $_paths = array(); - - foreach ($paths as $path) { - if ($locals = glob($path, GLOB_ONLYDIR)) { - $_paths = array_merge($_paths, $locals); - } else { - $_paths[] = $path; - } - } - - $paths = $_paths; - unset($_paths); - - if (is_string($prefixes)) { - if ($prefixes != '') { - $prefixes = array($prefixes); - } else { - $prefixes = array(); - } - } - - if (is_string($suffixes)) { - if ($suffixes != '') { - $suffixes = array($suffixes); - } else { - $suffixes = array(); - } - } - - $iterator = new AppendIterator; - - foreach ($paths as $path) { - if (is_dir($path)) { - $iterator->append( - new File_Iterator( - new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path) - ), - $suffixes, - $prefixes, - $exclude, - $path - ) - ); - } - } - - return $iterator; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHP_TokenStream - * @author Sebastian Bergmann - * @copyright 2009-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @since File available since Release 1.0.0 - */ - -/** - * A stream of PHP tokens. - * - * @author Sebastian Bergmann - * @copyright 2009-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.1.8 - * @link http://github.com/sebastianbergmann/php-token-stream/tree - * @since Class available since Release 1.0.0 - */ -class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator -{ - /** - * @var array - */ - protected static $customTokens = array( - '(' => 'PHP_Token_OPEN_BRACKET', - ')' => 'PHP_Token_CLOSE_BRACKET', - '[' => 'PHP_Token_OPEN_SQUARE', - ']' => 'PHP_Token_CLOSE_SQUARE', - '{' => 'PHP_Token_OPEN_CURLY', - '}' => 'PHP_Token_CLOSE_CURLY', - ';' => 'PHP_Token_SEMICOLON', - '.' => 'PHP_Token_DOT', - ',' => 'PHP_Token_COMMA', - '=' => 'PHP_Token_EQUAL', - '<' => 'PHP_Token_LT', - '>' => 'PHP_Token_GT', - '+' => 'PHP_Token_PLUS', - '-' => 'PHP_Token_MINUS', - '*' => 'PHP_Token_MULT', - '/' => 'PHP_Token_DIV', - '?' => 'PHP_Token_QUESTION_MARK', - '!' => 'PHP_Token_EXCLAMATION_MARK', - ':' => 'PHP_Token_COLON', - '"' => 'PHP_Token_DOUBLE_QUOTES', - '@' => 'PHP_Token_AT', - '&' => 'PHP_Token_AMPERSAND', - '%' => 'PHP_Token_PERCENT', - '|' => 'PHP_Token_PIPE', - '$' => 'PHP_Token_DOLLAR', - '^' => 'PHP_Token_CARET', - '~' => 'PHP_Token_TILDE', - '`' => 'PHP_Token_BACKTICK' - ); - - /** - * @var string - */ - protected $filename; - - /** - * @var array - */ - protected $tokens = array(); - - /** - * @var integer - */ - protected $position = 0; - - /** - * @var array - */ - protected $linesOfCode = array('loc' => 0, 'cloc' => 0, 'ncloc' => 0); - - /** - * @var array - */ - protected $classes; - - /** - * @var array - */ - protected $functions; - - /** - * @var array - */ - protected $includes; - - /** - * @var array - */ - protected $interfaces; - - /** - * @var array - */ - protected $traits; - - /** - * Constructor. - * - * @param string $sourceCode - */ - public function __construct($sourceCode) - { - if (is_file($sourceCode)) { - $this->filename = $sourceCode; - $sourceCode = file_get_contents($sourceCode); - } - - $this->scan($sourceCode); - } - - /** - * Destructor. - */ - public function __destruct() - { - $this->tokens = array(); - } - - /** - * @return string - */ - public function __toString() - { - $buffer = ''; - - foreach ($this as $token) { - $buffer .= $token; - } - - return $buffer; - } - - /** - * @return string - * @since Method available since Release 1.1.0 - */ - public function getFilename() - { - return $this->filename; - } - - /** - * Scans the source for sequences of characters and converts them into a - * stream of tokens. - * - * @param string $sourceCode - */ - protected function scan($sourceCode) - { - $line = 1; - $tokens = token_get_all($sourceCode); - $numTokens = count($tokens); - - for ($i = 0; $i < $numTokens; ++$i) { - $token = $tokens[$i]; - unset($tokens[$i]); - - if (is_array($token)) { - $text = $token[1]; - $tokenClass = 'PHP_Token_' . substr(token_name($token[0]), 2); - } else { - $text = $token; - $tokenClass = self::$customTokens[$token]; - } - - $this->tokens[] = new $tokenClass($text, $line, $this, $i); - $lines = substr_count($text, "\n"); - $line += $lines; - - if ($tokenClass == 'PHP_Token_HALT_COMPILER') { - break; - } - - else if ($tokenClass == 'PHP_Token_COMMENT' || - $tokenClass == 'PHP_Token_DOC_COMMENT') { - $this->linesOfCode['cloc'] += $lines + 1; - } - } - - $this->linesOfCode['loc'] = substr_count($sourceCode, "\n"); - $this->linesOfCode['ncloc'] = $this->linesOfCode['loc'] - - $this->linesOfCode['cloc']; - } - - /** - * @return integer - */ - public function count() - { - return count($this->tokens); - } - - /** - * @return PHP_Token[] - */ - public function tokens() - { - return $this->tokens; - } - - /** - * @return array - */ - public function getClasses() - { - if ($this->classes !== NULL) { - return $this->classes; - } - - $this->parse(); - - return $this->classes; - } - - /** - * @return array - */ - public function getFunctions() - { - if ($this->functions !== NULL) { - return $this->functions; - } - - $this->parse(); - - return $this->functions; - } - - /** - * @return array - */ - public function getInterfaces() - { - if ($this->interfaces !== NULL) { - return $this->interfaces; - } - - $this->parse(); - - return $this->interfaces; - } - - /** - * @return array - * @since Method available since Release 1.1.0 - */ - public function getTraits() - { - if ($this->traits !== NULL) { - return $this->traits; - } - - $this->parse(); - - return $this->traits; - } - - /** - * Gets the names of all files that have been included - * using include(), include_once(), require() or require_once(). - * - * Parameter $categorize set to TRUE causing this function to return a - * multi-dimensional array with categories in the keys of the first dimension - * and constants and their values in the second dimension. - * - * Parameter $category allow to filter following specific inclusion type - * - * @param bool $categorize OPTIONAL - * @param string $category OPTIONAL Either 'require_once', 'require', - * 'include_once', 'include'. - * @return array - * @since Method available since Release 1.1.0 - */ - public function getIncludes($categorize = FALSE, $category = NULL) - { - if ($this->includes === NULL) { - $this->includes = array( - 'require_once' => array(), - 'require' => array(), - 'include_once' => array(), - 'include' => array() - ); - - foreach ($this->tokens as $token) { - switch (get_class($token)) { - case 'PHP_Token_REQUIRE_ONCE': - case 'PHP_Token_REQUIRE': - case 'PHP_Token_INCLUDE_ONCE': - case 'PHP_Token_INCLUDE': { - $this->includes[$token->getType()][] = $token->getName(); - } - break; - } - } - } - - if (isset($this->includes[$category])) { - $includes = $this->includes[$category]; - } - - else if ($categorize === FALSE) { - $includes = array_merge( - $this->includes['require_once'], - $this->includes['require'], - $this->includes['include_once'], - $this->includes['include'] - ); - } else { - $includes = $this->includes; - } - - return $includes; - } - - protected function parse() - { - $this->interfaces = array(); - $this->classes = array(); - $this->traits = array(); - $this->functions = array(); - $class = FALSE; - $classEndLine = FALSE; - $trait = FALSE; - $traitEndLine = FALSE; - $interface = FALSE; - $interfaceEndLine = FALSE; - - foreach ($this->tokens as $token) { - switch (get_class($token)) { - case 'PHP_Token_HALT_COMPILER': { - return; - } - break; - - case 'PHP_Token_INTERFACE': { - $interface = $token->getName(); - $interfaceEndLine = $token->getEndLine(); - - $this->interfaces[$interface] = array( - 'methods' => array(), - 'parent' => $token->getParent(), - 'keywords' => $token->getKeywords(), - 'docblock' => $token->getDocblock(), - 'startLine' => $token->getLine(), - 'endLine' => $interfaceEndLine, - 'package' => $token->getPackage(), - 'file' => $this->filename - ); - } - break; - - case 'PHP_Token_CLASS': - case 'PHP_Token_TRAIT': { - $tmp = array( - 'methods' => array(), - 'parent' => $token->getParent(), - 'interfaces'=> $token->getInterfaces(), - 'keywords' => $token->getKeywords(), - 'docblock' => $token->getDocblock(), - 'startLine' => $token->getLine(), - 'endLine' => $token->getEndLine(), - 'package' => $token->getPackage(), - 'file' => $this->filename - ); - - if ($token instanceof PHP_Token_CLASS) { - $class = $token->getName(); - $classEndLine = $token->getEndLine(); - $this->classes[$class] = $tmp; - } else { - $trait = $token->getName(); - $traitEndLine = $token->getEndLine(); - $this->traits[$trait] = $tmp; - } - } - break; - - case 'PHP_Token_FUNCTION': { - $name = $token->getName(); - $tmp = array( - 'docblock' => $token->getDocblock(), - 'keywords' => $token->getKeywords(), - 'visibility'=> $token->getVisibility(), - 'signature' => $token->getSignature(), - 'startLine' => $token->getLine(), - 'endLine' => $token->getEndLine(), - 'ccn' => $token->getCCN(), - 'file' => $this->filename - ); - - if ($class === FALSE && - $trait === FALSE && - $interface === FALSE) { - $this->functions[$name] = $tmp; - } - - else if ($class !== FALSE) { - $this->classes[$class]['methods'][$name] = $tmp; - } - - else if ($trait !== FALSE) { - $this->traits[$trait]['methods'][$name] = $tmp; - } - - else { - $this->interfaces[$interface]['methods'][$name] = $tmp; - } - } - break; - - case 'PHP_Token_CLOSE_CURLY': { - if ($classEndLine !== FALSE && - $classEndLine == $token->getLine()) { - $class = FALSE; - $classEndLine = FALSE; - } - - else if ($traitEndLine !== FALSE && - $traitEndLine == $token->getLine()) { - $trait = FALSE; - $traitEndLine = FALSE; - } - - else if ($interfaceEndLine !== FALSE && - $interfaceEndLine == $token->getLine()) { - $interface = FALSE; - $interfaceEndLine = FALSE; - } - } - break; - } - } - } - - /** - * @return array - */ - public function getLinesOfCode() - { - return $this->linesOfCode; - } - - /** - */ - public function rewind() - { - $this->position = 0; - } - - /** - * @return boolean - */ - public function valid() - { - return isset($this->tokens[$this->position]); - } - - /** - * @return integer - */ - public function key() - { - return $this->position; - } - - /** - * @return PHP_Token - */ - public function current() - { - return $this->tokens[$this->position]; - } - - /** - */ - public function next() - { - $this->position++; - } - - /** - * @param mixed $offset - */ - public function offsetExists($offset) - { - return isset($this->tokens[$offset]); - } - - /** - * @param mixed $offset - * @return mixed - */ - public function offsetGet($offset) - { - return $this->tokens[$offset]; - } - - /** - * @param mixed $offset - * @param mixed $value - */ - public function offsetSet($offset, $value) - { - $this->tokens[$offset] = $value; - } - - /** - * @param mixed $offset - */ - public function offsetUnset($offset) - { - unset($this->tokens[$offset]); - } - - /** - * Seek to an absolute position. - * - * @param integer $position - * @throws OutOfBoundsException - */ - public function seek($position) - { - $this->position = $position; - - if (!$this->valid()) { - throw new OutOfBoundsException('Invalid seek position'); - } - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHP_TokenStream - * @author Sebastian Bergmann - * @copyright 2009-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @since File available since Release 1.0.0 - */ - -/** - * A caching factory for token stream objects. - * - * @author Sebastian Bergmann - * @copyright 2009-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.1.8 - * @link http://github.com/sebastianbergmann/php-token-stream/tree - * @since Class available since Release 1.0.0 - */ -class PHP_Token_Stream_CachingFactory -{ - /** - * @var array - */ - protected static $cache = array(); - - /** - * @param string $filename - * @return PHP_Token_Stream - */ - public static function get($filename) - { - if (!isset(self::$cache[$filename])) { - self::$cache[$filename] = new PHP_Token_Stream($filename); - } - - return self::$cache[$filename]; - } - - /** - * @param string $filename - */ - public static function clear($filename = NULL) - { - if (is_string($filename)) { - unset(self::$cache[$filename]); - } else { - self::$cache = array(); - } - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHP_TokenStream - * @author Sebastian Bergmann - * @copyright 2009-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @since File available since Release 1.0.0 - */ - -/** - * A PHP token. - * - * @author Sebastian Bergmann - * @copyright 2009-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.1.8 - * @link http://github.com/sebastianbergmann/php-token-stream/tree - * @since Class available since Release 1.0.0 - */ -abstract class PHP_Token -{ - /** - * @var string - */ - protected $text; - - /** - * @var integer - */ - protected $line; - - /** - * @var PHP_Token_Stream - */ - protected $tokenStream; - - /** - * @var integer - */ - protected $id; - - /** - * Constructor. - * - * @param string $text - * @param integer $line - * @param PHP_Token_Stream $tokenStream - * @param integer $id - */ - public function __construct($text, $line, PHP_Token_Stream $tokenStream, $id) - { - $this->text = $text; - $this->line = $line; - $this->tokenStream = $tokenStream; - $this->id = $id; - } - - /** - * @return string - */ - public function __toString() - { - return $this->text; - } - - /** - * @return integer - */ - public function getLine() - { - return $this->line; - } -} - -abstract class PHP_TokenWithScope extends PHP_Token -{ - protected $endTokenId; - - /** - * Get the docblock for this token - * - * This method will fetch the docblock belonging to the current token. The - * docblock must be placed on the line directly above the token to be - * recognized. - * - * @return string|null Returns the docblock as a string if found - */ - public function getDocblock() - { - $tokens = $this->tokenStream->tokens(); - $currentLineNumber = $tokens[$this->id]->getLine(); - $prevLineNumber = $currentLineNumber - 1; - - for ($i = $this->id - 1; $i; $i--) { - if (!isset($tokens[$i])) { - return; - } - - if ($tokens[$i] instanceof PHP_Token_FUNCTION || - $tokens[$i] instanceof PHP_Token_CLASS || - $tokens[$i] instanceof PHP_Token_TRAIT) { - // Some other trait, class or function, no docblock can be - // used for the current token - break; - } - - $line = $tokens[$i]->getLine(); - - if ($line == $currentLineNumber || - ($line == $prevLineNumber && - $tokens[$i] instanceof PHP_Token_WHITESPACE)) { - continue; - } - - if ($line < $currentLineNumber && - !$tokens[$i] instanceof PHP_Token_DOC_COMMENT) { - break; - } - - return (string)$tokens[$i]; - } - } - - public function getEndTokenId() - { - $block = 0; - $i = $this->id; - $tokens = $this->tokenStream->tokens(); - - while ($this->endTokenId === NULL && isset($tokens[$i])) { - if ($tokens[$i] instanceof PHP_Token_OPEN_CURLY || - $tokens[$i] instanceof PHP_Token_CURLY_OPEN) { - $block++; - } - - else if ($tokens[$i] instanceof PHP_Token_CLOSE_CURLY) { - $block--; - - if ($block === 0) { - $this->endTokenId = $i; - } - } - - else if (($this instanceof PHP_Token_FUNCTION || - $this instanceof PHP_Token_NAMESPACE) && - $tokens[$i] instanceof PHP_Token_SEMICOLON) { - if ($block === 0) { - $this->endTokenId = $i; - } - } - - $i++; - } - - if ($this->endTokenId === NULL) { - $this->endTokenId = $this->id; - } - - return $this->endTokenId; - } - - public function getEndLine() - { - return $this->tokenStream[$this->getEndTokenId()]->getLine(); - } - -} - -abstract class PHP_TokenWithScopeAndVisibility extends PHP_TokenWithScope { - - public function getVisibility() - { - $tokens = $this->tokenStream->tokens(); - - for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) { - if (isset($tokens[$i]) && - ($tokens[$i] instanceof PHP_Token_PRIVATE || - $tokens[$i] instanceof PHP_Token_PROTECTED || - $tokens[$i] instanceof PHP_Token_PUBLIC)) { - return strtolower( - str_replace('PHP_Token_', '', get_class($tokens[$i])) - ); - } - if (isset($tokens[$i]) && - !($tokens[$i] instanceof PHP_Token_STATIC || - $tokens[$i] instanceof PHP_Token_FINAL || - $tokens[$i] instanceof PHP_Token_ABSTRACT)) { - // no keywords; stop visibility search - break; - } - } - } - - public function getKeywords() - { - $keywords = array(); - $tokens = $this->tokenStream->tokens(); - - for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) { - if (isset($tokens[$i]) && - ($tokens[$i] instanceof PHP_Token_PRIVATE || - $tokens[$i] instanceof PHP_Token_PROTECTED || - $tokens[$i] instanceof PHP_Token_PUBLIC)) { - continue; - } - - if (isset($tokens[$i]) && - ($tokens[$i] instanceof PHP_Token_STATIC || - $tokens[$i] instanceof PHP_Token_FINAL || - $tokens[$i] instanceof PHP_Token_ABSTRACT)) { - $keywords[] = strtolower( - str_replace('PHP_Token_', '', get_class($tokens[$i])) - ); - } - } - - return implode(',', $keywords); - } - -} - -abstract class PHP_Token_Includes extends PHP_Token -{ - protected $name; - protected $type; - - public function getName() - { - if ($this->name !== NULL) { - return $this->name; - } - - $tokens = $this->tokenStream->tokens(); - - if ($tokens[$this->id+2] instanceof PHP_Token_CONSTANT_ENCAPSED_STRING) { - $this->name = trim($tokens[$this->id+2], "'\""); - $this->type = strtolower( - str_replace('PHP_Token_', '', get_class($tokens[$this->id])) - ); - } - - return $this->name; - } - - public function getType() - { - $this->getName(); - return $this->type; - } -} - -class PHP_Token_REQUIRE_ONCE extends PHP_Token_Includes {} -class PHP_Token_REQUIRE extends PHP_Token_Includes {} -class PHP_Token_EVAL extends PHP_Token {} -class PHP_Token_INCLUDE_ONCE extends PHP_Token_Includes {} -class PHP_Token_INCLUDE extends PHP_Token_Includes {} -class PHP_Token_LOGICAL_OR extends PHP_Token {} -class PHP_Token_LOGICAL_XOR extends PHP_Token {} -class PHP_Token_LOGICAL_AND extends PHP_Token {} -class PHP_Token_PRINT extends PHP_Token {} -class PHP_Token_SR_EQUAL extends PHP_Token {} -class PHP_Token_SL_EQUAL extends PHP_Token {} -class PHP_Token_XOR_EQUAL extends PHP_Token {} -class PHP_Token_OR_EQUAL extends PHP_Token {} -class PHP_Token_AND_EQUAL extends PHP_Token {} -class PHP_Token_MOD_EQUAL extends PHP_Token {} -class PHP_Token_CONCAT_EQUAL extends PHP_Token {} -class PHP_Token_DIV_EQUAL extends PHP_Token {} -class PHP_Token_MUL_EQUAL extends PHP_Token {} -class PHP_Token_MINUS_EQUAL extends PHP_Token {} -class PHP_Token_PLUS_EQUAL extends PHP_Token {} -class PHP_Token_BOOLEAN_OR extends PHP_Token {} -class PHP_Token_BOOLEAN_AND extends PHP_Token {} -class PHP_Token_IS_NOT_IDENTICAL extends PHP_Token {} -class PHP_Token_IS_IDENTICAL extends PHP_Token {} -class PHP_Token_IS_NOT_EQUAL extends PHP_Token {} -class PHP_Token_IS_EQUAL extends PHP_Token {} -class PHP_Token_IS_GREATER_OR_EQUAL extends PHP_Token {} -class PHP_Token_IS_SMALLER_OR_EQUAL extends PHP_Token {} -class PHP_Token_SR extends PHP_Token {} -class PHP_Token_SL extends PHP_Token {} -class PHP_Token_INSTANCEOF extends PHP_Token {} -class PHP_Token_UNSET_CAST extends PHP_Token {} -class PHP_Token_BOOL_CAST extends PHP_Token {} -class PHP_Token_OBJECT_CAST extends PHP_Token {} -class PHP_Token_ARRAY_CAST extends PHP_Token {} -class PHP_Token_STRING_CAST extends PHP_Token {} -class PHP_Token_DOUBLE_CAST extends PHP_Token {} -class PHP_Token_INT_CAST extends PHP_Token {} -class PHP_Token_DEC extends PHP_Token {} -class PHP_Token_INC extends PHP_Token {} -class PHP_Token_CLONE extends PHP_Token {} -class PHP_Token_NEW extends PHP_Token {} -class PHP_Token_EXIT extends PHP_Token {} -class PHP_Token_IF extends PHP_Token {} -class PHP_Token_ELSEIF extends PHP_Token {} -class PHP_Token_ELSE extends PHP_Token {} -class PHP_Token_ENDIF extends PHP_Token {} -class PHP_Token_LNUMBER extends PHP_Token {} -class PHP_Token_DNUMBER extends PHP_Token {} -class PHP_Token_STRING extends PHP_Token {} -class PHP_Token_STRING_VARNAME extends PHP_Token {} -class PHP_Token_VARIABLE extends PHP_Token {} -class PHP_Token_NUM_STRING extends PHP_Token {} -class PHP_Token_INLINE_HTML extends PHP_Token {} -class PHP_Token_CHARACTER extends PHP_Token {} -class PHP_Token_BAD_CHARACTER extends PHP_Token {} -class PHP_Token_ENCAPSED_AND_WHITESPACE extends PHP_Token {} -class PHP_Token_CONSTANT_ENCAPSED_STRING extends PHP_Token {} -class PHP_Token_ECHO extends PHP_Token {} -class PHP_Token_DO extends PHP_Token {} -class PHP_Token_WHILE extends PHP_Token {} -class PHP_Token_ENDWHILE extends PHP_Token {} -class PHP_Token_FOR extends PHP_Token {} -class PHP_Token_ENDFOR extends PHP_Token {} -class PHP_Token_FOREACH extends PHP_Token {} -class PHP_Token_ENDFOREACH extends PHP_Token {} -class PHP_Token_DECLARE extends PHP_Token {} -class PHP_Token_ENDDECLARE extends PHP_Token {} -class PHP_Token_AS extends PHP_Token {} -class PHP_Token_SWITCH extends PHP_Token {} -class PHP_Token_ENDSWITCH extends PHP_Token {} -class PHP_Token_CASE extends PHP_Token {} -class PHP_Token_DEFAULT extends PHP_Token {} -class PHP_Token_BREAK extends PHP_Token {} -class PHP_Token_CONTINUE extends PHP_Token {} -class PHP_Token_GOTO extends PHP_Token {} -class PHP_Token_CALLABLE extends PHP_Token {} -class PHP_Token_INSTEADOF extends PHP_Token {} - -class PHP_Token_FUNCTION extends PHP_TokenWithScopeAndVisibility -{ - protected $arguments; - protected $ccn; - protected $name; - protected $signature; - - public function getArguments() - { - if ($this->arguments !== NULL) { - return $this->arguments; - } - - $this->arguments = array(); - $i = $this->id + 2; - $tokens = $this->tokenStream->tokens(); - $typeHint = NULL; - - while (!$tokens[$i] instanceof PHP_Token_CLOSE_BRACKET) { - if ($tokens[$i] instanceof PHP_Token_STRING) { - $typeHint = (string)$tokens[$i]; - } - - else if ($tokens[$i] instanceof PHP_Token_VARIABLE) { - $this->arguments[(string)$tokens[$i]] = $typeHint; - $typeHint = NULL; - } - - $i++; - } - - return $this->arguments; - } - - public function getName() - { - if ($this->name !== NULL) { - return $this->name; - } - - $tokens = $this->tokenStream->tokens(); - - for ($i = $this->id + 1; $i < count($tokens); $i++) { - if ($tokens[$i] instanceof PHP_Token_STRING) { - $this->name = (string)$tokens[$i]; - break; - } - - else if ($tokens[$i] instanceof PHP_Token_AMPERSAND && - $tokens[$i+1] instanceof PHP_Token_STRING) { - $this->name = (string)$tokens[$i+1]; - break; - } - - else if ($tokens[$i] instanceof PHP_Token_OPEN_BRACKET) { - $this->name = 'anonymous function'; - break; - } - } - - if ($this->name != 'anonymous function') { - for ($i = $this->id; $i; --$i) { - if ($tokens[$i] instanceof PHP_Token_NAMESPACE) { - $this->name = $tokens[$i]->getName() . '\\' . $this->name; - break; - } - - if ($tokens[$i] instanceof PHP_Token_INTERFACE) { - break; - } - } - } - - return $this->name; - } - - public function getCCN() - { - if ($this->ccn !== NULL) { - return $this->ccn; - } - - $this->ccn = 1; - $end = $this->getEndTokenId(); - $tokens = $this->tokenStream->tokens(); - - for ($i = $this->id; $i <= $end; $i++) { - switch (get_class($tokens[$i])) { - case 'PHP_Token_IF': - case 'PHP_Token_ELSEIF': - case 'PHP_Token_FOR': - case 'PHP_Token_FOREACH': - case 'PHP_Token_WHILE': - case 'PHP_Token_CASE': - case 'PHP_Token_CATCH': - case 'PHP_Token_BOOLEAN_AND': - case 'PHP_Token_LOGICAL_AND': - case 'PHP_Token_BOOLEAN_OR': - case 'PHP_Token_LOGICAL_OR': - case 'PHP_Token_QUESTION_MARK': { - $this->ccn++; - } - break; - } - } - - return $this->ccn; - } - - public function getSignature() - { - if ($this->signature !== NULL) { - return $this->signature; - } - - if ($this->getName() == 'anonymous function') { - $this->signature = 'anonymous function'; - $i = $this->id + 1; - } else { - $this->signature = ''; - $i = $this->id + 2; - } - - $tokens = $this->tokenStream->tokens(); - - while (isset($tokens[$i]) && - !$tokens[$i] instanceof PHP_Token_OPEN_CURLY && - !$tokens[$i] instanceof PHP_Token_SEMICOLON) { - $this->signature .= $tokens[$i++]; - } - - $this->signature = trim($this->signature); - - return $this->signature; - } -} - -class PHP_Token_CONST extends PHP_Token {} -class PHP_Token_RETURN extends PHP_Token {} -class PHP_Token_YIELD extends PHP_Token {} -class PHP_Token_TRY extends PHP_Token {} -class PHP_Token_CATCH extends PHP_Token {} -class PHP_Token_FINALLY extends PHP_Token {} -class PHP_Token_THROW extends PHP_Token {} -class PHP_Token_USE extends PHP_Token {} -class PHP_Token_GLOBAL extends PHP_Token {} -class PHP_Token_PUBLIC extends PHP_Token {} -class PHP_Token_PROTECTED extends PHP_Token {} -class PHP_Token_PRIVATE extends PHP_Token {} -class PHP_Token_FINAL extends PHP_Token {} -class PHP_Token_ABSTRACT extends PHP_Token {} -class PHP_Token_STATIC extends PHP_Token {} -class PHP_Token_VAR extends PHP_Token {} -class PHP_Token_UNSET extends PHP_Token {} -class PHP_Token_ISSET extends PHP_Token {} -class PHP_Token_EMPTY extends PHP_Token {} -class PHP_Token_HALT_COMPILER extends PHP_Token {} - -class PHP_Token_INTERFACE extends PHP_TokenWithScopeAndVisibility -{ - protected $interfaces; - - public function getName() - { - return (string)$this->tokenStream[$this->id + 2]; - } - - public function hasParent() - { - return $this->tokenStream[$this->id + 4] instanceof PHP_Token_EXTENDS; - } - - public function getPackage() - { - $className = $this->getName(); - $docComment = $this->getDocblock(); - - $result = array( - 'namespace' => '', - 'fullPackage' => '', - 'category' => '', - 'package' => '', - 'subpackage' => '' - ); - - for ($i = $this->id; $i; --$i) { - if ($this->tokenStream[$i] instanceof PHP_Token_NAMESPACE) { - $result['namespace'] = $this->tokenStream[$i]->getName(); - break; - } - } - - if (preg_match('/@category[\s]+([\.\w]+)/', $docComment, $matches)) { - $result['category'] = $matches[1]; - } - - if (preg_match('/@package[\s]+([\.\w]+)/', $docComment, $matches)) { - $result['package'] = $matches[1]; - $result['fullPackage'] = $matches[1]; - } - - if (preg_match('/@subpackage[\s]+([\.\w]+)/', $docComment, $matches)) { - $result['subpackage'] = $matches[1]; - $result['fullPackage'] .= '.' . $matches[1]; - } - - if (empty($result['fullPackage'])) { - $result['fullPackage'] = $this->arrayToName( - explode('_', str_replace('\\', '_', $className)), '.' - ); - } - - return $result; - } - - protected function arrayToName(array $parts, $join = '\\') - { - $result = ''; - - if (count($parts) > 1) { - array_pop($parts); - - $result = join($join, $parts); - } - - return $result; - } - - public function getParent() - { - if (!$this->hasParent()) { - return FALSE; - } - - $i = $this->id + 6; - $tokens = $this->tokenStream->tokens(); - $className = (string)$tokens[$i]; - - while (isset($tokens[$i+1]) && - !$tokens[$i+1] instanceof PHP_Token_WHITESPACE) { - $className .= (string)$tokens[++$i]; - } - - return $className; - } - - public function hasInterfaces() - { - return (isset($this->tokenStream[$this->id + 4]) && - $this->tokenStream[$this->id + 4] instanceof PHP_Token_IMPLEMENTS) || - (isset($this->tokenStream[$this->id + 8]) && - $this->tokenStream[$this->id + 8] instanceof PHP_Token_IMPLEMENTS); - } - - public function getInterfaces() - { - if ($this->interfaces !== NULL) { - return $this->interfaces; - } - - if (!$this->hasInterfaces()) { - return ($this->interfaces = FALSE); - } - - if ($this->tokenStream[$this->id + 4] instanceof PHP_Token_IMPLEMENTS) { - $i = $this->id + 3; - } else { - $i = $this->id + 7; - } - - $tokens = $this->tokenStream->tokens(); - - while (!$tokens[$i+1] instanceof PHP_Token_OPEN_CURLY) { - $i++; - - if ($tokens[$i] instanceof PHP_Token_STRING) { - $this->interfaces[] = (string)$tokens[$i]; - } - } - - return $this->interfaces; - } -} - -class PHP_Token_CLASS extends PHP_Token_INTERFACE {} -class PHP_Token_TRAIT extends PHP_Token_INTERFACE {} -class PHP_Token_EXTENDS extends PHP_Token {} -class PHP_Token_IMPLEMENTS extends PHP_Token {} -class PHP_Token_OBJECT_OPERATOR extends PHP_Token {} -class PHP_Token_DOUBLE_ARROW extends PHP_Token {} -class PHP_Token_LIST extends PHP_Token {} -class PHP_Token_ARRAY extends PHP_Token {} -class PHP_Token_CLASS_C extends PHP_Token {} -class PHP_Token_TRAIT_C extends PHP_Token {} -class PHP_Token_METHOD_C extends PHP_Token {} -class PHP_Token_FUNC_C extends PHP_Token {} -class PHP_Token_LINE extends PHP_Token {} -class PHP_Token_FILE extends PHP_Token {} -class PHP_Token_COMMENT extends PHP_Token {} -class PHP_Token_DOC_COMMENT extends PHP_Token {} -class PHP_Token_OPEN_TAG extends PHP_Token {} -class PHP_Token_OPEN_TAG_WITH_ECHO extends PHP_Token {} -class PHP_Token_CLOSE_TAG extends PHP_Token {} -class PHP_Token_WHITESPACE extends PHP_Token {} -class PHP_Token_START_HEREDOC extends PHP_Token {} -class PHP_Token_END_HEREDOC extends PHP_Token {} -class PHP_Token_DOLLAR_OPEN_CURLY_BRACES extends PHP_Token {} -class PHP_Token_CURLY_OPEN extends PHP_Token {} -class PHP_Token_PAAMAYIM_NEKUDOTAYIM extends PHP_Token {} - -class PHP_Token_NAMESPACE extends PHP_TokenWithScope -{ - public function getName() - { - $tokens = $this->tokenStream->tokens(); - $namespace = (string)$tokens[$this->id+2]; - - for ($i = $this->id + 3; ; $i += 2) { - if (isset($tokens[$i]) && - $tokens[$i] instanceof PHP_Token_NS_SEPARATOR) { - $namespace .= '\\' . $tokens[$i+1]; - } else { - break; - } - } - - return $namespace; - } -} - -class PHP_Token_NS_C extends PHP_Token {} -class PHP_Token_DIR extends PHP_Token {} -class PHP_Token_NS_SEPARATOR extends PHP_Token {} -class PHP_Token_DOUBLE_COLON extends PHP_Token {} -class PHP_Token_OPEN_BRACKET extends PHP_Token {} -class PHP_Token_CLOSE_BRACKET extends PHP_Token {} -class PHP_Token_OPEN_SQUARE extends PHP_Token {} -class PHP_Token_CLOSE_SQUARE extends PHP_Token {} -class PHP_Token_OPEN_CURLY extends PHP_Token {} -class PHP_Token_CLOSE_CURLY extends PHP_Token {} -class PHP_Token_SEMICOLON extends PHP_Token {} -class PHP_Token_DOT extends PHP_Token {} -class PHP_Token_COMMA extends PHP_Token {} -class PHP_Token_EQUAL extends PHP_Token {} -class PHP_Token_LT extends PHP_Token {} -class PHP_Token_GT extends PHP_Token {} -class PHP_Token_PLUS extends PHP_Token {} -class PHP_Token_MINUS extends PHP_Token {} -class PHP_Token_MULT extends PHP_Token {} -class PHP_Token_DIV extends PHP_Token {} -class PHP_Token_QUESTION_MARK extends PHP_Token {} -class PHP_Token_EXCLAMATION_MARK extends PHP_Token {} -class PHP_Token_COLON extends PHP_Token {} -class PHP_Token_DOUBLE_QUOTES extends PHP_Token {} -class PHP_Token_AT extends PHP_Token {} -class PHP_Token_AMPERSAND extends PHP_Token {} -class PHP_Token_PERCENT extends PHP_Token {} -class PHP_Token_PIPE extends PHP_Token {} -class PHP_Token_DOLLAR extends PHP_Token {} -class PHP_Token_CARET extends PHP_Token {} -class PHP_Token_TILDE extends PHP_Token {} -class PHP_Token_BACKTICK extends PHP_Token {} -PHP_TokenStream - -Copyright (c) 2009-2013, Sebastian Bergmann . -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of Sebastian Bergmann nor the names of his - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -PHP_TokenStream 1.1 -=================== - -This is the list of changes for the PHP_TokenStream 1.1 release series. - -PHP_TokenStream 1.1.7 ---------------------- - -* Fixed parsing of function signatures. - -PHP_TokenStream 1.1.6 ---------------------- - -* Fixed handling of closures. -* Fixed parsing of function signatures. - -PHP_TokenStream 1.1.5 ---------------------- - -* No changes. - -PHP_TokenStream 1.1.4 ---------------------- - -* No changes. - -PHP_TokenStream 1.1.3 ---------------------- - -* Added class for the `T_TRAIT_C` token that was added in PHP 5.4. - -PHP_TokenStream 1.1.2 ---------------------- - -* Added classes for the `T_CALLABLE` and `T_INSTEADOF` tokens that were added in PHP 5.4. -* Added support for namespaced functions. - -PHP_TokenStream 1.1.1 ---------------------- - -* Fixed issue #19: Notice in `PHP_Token_INTERFACE::hasInterfaces()`. - -PHP_TokenStream 1.1.0 ---------------------- - -* Moved `phptok` tool to separate package. -PHP_TokenStream -=============== - -Installation ------------- - -PHP_TokenStream should be installed using the [PEAR Installer](http://pear.php.net/). This installer is the backbone of PEAR, which provides a distribution system for PHP packages, and is shipped with every release of PHP since version 4.3.0. - -The PEAR channel (`pear.phpunit.de`) that is used to distribute PHP_TokenStream needs to be registered with the local PEAR environment: - - sb@ubuntu ~ % pear channel-discover pear.phpunit.de - Adding Channel "pear.phpunit.de" succeeded - Discovery of channel "pear.phpunit.de" succeeded - -This has to be done only once. Now the PEAR Installer can be used to install packages from the PHPUnit channel: - - sb@ubuntu tokenstream % pear install phpunit/PHP_TokenStream-beta - downloading PHP_TokenStream-0.9.1.tgz ... - Starting to download PHP_TokenStream-0.9.1.tgz (5,113 bytes) - ...done: 5,113 bytes - install ok: channel://pear.phpunit.de/PHP_TokenStream-0.9.1 - -After the installation you can find the PHP_TokenStream source files inside your local PEAR directory; the path is usually `/usr/lib/php/PHP`. -PHPUnit_MockObject - -Copyright (c) 2002-2013, Sebastian Bergmann . -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of Sebastian Bergmann nor the names of his - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Interface for classes which can be invoked. - * - * The invocation will be taken from a mock object and passed to an object - * of this class. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Interface available since Release 1.0.0 - */ -interface PHPUnit_Framework_MockObject_Invokable extends PHPUnit_Framework_MockObject_Verifiable -{ - /** - * Invokes the invocation object $invocation so that it can be checked for - * expectations or matched against stubs. - * - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * The invocation object passed from mock object. - * @return object - */ - public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation); - - /** - * Checks if the invocation matches. - * - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * The invocation object passed from mock object. - * @return boolean - */ - public function matches(PHPUnit_Framework_MockObject_Invocation $invocation); -} -{namespace} - -class {class_name} extends \SOAPClient -{ - public function __construct($wsdl, array $options) - { - parent::__construct('{wsdl}', $options); - } -{methods}} - public function __clone() - { - $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker(); - parent::__clone(); - } - - {modifier} function {reference}{method_name}({arguments_decl}) - { - $arguments = array({arguments_call}); - $count = func_num_args(); - - if ($count > {arguments_count}) { - $_arguments = func_get_args(); - - for ($i = {arguments_count}; $i < $count; $i++) { - $arguments[] = $_arguments[$i]; - } - } - - $result = $this->__phpunit_getInvocationMocker()->invoke( - new PHPUnit_Framework_MockObject_Invocation_Object( - '{class_name}', '{method_name}', $arguments, $this, {clone_arguments} - ) - ); - - return $result; - } - - public function {method_name}({arguments}) - { - } - - {modifier} static function {reference}{method_name}({arguments_decl}) - { - $arguments = array({arguments_call}); - $count = func_num_args(); - - if ($count > {arguments_count}) { - $_arguments = func_get_args(); - - for ($i = {arguments_count}; $i < $count; $i++) { - $arguments[] = $_arguments[$i]; - } - } - - $result = self::__phpunit_getStaticInvocationMocker()->invoke( - new PHPUnit_Framework_MockObject_Invocation_Static( - '{class_name}', '{method_name}', $arguments, {clone_arguments} - ) - ); - - return $result; - } -{prologue}{class_declaration} -{ - private static $__phpunit_staticInvocationMocker; - private $__phpunit_invocationMocker; - -{clone}{mocked_methods} - public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) - { - return $this->__phpunit_getInvocationMocker()->expects($matcher); - } - - public static function staticExpects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) - { - return self::__phpunit_getStaticInvocationMocker()->expects($matcher); - } - - public function __phpunit_getInvocationMocker() - { - if ($this->__phpunit_invocationMocker === NULL) { - $this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker; - } - - return $this->__phpunit_invocationMocker; - } - - public static function __phpunit_getStaticInvocationMocker() - { - if (self::$__phpunit_staticInvocationMocker === NULL) { - self::$__phpunit_staticInvocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker; - } - - return self::$__phpunit_staticInvocationMocker; - } - - public function __phpunit_hasMatchers() - { - return self::__phpunit_getStaticInvocationMocker()->hasMatchers() || - $this->__phpunit_getInvocationMocker()->hasMatchers(); - } - - public function __phpunit_verify() - { - self::__phpunit_getStaticInvocationMocker()->verify(); - $this->__phpunit_getInvocationMocker()->verify(); - } - - public function __phpunit_cleanup() - { - self::$__phpunit_staticInvocationMocker = NULL; - $this->__phpunit_invocationMocker = NULL; - } -}{epilogue} - public function __clone() - { - $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker(); - } -class {class_name} -{ - use {trait_name}; -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Mock Object Code Generator - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Generator -{ - /** - * @var array - */ - protected static $cache = array(); - - /** - * @var array - */ - protected static $blacklistedMethodNames = array( - '__clone' => TRUE, - 'abstract' => TRUE, - 'and' => TRUE, - 'array' => TRUE, - 'as' => TRUE, - 'break' => TRUE, - 'case' => TRUE, - 'catch' => TRUE, - 'class' => TRUE, - 'clone' => TRUE, - 'const' => TRUE, - 'continue' => TRUE, - 'declare' => TRUE, - 'default' => TRUE, - 'die' => TRUE, - 'do' => TRUE, - 'echo' => TRUE, - 'else' => TRUE, - 'elseif' => TRUE, - 'empty' => TRUE, - 'enddeclare' => TRUE, - 'endfor' => TRUE, - 'endforeach' => TRUE, - 'endif' => TRUE, - 'endswitch' => TRUE, - 'endwhile' => TRUE, - 'eval' => TRUE, - 'exit' => TRUE, - 'expects' => TRUE, - 'extends' => TRUE, - 'final' => TRUE, - 'for' => TRUE, - 'foreach' => TRUE, - 'function' => TRUE, - 'global' => TRUE, - 'goto' => TRUE, - 'if' => TRUE, - 'implements' => TRUE, - 'include' => TRUE, - 'include_once' => TRUE, - 'instanceof' => TRUE, - 'interface' => TRUE, - 'isset' => TRUE, - 'list' => TRUE, - 'namespace' => TRUE, - 'new' => TRUE, - 'or' => TRUE, - 'print' => TRUE, - 'private' => TRUE, - 'protected' => TRUE, - 'public' => TRUE, - 'require' => TRUE, - 'require_once' => TRUE, - 'return' => TRUE, - 'static' => TRUE, - 'staticExpects' => TRUE, - 'switch' => TRUE, - 'throw' => TRUE, - 'try' => TRUE, - 'unset' => TRUE, - 'use' => TRUE, - 'var' => TRUE, - 'while' => TRUE, - 'xor' => TRUE - ); - - /** - * @var boolean - */ - protected static $soapLoaded = NULL; - - /** - * Returns a mock object for the specified class. - * - * @param string $originalClassName - * @param array $methods - * @param array $arguments - * @param string $mockClassName - * @param boolean $callOriginalConstructor - * @param boolean $callOriginalClone - * @param boolean $callAutoload - * @param boolean $cloneArguments - * @return object - * @throws InvalidArgumentException - * @since Method available since Release 1.0.0 - */ - public static function getMock($originalClassName, $methods = array(), array $arguments = array(), $mockClassName = '', $callOriginalConstructor = TRUE, $callOriginalClone = TRUE, $callAutoload = TRUE, $cloneArguments = TRUE) - { - if (!is_string($originalClassName)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); - } - - if (!is_string($mockClassName)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(4, 'string'); - } - - if (!is_array($methods) && !is_null($methods)) { - throw new InvalidArgumentException; - } - - if (NULL !== $methods) { - foreach ($methods as $method) { - if (!preg_match('~[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*~', $method)) { - throw new PHPUnit_Framework_Exception( - sprintf( - 'Cannot stub or mock method with invalid name "%s"', - $method - ) - ); - } - } - if ($methods != array_unique($methods)) { - throw new PHPUnit_Framework_Exception( - sprintf( - 'Cannot stub or mock using a method list that contains duplicates: "%s"', - implode(', ', $methods) - ) - ); - } - } - - if ($mockClassName != '' && class_exists($mockClassName, FALSE)) { - $reflect = new ReflectionClass($mockClassName); - if (!$reflect->implementsInterface("PHPUnit_Framework_MockObject_MockObject")) { - throw new PHPUnit_Framework_Exception( - sprintf( - 'Class "%s" already exists.', - $mockClassName - ) - ); - } - } - - $mock = self::generate( - $originalClassName, - $methods, - $mockClassName, - $callOriginalClone, - $callAutoload, - $cloneArguments - ); - - return self::getObject( - $mock['code'], - $mock['mockClassName'], - $originalClassName, - $callOriginalConstructor, - $callAutoload, - $arguments - ); - } - - /** - * @param string $code - * @param string $className - * @param string $originalClassName - * @param string $callOriginalConstructor - * @param string $callAutoload - * @param array $arguments - * @return object - */ - protected static function getObject($code, $className, $originalClassName = '', $callOriginalConstructor = FALSE, $callAutoload = FALSE, array $arguments = array()) - { - if (!class_exists($className, FALSE)) { - eval($code); - } - - if ($callOriginalConstructor && - !interface_exists($originalClassName, $callAutoload)) { - if (count($arguments) == 0) { - $object = new $className; - } else { - $class = new ReflectionClass($className); - $object = $class->newInstanceArgs($arguments); - } - } else { - // Use a trick to create a new object of a class - // without invoking its constructor. - $object = unserialize( - sprintf('O:%d:"%s":0:{}', strlen($className), $className) - ); - } - - return $object; - } - - /** - * Returns a mock object for the specified abstract class with all abstract - * methods of the class mocked. Concrete methods to mock can be specified with - * the last parameter - * - * @param string $originalClassName - * @param array $arguments - * @param string $mockClassName - * @param boolean $callOriginalConstructor - * @param boolean $callOriginalClone - * @param boolean $callAutoload - * @param array $mockedMethods - * @param boolean $cloneArguments - * @return object - * @since Method available since Release 1.0.0 - * @throws InvalidArgumentException - */ - public static function getMockForAbstractClass($originalClassName, array $arguments = array(), $mockClassName = '', $callOriginalConstructor = TRUE, $callOriginalClone = TRUE, $callAutoload = TRUE, $mockedMethods = array(), $cloneArguments = TRUE) - { - if (!is_string($originalClassName)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); - } - - if (!is_string($mockClassName)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(3, 'string'); - } - - if (class_exists($originalClassName, $callAutoload) || - interface_exists($originalClassName, $callAutoload)) { - $methods = array(); - $reflector = new ReflectionClass($originalClassName); - - foreach ($reflector->getMethods() as $method) { - if ($method->isAbstract() || in_array($method->getName(), $mockedMethods)) { - $methods[] = $method->getName(); - } - } - - if (empty($methods)) { - $methods = NULL; - } - - return self::getMock( - $originalClassName, - $methods, - $arguments, - $mockClassName, - $callOriginalConstructor, - $callOriginalClone, - $callAutoload, - $cloneArguments - ); - } else { - throw new PHPUnit_Framework_Exception( - sprintf( - 'Class "%s" does not exist.', - $originalClassName - ) - ); - } - } - - /** - * Returns an object for the specified trait. - * - * @param string $traitName - * @param array $arguments - * @param string $traitClassName - * @param boolean $callOriginalConstructor - * @param boolean $callOriginalClone - * @param boolean $callAutoload - * @return object - * @since Method available since Release 1.1.0 - * @throws InvalidArgumentException - */ - public static function getObjectForTrait($traitName, array $arguments = array(), $traitClassName = '', $callOriginalConstructor = TRUE, $callOriginalClone = TRUE, $callAutoload = TRUE) - { - if (!is_string($traitName)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); - } - - if (!is_string($traitClassName)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(3, 'string'); - } - - if (!trait_exists($traitName, $callAutoload)) { - throw new PHPUnit_Framework_Exception( - sprintf( - 'Trait "%s" does not exist.', - $traitName - ) - ); - } - - $className = self::generateClassName( - $traitName, $traitClassName, 'Trait_' - ); - - $templateDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Generator' . - DIRECTORY_SEPARATOR; - $classTemplate = new Text_Template( - $templateDir . 'trait_class.tpl' - ); - - $classTemplate->setVar( - array( - 'class_name' => $className['className'], - 'trait_name' => $traitName - ) - ); - - return self::getObject( - $classTemplate->render(), - $className['className'] - ); - } - - /** - * @param string $originalClassName - * @param array $methods - * @param string $mockClassName - * @param boolean $callOriginalClone - * @param boolean $callAutoload - * @param boolean $cloneArguments - * @return array - */ - public static function generate($originalClassName, array $methods = NULL, $mockClassName = '', $callOriginalClone = TRUE, $callAutoload = TRUE, $cloneArguments = TRUE) - { - if ($mockClassName == '') { - $key = md5( - $originalClassName . - serialize($methods) . - serialize($callOriginalClone) . - serialize($cloneArguments) - ); - - if (isset(self::$cache[$key])) { - return self::$cache[$key]; - } - } - - $mock = self::generateMock( - $originalClassName, - $methods, - $mockClassName, - $callOriginalClone, - $callAutoload, - $cloneArguments - ); - - if (isset($key)) { - self::$cache[$key] = $mock; - } - - return $mock; - } - - /** - * @param string $wsdlFile - * @param string $originalClassName - * @param array $methods - * @param array $options - * @return array - */ - public static function generateClassFromWsdl($wsdlFile, $originalClassName, array $methods = array(), array $options = array()) - { - if (self::$soapLoaded === NULL) { - self::$soapLoaded = extension_loaded('soap'); - } - - if (self::$soapLoaded) { - $client = new SOAPClient($wsdlFile, $options); - $_methods = array_unique($client->__getFunctions()); - unset($client); - - $templateDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . - 'Generator' . DIRECTORY_SEPARATOR; - $methodTemplate = new Text_Template( - $templateDir . 'wsdl_method.tpl' - ); - $methodsBuffer = ''; - - foreach ($_methods as $method) { - $nameStart = strpos($method, ' ') + 1; - $nameEnd = strpos($method, '('); - $name = substr($method, $nameStart, $nameEnd - $nameStart); - - if (empty($methods) || in_array($name, $methods)) { - $args = explode( - ',', - substr( - $method, - $nameEnd + 1, - strpos($method, ')') - $nameEnd - 1 - ) - ); - $numArgs = count($args); - - for ($i = 0; $i < $numArgs; $i++) { - $args[$i] = substr($args[$i], strpos($args[$i], '$')); - } - - $methodTemplate->setVar( - array( - 'method_name' => $name, - 'arguments' => join(', ', $args) - ) - ); - - $methodsBuffer .= $methodTemplate->render(); - } - } - - $optionsBuffer = 'array('; - foreach ($options as $key => $value) { - $optionsBuffer .= $key . ' => ' . $value; - } - - $optionsBuffer .= ')'; - - $classTemplate = new Text_Template( - $templateDir . 'wsdl_class.tpl' - ); - - $namespace = ''; - if(strpos($originalClassName, '\\') !== FALSE) { - $parts = explode('\\', $originalClassName); - $originalClassName = array_pop($parts); - $namespace = 'namespace ' . join('\\', $parts) . ';'; - } - - $classTemplate->setVar( - array( - 'namespace' => $namespace, - 'class_name' => $originalClassName, - 'wsdl' => $wsdlFile, - 'options' => $optionsBuffer, - 'methods' => $methodsBuffer - ) - ); - - return $classTemplate->render(); - } else { - throw new PHPUnit_Framework_Exception( - 'The SOAP extension is required to generate a mock object ' . - 'from WSDL.' - ); - } - } - - /** - * @param string $originalClassName - * @param array|null $methods - * @param string $mockClassName - * @param boolean $callOriginalClone - * @param boolean $callAutoload - * @param boolean $cloneArguments - * @return array - */ - protected static function generateMock($originalClassName, $methods, $mockClassName, $callOriginalClone, $callAutoload, $cloneArguments = TRUE) - { - $templateDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Generator' . - DIRECTORY_SEPARATOR; - $classTemplate = new Text_Template( - $templateDir . 'mocked_class.tpl' - ); - $cloneTemplate = ''; - $isClass = FALSE; - $isInterface = FALSE; - - $mockClassName = self::generateClassName( - $originalClassName, $mockClassName, 'Mock_' - ); - - if (class_exists($mockClassName['fullClassName'], $callAutoload)) { - $isClass = TRUE; - } else { - if (interface_exists($mockClassName['fullClassName'], $callAutoload)) { - $isInterface = TRUE; - } - } - - if (!class_exists($mockClassName['fullClassName'], $callAutoload) && - !interface_exists($mockClassName['fullClassName'], $callAutoload)) { - $prologue = 'class ' . $mockClassName['originalClassName'] . "\n{\n}\n\n"; - - if (!empty($mockClassName['namespaceName'])) { - $prologue = 'namespace ' . $mockClassName['namespaceName'] . - " {\n\n" . $prologue . "}\n\n" . - "namespace {\n\n"; - - $epilogue = "\n\n}"; - } - - $cloneTemplate = new Text_Template( - $templateDir . 'mocked_clone.tpl' - ); - } else { - $class = new ReflectionClass($mockClassName['fullClassName']); - - if ($class->isFinal()) { - throw new PHPUnit_Framework_Exception( - sprintf( - 'Class "%s" is declared "final" and cannot be mocked.', - $mockClassName['fullClassName'] - ) - ); - } - - if ($class->hasMethod('__clone')) { - $cloneMethod = $class->getMethod('__clone'); - - if (!$cloneMethod->isFinal()) { - if ($callOriginalClone && !$isInterface) { - $cloneTemplate = new Text_Template( - $templateDir . 'unmocked_clone.tpl' - ); - } else { - $cloneTemplate = new Text_Template( - $templateDir . 'mocked_clone.tpl' - ); - } - } - } else { - $cloneTemplate = new Text_Template( - $templateDir . 'mocked_clone.tpl' - ); - } - } - - if (is_object($cloneTemplate)) { - $cloneTemplate = $cloneTemplate->render(); - } - - if (is_array($methods) && empty($methods) && - ($isClass || $isInterface)) { - $methods = get_class_methods($mockClassName['fullClassName']); - } - - if (!is_array($methods)) { - $methods = array(); - } - - $mockedMethods = ''; - - if (isset($class)) { - foreach ($methods as $methodName) { - try { - $method = $class->getMethod($methodName); - - if (self::canMockMethod($method)) { - $mockedMethods .= self::generateMockedMethodDefinitionFromExisting( - $templateDir, $method, $cloneArguments - ); - } - } - - catch (ReflectionException $e) { - $mockedMethods .= self::generateMockedMethodDefinition( - $templateDir, $mockClassName['fullClassName'], $methodName, $cloneArguments - ); - } - } - } else { - foreach ($methods as $methodName) { - $mockedMethods .= self::generateMockedMethodDefinition( - $templateDir, $mockClassName['fullClassName'], $methodName, $cloneArguments - ); - } - } - - $classTemplate->setVar( - array( - 'prologue' => isset($prologue) ? $prologue : '', - 'epilogue' => isset($epilogue) ? $epilogue : '', - 'class_declaration' => self::generateMockClassDeclaration( - $mockClassName, $isInterface - ), - 'clone' => $cloneTemplate, - 'mock_class_name' => $mockClassName['className'], - 'mocked_methods' => $mockedMethods - ) - ); - - return array( - 'code' => $classTemplate->render(), - 'mockClassName' => $mockClassName['className'] - ); - } - - /** - * @param string $originalClassName - * @param string $className - * @param string $prefix - * @return array - */ - protected static function generateClassName($originalClassName, $className, $prefix) - { - if ($originalClassName[0] == '\\') { - $originalClassName = substr($originalClassName, 1); - } - - $classNameParts = explode('\\', $originalClassName); - - if (count($classNameParts) > 1) { - $originalClassName = array_pop($classNameParts); - $namespaceName = join('\\', $classNameParts); - $fullClassName = $namespaceName . '\\' . $originalClassName; - } else { - $namespaceName = ''; - $fullClassName = $originalClassName; - } - - if ($className == '') { - do { - $className = $prefix . $originalClassName . '_' . - substr(md5(microtime()), 0, 8); - } - while (class_exists($className, FALSE)); - } - - return array( - 'className' => $className, - 'originalClassName' => $originalClassName, - 'fullClassName' => $fullClassName, - 'namespaceName' => $namespaceName - ); - } - - /** - * @param array $mockClassName - * @param boolean $isInterface - * @return array - */ - protected static function generateMockClassDeclaration(array $mockClassName, $isInterface) - { - $buffer = 'class '; - - if ($isInterface) { - $buffer .= sprintf( - "%s implements PHPUnit_Framework_MockObject_MockObject, %s%s", - $mockClassName['className'], - !empty($mockClassName['namespaceName']) ? $mockClassName['namespaceName'] . '\\' : '', - $mockClassName['originalClassName'] - ); - } else { - $buffer .= sprintf( - "%s extends %s%s implements PHPUnit_Framework_MockObject_MockObject", - $mockClassName['className'], - !empty($mockClassName['namespaceName']) ? $mockClassName['namespaceName'] . '\\' : '', - $mockClassName['originalClassName'] - ); - } - - return $buffer; - } - - /** - * @param string $templateDir - * @param ReflectionMethod $method - * @param boolean $cloneArguments - * @return string - */ - protected static function generateMockedMethodDefinitionFromExisting($templateDir, ReflectionMethod $method, $cloneArguments = TRUE) - { - if ($method->isPrivate()) { - $modifier = 'private'; - } - - else if ($method->isProtected()) { - $modifier = 'protected'; - } - - else { - $modifier = 'public'; - } - - if ($method->isStatic()) { - $static = TRUE; - } else { - $static = FALSE; - } - - if ($method->returnsReference()) { - $reference = '&'; - } else { - $reference = ''; - } - - return self::generateMockedMethodDefinition( - $templateDir, - $method->getDeclaringClass()->getName(), - $method->getName(), - $cloneArguments, - $modifier, - PHPUnit_Util_Class::getMethodParameters($method), - PHPUnit_Util_Class::getMethodParameters($method, TRUE), - $reference, - $static - ); - } - - /** - * @param string $templateDir - * @param string $className - * @param string $methodName - * @param boolean $cloneArguments - * @param string $modifier - * @param string $arguments_decl - * @param string $arguments_call - * @param string $reference - * @param boolean $static - * @return string - */ - protected static function generateMockedMethodDefinition($templateDir, $className, $methodName, $cloneArguments = TRUE, $modifier = 'public', $arguments_decl = '', $arguments_call = '', $reference = '', $static = FALSE) - { - if ($static) { - $template = new Text_Template( - $templateDir . 'mocked_static_method.tpl' - ); - } else { - $template = new Text_Template( - $templateDir . 'mocked_object_method.tpl' - ); - } - - $template->setVar( - array( - 'arguments_decl' => $arguments_decl, - 'arguments_call' => $arguments_call, - 'arguments_count' => !empty($arguments_call) ? count(explode(',', $arguments_call)) : 0, - 'class_name' => $className, - 'method_name' => $methodName, - 'modifier' => $modifier, - 'reference' => $reference, - 'clone_arguments' => $cloneArguments ? 'TRUE' : 'FALSE' - ) - ); - - return $template->render(); - } - - /** - * @param ReflectionMethod $method - * @return boolean - */ - protected static function canMockMethod(ReflectionMethod $method) - { - if ($method->isConstructor() || $method->isFinal() || - isset(self::$blacklistedMethodNames[$method->getName()])) { - return FALSE; - } - - return TRUE; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Invocation matcher which looks for a specific method name in the invocations. - * - * Checks the method name all incoming invocations, the name is checked against - * the defined constraint $constraint. If the constraint is met it will return - * true in matches(). - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Matcher_MethodName extends PHPUnit_Framework_MockObject_Matcher_StatelessInvocation -{ - /** - * @var PHPUnit_Framework_Constraint - */ - protected $constraint; - - /** - * @param PHPUnit_Framework_Constraint|string - * @throws PHPUnit_Framework_Constraint - */ - public function __construct($constraint) - { - if (!$constraint instanceof PHPUnit_Framework_Constraint) { - if (!is_string($constraint)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); - } - - $constraint = new PHPUnit_Framework_Constraint_IsEqual( - $constraint, 0, 10, FALSE, TRUE - ); - } - - $this->constraint = $constraint; - } - - /** - * @return string - */ - public function toString() - { - return 'method name ' . $this->constraint->toString(); - } - - /** - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * @return boolean - */ - public function matches(PHPUnit_Framework_MockObject_Invocation $invocation) - { - return $this->constraint->evaluate($invocation->methodName, '', TRUE); - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Invocation matcher which checks if a method has been invoked at least one - * time. - * - * If the number of invocations is 0 it will throw an exception in verify. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce extends PHPUnit_Framework_MockObject_Matcher_InvokedRecorder -{ - /** - * @return string - */ - public function toString() - { - return 'invoked at least once'; - } - - /** - * Verifies that the current expectation is valid. If everything is OK the - * code should just return, if not it must throw an exception. - * - * @throws PHPUnit_Framework_ExpectationFailedException - */ - public function verify() - { - $count = $this->getInvocationCount(); - - if ($count < 1) { - throw new PHPUnit_Framework_ExpectationFailedException( - 'Expected invocation at least once but it never occured.' - ); - } - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Records invocations and provides convenience methods for checking them later - * on. - * This abstract class can be implemented by matchers which needs to check the - * number of times an invocation has occured. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - * @abstract - */ -abstract class PHPUnit_Framework_MockObject_Matcher_InvokedRecorder implements PHPUnit_Framework_MockObject_Matcher_Invocation -{ - /** - * @var PHPUnit_Framework_MockObject_Invocation[] - */ - protected $invocations = array(); - - /** - * @return integer - */ - public function getInvocationCount() - { - return count($this->invocations); - } - - /** - * @return PHPUnit_Framework_MockObject_Invocation[] - */ - public function getInvocations() - { - return $this->invocations; - } - - /** - * @return boolean - */ - public function hasBeenInvoked() - { - return count($this->invocations) > 0; - } - - /** - * @param PHPUnit_Framework_MockObject_Invocation $invocation - */ - public function invoked(PHPUnit_Framework_MockObject_Invocation $invocation) - { - $this->invocations[] = $invocation; - } - - /** - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * @return boolean - */ - public function matches(PHPUnit_Framework_MockObject_Invocation $invocation) - { - return TRUE; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Invocation matcher which allos any parameters to a method. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Matcher_AnyParameters extends PHPUnit_Framework_MockObject_Matcher_StatelessInvocation -{ - /** - * @return string - */ - public function toString() - { - return 'with any parameters'; - } - - /** - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * @return boolean - */ - public function matches(PHPUnit_Framework_MockObject_Invocation $invocation) - { - return TRUE; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Invocation matcher which checks if a method has been invoked a certain amount - * of times. - * If the number of invocations exceeds the value it will immediately throw an - * exception, - * If the number is less it will later be checked in verify() and also throw an - * exception. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Matcher_InvokedCount extends PHPUnit_Framework_MockObject_Matcher_InvokedRecorder -{ - /** - * @var integer - */ - protected $expectedCount; - - /** - * @param interger $expectedCount - */ - public function __construct($expectedCount) - { - $this->expectedCount = $expectedCount; - } - - /** - * @return string - */ - public function toString() - { - return 'invoked ' . $this->expectedCount . ' time(s)'; - } - - /** - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * @throws PHPUnit_Framework_ExpectationFailedException - */ - public function invoked(PHPUnit_Framework_MockObject_Invocation $invocation) - { - parent::invoked($invocation); - - $count = $this->getInvocationCount(); - - if ($count > $this->expectedCount) { - $message = $invocation->toString() . ' '; - - switch ($this->expectedCount) { - case 0: { - $message .= 'was not expected to be called.'; - } - break; - - case 1: { - $message .= 'was not expected to be called more than once.'; - } - break; - - default: { - $message .= sprintf( - 'was not expected to be called more than %d times.', - - $this->expectedCount - ); - } - } - - throw new PHPUnit_Framework_ExpectationFailedException($message); - } - } - - /** - * Verifies that the current expectation is valid. If everything is OK the - * code should just return, if not it must throw an exception. - * - * @throws PHPUnit_Framework_ExpectationFailedException - */ - public function verify() - { - $count = $this->getInvocationCount(); - - if ($count !== $this->expectedCount) { - throw new PHPUnit_Framework_ExpectationFailedException( - sprintf( - 'Method was expected to be called %d times, ' . - 'actually called %d times.', - - $this->expectedCount, - $count - ) - ); - } - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Invocation matcher which checks if a method has been invoked zero or more - * times. This matcher will always match. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount extends PHPUnit_Framework_MockObject_Matcher_InvokedRecorder -{ - /** - * @return string - */ - public function toString() - { - return 'invoked zero or more times'; - } - - /** - */ - public function verify() - { - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Invocation matcher which looks for specific parameters in the invocations. - * - * Checks the parameters of all incoming invocations, the parameter list is - * checked against the defined constraints in $parameters. If the constraint - * is met it will return true in matches(). - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Matcher_Parameters extends PHPUnit_Framework_MockObject_Matcher_StatelessInvocation -{ - /** - * @var array - */ - protected $parameters = array(); - - /** - * @var PHPUnit_Framework_MockObject_Invocation - */ - protected $invocation; - - /** - * @param array $parameters - */ - public function __construct(array $parameters) - { - foreach ($parameters as $parameter) { - if (!($parameter instanceof PHPUnit_Framework_Constraint)) { - $parameter = new PHPUnit_Framework_Constraint_IsEqual( - $parameter - ); - } - - $this->parameters[] = $parameter; - } - } - - /** - * @return string - */ - public function toString() - { - $text = 'with parameter'; - - foreach ($this->parameters as $index => $parameter) { - if ($index > 0) { - $text .= ' and'; - } - - $text .= ' ' . $index . ' ' . $parameter->toString(); - } - - return $text; - } - - /** - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * @return boolean - */ - public function matches(PHPUnit_Framework_MockObject_Invocation $invocation) - { - $this->invocation = $invocation; - $this->verify(); - - return count($invocation->parameters) < count($this->parameters); - } - - /** - * Checks if the invocation $invocation matches the current rules. If it - * does the matcher will get the invoked() method called which should check - * if an expectation is met. - * - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * Object containing information on a mocked or stubbed method which - * was invoked. - * @return bool - * @throws PHPUnit_Framework_ExpectationFailedException - */ - public function verify() - { - if ($this->invocation === NULL) { - throw new PHPUnit_Framework_ExpectationFailedException( - 'Mocked method does not exist.' - ); - } - - if (count($this->invocation->parameters) < count($this->parameters)) { - throw new PHPUnit_Framework_ExpectationFailedException( - sprintf( - 'Parameter count for invocation %s is too low.', - - $this->invocation->toString() - ) - ); - } - - foreach ($this->parameters as $i => $parameter) { - $parameter->evaluate( - $this->invocation->parameters[$i], - sprintf( - 'Parameter %s for invocation %s does not match expected ' . - 'value.', - - $i, - $this->invocation->toString() - ) - ); - } - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Interface for classes which matches an invocation based on its - * method name, argument, order or call count. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Interface available since Release 1.0.0 - */ -interface PHPUnit_Framework_MockObject_Matcher_Invocation extends PHPUnit_Framework_SelfDescribing, PHPUnit_Framework_MockObject_Verifiable -{ - /** - * Registers the invocation $invocation in the object as being invoked. - * This will only occur after matches() returns true which means the - * current invocation is the correct one. - * - * The matcher can store information from the invocation which can later - * be checked in verify(), or it can check the values directly and throw - * and exception if an expectation is not met. - * - * If the matcher is a stub it will also have a return value. - * - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * Object containing information on a mocked or stubbed method which - * was invoked. - * @return mixed - */ - public function invoked(PHPUnit_Framework_MockObject_Invocation $invocation); - - /** - * Checks if the invocation $invocation matches the current rules. If it does - * the matcher will get the invoked() method called which should check if an - * expectation is met. - * - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * Object containing information on a mocked or stubbed method which - * was invoked. - * @return bool - */ - public function matches(PHPUnit_Framework_MockObject_Invocation $invocation); -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Invocation matcher which does not care about previous state from earlier - * invocations. - * - * This abstract class can be implemented by matchers which does not care about - * state but only the current run-time value of the invocation itself. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - * @abstract - */ -abstract class PHPUnit_Framework_MockObject_Matcher_StatelessInvocation implements PHPUnit_Framework_MockObject_Matcher_Invocation -{ - /** - * Registers the invocation $invocation in the object as being invoked. - * This will only occur after matches() returns true which means the - * current invocation is the correct one. - * - * The matcher can store information from the invocation which can later - * be checked in verify(), or it can check the values directly and throw - * and exception if an expectation is not met. - * - * If the matcher is a stub it will also have a return value. - * - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * Object containing information on a mocked or stubbed method which - * was invoked. - * @return mixed - */ - public function invoked(PHPUnit_Framework_MockObject_Invocation $invocation) - { - } - - /** - * Checks if the invocation $invocation matches the current rules. If it does - * the matcher will get the invoked() method called which should check if an - * expectation is met. - * - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * Object containing information on a mocked or stubbed method which - * was invoked. - * @return bool - */ - public function verify() - { - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Invocation matcher which checks if a method was invoked at a certain index. - * - * If the expected index number does not match the current invocation index it - * will not match which means it skips all method and parameter matching. Only - * once the index is reached will the method and parameter start matching and - * verifying. - * - * If the index is never reached it will throw an exception in index. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex implements PHPUnit_Framework_MockObject_Matcher_Invocation -{ - /** - * @var integer - */ - protected $sequenceIndex; - - /** - * @var integer - */ - protected $currentIndex = -1; - - /** - * @param integer $sequenceIndex - */ - public function __construct($sequenceIndex) - { - $this->sequenceIndex = $sequenceIndex; - } - - /** - * @return string - */ - public function toString() - { - return 'invoked at sequence index ' . $this->sequenceIndex; - } - - /** - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * @return boolean - */ - public function matches(PHPUnit_Framework_MockObject_Invocation $invocation) - { - $this->currentIndex++; - - return $this->currentIndex == $this->sequenceIndex; - } - - /** - * @param PHPUnit_Framework_MockObject_Invocation $invocation - */ - public function invoked(PHPUnit_Framework_MockObject_Invocation $invocation) - { - } - - /** - * Verifies that the current expectation is valid. If everything is OK the - * code should just return, if not it must throw an exception. - * - * @throws PHPUnit_Framework_ExpectationFailedException - */ - public function verify() - { - if ($this->currentIndex < $this->sequenceIndex) { - throw new PHPUnit_Framework_ExpectationFailedException( - sprintf( - 'The expected invocation at index %s was never reached.', - - $this->sequenceIndex - ) - ); - } - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Giorgio Sironi - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Implementation of the Builder pattern for Mock objects. - * - * @package PHPUnit_MockObject - * @author Giorgio Sironi - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_MockBuilder -{ - /** - * @var PHPUnit_Framework_TestCase - */ - protected $testCase; - - /** - * @var string - */ - protected $className; - - /** - * @var array - */ - protected $methods = array(); - - /** - * @var string - */ - protected $mockClassName = ''; - - /** - * @var array - */ - protected $constructorArgs = array(); - - /** - * @var boolean - */ - protected $originalConstructor = TRUE; - - /** - * @var boolean - */ - protected $originalClone = TRUE; - - /** - * @var boolean - */ - protected $autoload = TRUE; - - /** - * @var boolean - */ - protected $cloneArguments = FALSE; - - /** - * @param PHPUnit_Framework_TestCase - * @param string - */ - public function __construct(PHPUnit_Framework_TestCase $testCase, $className) - { - $this->testCase = $testCase; - $this->className = $className; - } - - /** - * Creates a mock object using a fluent interface. - * - * @return PHPUnit_Framework_MockObject_MockObject - */ - public function getMock() - { - return $this->testCase->getMock( - $this->className, - $this->methods, - $this->constructorArgs, - $this->mockClassName, - $this->originalConstructor, - $this->originalClone, - $this->autoload, - $this->cloneArguments - ); - } - - /** - * Creates a mock object for an abstract class using a fluent interface. - * - * @return PHPUnit_Framework_MockObject_MockObject - */ - public function getMockForAbstractClass() - { - return $this->testCase->getMockForAbstractClass( - $this->className, - $this->constructorArgs, - $this->mockClassName, - $this->originalConstructor, - $this->originalClone, - $this->autoload, - $this->methods, - $this->cloneArguments - ); - } - - /** - * Specifies the subset of methods to mock. Default is to mock all of them. - * - * @param array|null $methods - * @return PHPUnit_Framework_MockObject_MockBuilder - */ - public function setMethods($methods) - { - $this->methods = $methods; - - return $this; - } - - /** - * Specifies the arguments for the constructor. - * - * @param array $args - * @return PHPUnit_Framework_MockObject_MockBuilder - */ - public function setConstructorArgs(array $args) - { - $this->constructorArgs = $args; - - return $this; - } - - /** - * Specifies the name for the mock class. - * - * @param string $name - * @return PHPUnit_Framework_MockObject_MockBuilder - */ - public function setMockClassName($name) - { - $this->mockClassName = $name; - - return $this; - } - - /** - * Disables the invocation of the original constructor. - * - * @return PHPUnit_Framework_MockObject_MockBuilder - */ - public function disableOriginalConstructor() - { - $this->originalConstructor = FALSE; - - return $this; - } - - /** - * Enables the invocation of the original constructor. - * - * @return PHPUnit_Framework_MockObject_MockBuilder - * @since Method available since Release 1.2.0 - */ - public function enableOriginalConstructor() - { - $this->originalConstructor = TRUE; - - return $this; - } - - /** - * Disables the invocation of the original clone constructor. - * - * @return PHPUnit_Framework_MockObject_MockBuilder - */ - public function disableOriginalClone() - { - $this->originalClone = FALSE; - - return $this; - } - - /** - * Enables the invocation of the original clone constructor. - * - * @return PHPUnit_Framework_MockObject_MockBuilder - * @since Method available since Release 1.2.0 - */ - public function enableOriginalClone() - { - $this->originalClone = TRUE; - - return $this; - } - - /** - * Disables the use of class autoloading while creating the mock object. - * - * @return PHPUnit_Framework_MockObject_MockBuilder - */ - public function disableAutoload() - { - $this->autoload = FALSE; - - return $this; - } - - /** - * Enables the use of class autoloading while creating the mock object. - * - * @return PHPUnit_Framework_MockObject_MockBuilder - * @since Method available since Release 1.2.0 - */ - public function enableAutoload() - { - $this->autoload = TRUE; - - return $this; - } - - /** - * Disables the cloning of arguments passed to mocked methods. - * - * @return PHPUnit_Framework_MockObject_MockBuilder - * @since Method available since Release 1.2.0 - */ - public function disableArgumentCloning() - { - $this->cloneArguments = FALSE; - - return $this; - } - - /** - * Enables the cloning of arguments passed to mocked methods. - * - * @return PHPUnit_Framework_MockObject_MockBuilder - * @since Method available since Release 1.2.0 - */ - public function enableArgumentCloning() - { - $this->cloneArguments = TRUE; - - return $this; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Main matcher which defines a full expectation using method, parameter and - * invocation matchers. - * This matcher encapsulates all the other matchers and allows the builder to - * set the specific matchers when the appropriate methods are called (once(), - * where() etc.). - * - * All properties are public so that they can easily be accessed by the builder. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Matcher implements PHPUnit_Framework_MockObject_Matcher_Invocation -{ - /** - * @var PHPUnit_Framework_MockObject_Matcher_Invocation - */ - public $invocationMatcher; - - /** - * @var mixed - */ - public $afterMatchBuilderId = NULL; - - /** - * @var boolean - */ - public $afterMatchBuilderIsInvoked = FALSE; - - /** - * @var PHPUnit_Framework_MockObject_Matcher_MethodName - */ - public $methodNameMatcher = NULL; - - /** - * @var PHPUnit_Framework_MockObject_Matcher_Parameters - */ - public $parametersMatcher = NULL; - - /** - * @var PHPUnit_Framework_MockObject_Stub - */ - public $stub = NULL; - - /** - * @param PHPUnit_Framework_MockObject_Matcher_Invocation $invocationMatcher - */ - public function __construct(PHPUnit_Framework_MockObject_Matcher_Invocation $invocationMatcher) - { - $this->invocationMatcher = $invocationMatcher; - } - - /** - * @return string - */ - public function toString() - { - $list = array(); - - if ($this->invocationMatcher !== NULL) { - $list[] = $this->invocationMatcher->toString(); - } - - if ($this->methodNameMatcher !== NULL) { - $list[] = 'where ' . $this->methodNameMatcher->toString(); - } - - if ($this->parametersMatcher !== NULL) { - $list[] = 'and ' . $this->parametersMatcher->toString(); - } - - if ($this->afterMatchBuilderId !== NULL) { - $list[] = 'after ' . $this->afterMatchBuilderId; - } - - if ($this->stub !== NULL) { - $list[] = 'will ' . $this->stub->toString(); - } - - return join(' ', $list); - } - - /** - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * @return mixed - */ - public function invoked(PHPUnit_Framework_MockObject_Invocation $invocation) - { - if ($this->invocationMatcher === NULL) { - throw new PHPUnit_Framework_Exception( - 'No invocation matcher is set' - ); - } - - if ($this->methodNameMatcher === NULL) { - throw new PHPUnit_Framework_Exception('No method matcher is set'); - } - - if ($this->afterMatchBuilderId !== NULL) { - $builder = $invocation->object - ->__phpunit_getInvocationMocker() - ->lookupId($this->afterMatchBuilderId); - - if (!$builder) { - throw new PHPUnit_Framework_Exception( - sprintf( - 'No builder found for match builder identification <%s>', - - $this->afterMatchBuilderId - ) - ); - } - - $matcher = $builder->getMatcher(); - - if ($matcher && $matcher->invocationMatcher->hasBeenInvoked()) { - $this->afterMatchBuilderIsInvoked = TRUE; - } - } - - $this->invocationMatcher->invoked($invocation); - - try { - if ( $this->parametersMatcher !== NULL && - !$this->parametersMatcher->matches($invocation)) { - $this->parametersMatcher->verify(); - } - } - - catch (PHPUnit_Framework_ExpectationFailedException $e) { - throw new PHPUnit_Framework_ExpectationFailedException( - sprintf( - "Expectation failed for %s when %s\n%s", - - $this->methodNameMatcher->toString(), - $this->invocationMatcher->toString(), - $e->getMessage() - ), - $e->getComparisonFailure() - ); - } - - if ($this->stub) { - return $this->stub->invoke($invocation); - } - - return NULL; - } - - /** - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * @return boolean - */ - public function matches(PHPUnit_Framework_MockObject_Invocation $invocation) - { - if ($this->afterMatchBuilderId !== NULL) { - $builder = $invocation->object - ->__phpunit_getInvocationMocker() - ->lookupId($this->afterMatchBuilderId); - - if (!$builder) { - throw new PHPUnit_Framework_Exception( - sprintf( - 'No builder found for match builder identification <%s>', - - $this->afterMatchBuilderId - ) - ); - } - - $matcher = $builder->getMatcher(); - - if (!$matcher) { - return FALSE; - } - - if (!$matcher->invocationMatcher->hasBeenInvoked()) { - return FALSE; - } - } - - if ($this->invocationMatcher === NULL) { - throw new PHPUnit_Framework_Exception( - 'No invocation matcher is set' - ); - } - - if ($this->methodNameMatcher === NULL) { - throw new PHPUnit_Framework_Exception('No method matcher is set'); - } - - if (!$this->invocationMatcher->matches($invocation)) { - return FALSE; - } - - try { - if (!$this->methodNameMatcher->matches($invocation)) { - return FALSE; - } - } - - catch (PHPUnit_Framework_ExpectationFailedException $e) { - throw new PHPUnit_Framework_ExpectationFailedException( - sprintf( - "Expectation failed for %s when %s\n%s", - - $this->methodNameMatcher->toString(), - $this->invocationMatcher->toString(), - $e->getMessage() - ), - $e->getComparisonFailure() - ); - } - - return TRUE; - } - - /** - * @throws PHPUnit_Framework_Exception - * @throws PHPUnit_Framework_ExpectationFailedException - */ - public function verify() - { - if ($this->invocationMatcher === NULL) { - throw new PHPUnit_Framework_Exception( - 'No invocation matcher is set' - ); - } - - if ($this->methodNameMatcher === NULL) { - throw new PHPUnit_Framework_Exception('No method matcher is set'); - } - - try { - $this->invocationMatcher->verify(); - - if ($this->parametersMatcher === NULL) { - $this->parametersMatcher = new PHPUnit_Framework_MockObject_Matcher_AnyParameters; - } - - $invocationIsAny = get_class($this->invocationMatcher) === 'PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount'; - if (!$invocationIsAny) { - $this->parametersMatcher->verify(); - } - } - - catch (PHPUnit_Framework_ExpectationFailedException $e) { - throw new PHPUnit_Framework_ExpectationFailedException( - sprintf( - "Expectation failed for %s when %s.\n%s", - - $this->methodNameMatcher->toString(), - $this->invocationMatcher->toString(), - $e->getMessage() - ) - ); - } - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Mocker for invocations which are sent from - * PHPUnit_Framework_MockObject_MockObject objects. - * - * Keeps track of all expectations and stubs as well as registering - * identifications for builders. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_InvocationMocker implements PHPUnit_Framework_MockObject_Stub_MatcherCollection, PHPUnit_Framework_MockObject_Invokable, PHPUnit_Framework_MockObject_Builder_Namespace -{ - /** - * @var PHPUnit_Framework_MockObject_Matcher_Invocation[] - */ - protected $matchers = array(); - - /** - * @var PHPUnit_Framework_MockObject_Builder_Match[] - */ - protected $builderMap = array(); - - /** - * @param PHPUnit_Framework_MockObject_Matcher_Invocation $matcher - */ - public function addMatcher(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) - { - $this->matchers[] = $matcher; - } - - /** - * @since Method available since Release 1.1.0 - */ - public function hasMatchers() - { - if (empty($this->matchers)) { - return FALSE; - } - - foreach ($this->matchers as $matcher) { - if (!$matcher instanceof PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount) { - return TRUE; - } - } - - return FALSE; - } - - /** - * @param mixed $id - * @return boolean|null - */ - public function lookupId($id) - { - if (isset($this->builderMap[$id])) { - return $this->builderMap[$id]; - } - - return NULL; - } - - /** - * @param mixed $id - * @param PHPUnit_Framework_MockObject_Builder_Match $builder - * @throws PHPUnit_Framework_Exception - */ - public function registerId($id, PHPUnit_Framework_MockObject_Builder_Match $builder) - { - if (isset($this->builderMap[$id])) { - throw new PHPUnit_Framework_Exception( - 'Match builder with id <' . $id . '> is already registered.' - ); - } - - $this->builderMap[$id] = $builder; - } - - /** - * @param PHPUnit_Framework_MockObject_Matcher_Invocation $matcher - * @return PHPUnit_Framework_MockObject_Builder_InvocationMocker - */ - public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) - { - return new PHPUnit_Framework_MockObject_Builder_InvocationMocker( - $this, $matcher - ); - } - - /** - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * @return mixed - */ - public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) - { - $exception = NULL; - $hasReturnValue = FALSE; - - if (strtolower($invocation->methodName) == '__tostring') { - $returnValue = ''; - } else { - $returnValue = NULL; - } - - foreach ($this->matchers as $match) { - try { - if ($match->matches($invocation)) { - $value = $match->invoked($invocation); - - if (!$hasReturnValue) { - $returnValue = $value; - $hasReturnValue = TRUE; - } - } - } - - catch (Exception $e) { - $exception = $e; - } - } - - if ($exception !== NULL) { - throw $exception; - } - - return $returnValue; - } - - /** - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * @return boolean - */ - public function matches(PHPUnit_Framework_MockObject_Invocation $invocation) - { - foreach ($this->matchers as $matcher) { - if (!$matcher->matches($invocation)) { - return FALSE; - } - } - - return TRUE; - } - - /** - * @return boolean - */ - public function verify() - { - foreach ($this->matchers as $matcher) { - $matcher->verify(); - } - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Represents a static invocation. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Invocation_Static implements PHPUnit_Framework_MockObject_Invocation, PHPUnit_Framework_SelfDescribing -{ - /** - * @var array - */ - protected static $uncloneableExtensions = array( - 'mysqli' => TRUE, - 'SQLite' => TRUE, - 'sqlite3' => TRUE, - 'tidy' => TRUE, - 'xmlwriter' => TRUE, - 'xsl' => TRUE - ); - - /** - * @var array - */ - protected static $uncloneableClasses = array( - 'Closure', - 'COMPersistHelper', - 'IteratorIterator', - 'RecursiveIteratorIterator', - 'SplFileObject', - 'PDORow', - 'ZipArchive' - ); - - /** - * @var string - */ - public $className; - - /** - * @var string - */ - public $methodName; - - /** - * @var array - */ - public $parameters; - - /** - * @param string $className - * @param string $methodname - * @param array $parameters - * @param boolean $cloneObjects - */ - public function __construct($className, $methodName, array $parameters, $cloneObjects = FALSE) - { - $this->className = $className; - $this->methodName = $methodName; - $this->parameters = $parameters; - - if (!$cloneObjects) { - return; - } - - foreach ($this->parameters as $key => $value) { - if (is_object($value)) { - $this->parameters[$key] = $this->cloneObject($value); - } - } - } - - /** - * @return string - */ - public function toString() - { - return sprintf( - "%s::%s(%s)", - - $this->className, - $this->methodName, - join( - ', ', - array_map( - array('PHPUnit_Util_Type', 'shortenedExport'), - $this->parameters - ) - ) - ); - } - - /** - * @param object $original - * @return object - */ - protected function cloneObject($original) - { - $cloneable = NULL; - $object = new ReflectionObject($original); - - // Check the blacklist before asking PHP reflection to work around - // https://bugs.php.net/bug.php?id=53967 - if ($object->isInternal() && - isset(self::$uncloneableExtensions[$object->getExtensionName()])) { - $cloneable = FALSE; - } - - if ($cloneable === NULL) { - foreach (self::$uncloneableClasses as $class) { - if ($original instanceof $class) { - $cloneable = FALSE; - break; - } - } - } - - if ($cloneable === NULL && method_exists($object, 'isCloneable')) { - $cloneable = $object->isCloneable(); - } - - if ($cloneable === NULL && $object->hasMethod('__clone')) { - $method = $object->getMethod('__clone'); - $cloneable = $method->isPublic(); - } - - if ($cloneable === NULL) { - $cloneable = TRUE; - } - - if ($cloneable) { - try { - return clone $original; - } - - catch (Exception $e) { - return $original; - } - } else { - return $original; - } - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Represents a non-static invocation. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Invocation_Object extends PHPUnit_Framework_MockObject_Invocation_Static -{ - /** - * @var object - */ - public $object; - - /** - * @param string $className - * @param string $methodname - * @param array $parameters - * @param object $object - * @param object $cloneObjects - */ - public function __construct($className, $methodName, array $parameters, $object, $cloneObjects = FALSE) - { - parent::__construct($className, $methodName, $parameters, $cloneObjects); - $this->object = $object; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Stubs a method by returning a user-defined value. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Stub_Return implements PHPUnit_Framework_MockObject_Stub -{ - protected $value; - - public function __construct($value) - { - $this->value = $value; - } - - public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) - { - return $this->value; - } - - public function toString() - { - return sprintf( - 'return user-specified value %s', - - PHPUnit_Util_Type::toString($this->value) - ); - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Stubs a method by returning a user-defined value. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Interface available since Release 1.0.0 - */ -interface PHPUnit_Framework_MockObject_Stub_MatcherCollection -{ - /** - * Adds a new matcher to the collection which can be used as an expectation - * or a stub. - * - * @param PHPUnit_Framework_MockObject_Matcher_Invocation $matcher - * Matcher for invocations to mock objects. - */ - public function addMatcher(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher); -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Stubs a method by returning an argument that was passed to the mocked method. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Stub_ReturnArgument extends PHPUnit_Framework_MockObject_Stub_Return -{ - protected $argumentIndex; - - public function __construct($argumentIndex) - { - $this->argumentIndex = $argumentIndex; - } - - public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) - { - if (isset($invocation->parameters[$this->argumentIndex])) { - return $invocation->parameters[$this->argumentIndex]; - } else { - return NULL; - } - } - - public function toString() - { - return sprintf('return argument #%d', $this->argumentIndex); - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @author Kris Wallsmith - * @copyright 2010 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.1.0 - */ - -/** - * Stubs a method by returning the current object. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @author Kris Wallsmith - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.1.0 - */ -class PHPUnit_Framework_MockObject_Stub_ReturnSelf implements PHPUnit_Framework_MockObject_Stub -{ - public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) - { - if (!$invocation instanceof PHPUnit_Framework_MockObject_Invocation_Object) { - throw new PHPUnit_Framework_Exception( - 'The current object can only be returned when mocking an ' . - 'object, not a static class.' - ); - } - - return $invocation->object; - } - - public function toString() - { - return 'return the current object'; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Oliver Schlicht - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Stubs a method by raising a user-defined exception. - * - * @package PHPUnit_MockObject - * @author Oliver Schlicht - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Stub_Exception implements PHPUnit_Framework_MockObject_Stub -{ - protected $exception; - - public function __construct(Exception $exception) - { - $this->exception = $exception; - } - - public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) - { - throw $this->exception; - } - - public function toString() - { - return sprintf( - 'raise user-specified exception %s', - - PHPUnit_Util_Type::toString($this->exception) - ); - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Patrick Müller - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Stubs a method by returning a user-defined stack of values. - * - * @package PHPUnit_MockObject - * @author Patrick Müller - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls implements PHPUnit_Framework_MockObject_Stub -{ - protected $stack; - protected $value; - - public function __construct($stack) - { - $this->stack = $stack; - } - - public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) - { - $this->value = array_shift($this->stack); - - if ($this->value instanceof PHPUnit_Framework_MockObject_Stub) { - $this->value = $this->value->invoke($invocation); - } - - return $this->value; - } - - public function toString() - { - return sprintf( - 'return user-specified value %s', - - PHPUnit_Util_Type::toString($this->value) - ); - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Stub_ReturnCallback implements PHPUnit_Framework_MockObject_Stub -{ - protected $callback; - - public function __construct($callback) - { - $this->callback = $callback; - } - - public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) - { - return call_user_func_array($this->callback, $invocation->parameters); - } - - public function toString() - { - if (is_array($this->callback)) { - if (is_object($this->callback[0])) { - $class = get_class($this->callback[0]); - $type = '->'; - } else { - $class = $this->callback[0]; - $type = '::'; - } - - return sprintf( - 'return result of user defined callback %s%s%s() with the ' . - 'passed arguments', - - $class, - $type, - $this->callback[1] - ); - } else { - return 'return result of user defined callback ' . $this->callback . - ' with the passed arguments'; - } - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.1.0 - */ - -/** - * Stubs a method by returning a value from a map. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.1.0 - */ -class PHPUnit_Framework_MockObject_Stub_ReturnValueMap implements PHPUnit_Framework_MockObject_Stub -{ - protected $valueMap; - - public function __construct(array $valueMap) - { - $this->valueMap = $valueMap; - } - - public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) - { - $parameterCount = count($invocation->parameters); - - foreach ($this->valueMap as $map) { - if (!is_array($map) || $parameterCount != count($map) - 1) { - continue; - } - - $return = array_pop($map); - if ($invocation->parameters === $map) { - return $return; - } - } - - return NULL; - } - - public function toString() - { - return 'return value from a map'; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Interface for classes which must verify a given expectation. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Interface available since Release 1.0.0 - */ -interface PHPUnit_Framework_MockObject_Verifiable -{ - /** - * Verifies that the current expectation is valid. If everything is OK the - * code should just return, if not it must throw an exception. - * - * @throws PHPUnit_Framework_ExpectationFailedException - */ - public function verify(); -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Interface for invocations. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Interface available since Release 1.0.0 - */ -interface PHPUnit_Framework_MockObject_Invocation -{ -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * An object that stubs the process of a normal method for a mock object. - * - * The stub object will replace the code for the stubbed method and return a - * specific value instead of the original value. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Interface available since Release 1.0.0 - */ -interface PHPUnit_Framework_MockObject_Stub extends PHPUnit_Framework_SelfDescribing -{ - /** - * Fakes the processing of the invocation $invocation by returning a - * specific value. - * - * @param PHPUnit_Framework_MockObject_Invocation $invocation - * The invocation which was mocked and matched by the current method - * and argument matchers. - * @return mixed - */ - public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation); -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Builder interface for parameter matchers. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Interface available since Release 1.0.0 - */ -interface PHPUnit_Framework_MockObject_Builder_ParametersMatch extends PHPUnit_Framework_MockObject_Builder_Match -{ - /** - * Sets the parameters to match for, each parameter to this funtion will - * be part of match. To perform specific matches or constraints create a - * new PHPUnit_Framework_Constraint and use it for the parameter. - * If the parameter value is not a constraint it will use the - * PHPUnit_Framework_Constraint_IsEqual for the value. - * - * Some examples: - * - * // match first parameter with value 2 - * $b->with(2); - * // match first parameter with value 'smock' and second identical to 42 - * $b->with('smock', new PHPUnit_Framework_Constraint_IsEqual(42)); - * - * - * @return PHPUnit_Framework_MockObject_Builder_ParametersMatch - */ - public function with(); - - /** - * Sets a matcher which allows any kind of parameters. - * - * Some examples: - * - * // match any number of parameters - * $b->withAnyParamers(); - * - * - * @return PHPUnit_Framework_MockObject_Matcher_AnyParameters - */ - public function withAnyParameters(); -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Builder interface for invocation order matches. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Interface available since Release 1.0.0 - */ -interface PHPUnit_Framework_MockObject_Builder_Match extends PHPUnit_Framework_MockObject_Builder_Stub -{ - /** - * Defines the expectation which must occur before the current is valid. - * - * @param string $id The identification of the expectation that should - * occur before this one. - * @return PHPUnit_Framework_MockObject_Builder_Stub - */ - public function after($id); -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Builder for mocked or stubbed invocations. - * - * Provides methods for building expectations without having to resort to - * instantiating the various matchers manually. These methods also form a - * more natural way of reading the expectation. This class should be together - * with the test case PHPUnit_Framework_MockObject_TestCase. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Framework_MockObject_Builder_InvocationMocker implements PHPUnit_Framework_MockObject_Builder_MethodNameMatch -{ - /** - * @var PHPUnit_Framework_MockObject_Stub_MatcherCollection - */ - protected $collection; - - /** - * @var PHPUnit_Framework_MockObject_Matcher - */ - protected $matcher; - - /** - * @param PHPUnit_Framework_MockObject_Stub_MatcherCollection $collection - * @param PHPUnit_Framework_MockObject_Matcher_Invocation $invocationMatcher - */ - public function __construct(PHPUnit_Framework_MockObject_Stub_MatcherCollection $collection, PHPUnit_Framework_MockObject_Matcher_Invocation $invocationMatcher) - { - $this->collection = $collection; - $this->matcher = new PHPUnit_Framework_MockObject_Matcher( - $invocationMatcher - ); - - $this->collection->addMatcher($this->matcher); - } - - /** - * @return PHPUnit_Framework_MockObject_Matcher - */ - public function getMatcher() - { - return $this->matcher; - } - - /** - * @param mixed $id - * @return PHPUnit_Framework_MockObject_Builder_InvocationMocker - */ - public function id($id) - { - $this->collection->registerId($id, $this); - - return $this; - } - - /** - * @param PHPUnit_Framework_MockObject_Stub $stub - * @return PHPUnit_Framework_MockObject_Builder_InvocationMocker - */ - public function will(PHPUnit_Framework_MockObject_Stub $stub) - { - $this->matcher->stub = $stub; - - return $this; - } - - /** - * @param mixed $id - * @return PHPUnit_Framework_MockObject_Builder_InvocationMocker - */ - public function after($id) - { - $this->matcher->afterMatchBuilderId = $id; - - return $this; - } - - /** - * @param mixed $argument, ... - * @return PHPUnit_Framework_MockObject_Builder_InvocationMocker - */ - public function with() - { - $args = func_get_args(); - - if ($this->matcher->methodNameMatcher === NULL) { - throw new PHPUnit_Framework_Exception( - 'Method name matcher is not defined, cannot define parameter ' . - ' matcher without one' - ); - } - - if ($this->matcher->parametersMatcher !== NULL) { - throw new PHPUnit_Framework_Exception( - 'Parameter matcher is already defined, cannot redefine' - ); - } - - $this->matcher->parametersMatcher = new PHPUnit_Framework_MockObject_Matcher_Parameters($args); - - return $this; - } - - /** - * @return PHPUnit_Framework_MockObject_Builder_InvocationMocker - */ - public function withAnyParameters() - { - if ($this->matcher->methodNameMatcher === NULL) { - throw new PHPUnit_Framework_Exception( - 'Method name matcher is not defined, cannot define parameter ' . - 'matcher without one' - ); - } - - if ($this->matcher->parametersMatcher !== NULL) { - throw new PHPUnit_Framework_Exception( - 'Parameter matcher is already defined, cannot redefine' - ); - } - - $this->matcher->parametersMatcher = new PHPUnit_Framework_MockObject_Matcher_AnyParameters; - - return $this; - } - - /** - * @param PHPUnit_Framework_Constraint|string $constraint - * @return PHPUnit_Framework_MockObject_Builder_InvocationMocker - */ - public function method($constraint) - { - if ($this->matcher->methodNameMatcher !== NULL) { - throw new PHPUnit_Framework_Exception( - 'Method name matcher is already defined, cannot redefine' - ); - } - - $this->matcher->methodNameMatcher = new PHPUnit_Framework_MockObject_Matcher_MethodName($constraint); - - return $this; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Interface for builders which can register builders with a given identification. - * - * This interface relates to PHPUnit_Framework_MockObject_Builder_Identity. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Interface available since Release 1.0.0 - */ -interface PHPUnit_Framework_MockObject_Builder_Namespace -{ - /** - * Looks up the match builder with identification $id and returns it. - * - * @param string $id The identifiction of the match builder. - * @return PHPUnit_Framework_MockObject_Builder_Match - */ - public function lookupId($id); - - /** - * Registers the match builder $builder with the identification $id. The - * builder can later be looked up using lookupId() to figure out if it - * has been invoked. - * - * @param string $id - * The identification of the match builder. - * @param PHPUnit_Framework_MockObject_Builder_Match $builder - * The builder which is being registered. - */ - public function registerId($id, PHPUnit_Framework_MockObject_Builder_Match $builder); -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Builder interface for matcher of method names. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Interface available since Release 1.0.0 - */ -interface PHPUnit_Framework_MockObject_Builder_MethodNameMatch extends PHPUnit_Framework_MockObject_Builder_ParametersMatch -{ - /** - * Adds a new method name match and returns the parameter match object for - * further matching possibilities. - * - * @param PHPUnit_Framework_Constraint $name - * Constraint for matching method, if a string is passed it will use - * the PHPUnit_Framework_Constraint_IsEqual. - * @return PHPUnit_Framework_MockObject_Builder_ParametersMatch - */ - public function method($name); -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Builder interface for unique identifiers. - * - * Defines the interface for recording unique identifiers. The identifiers - * can be used to define the invocation order of expectations. The expectation - * is recorded using id() and then defined in order using - * PHPUnit_Framework_MockObject_Builder_Match::after(). - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Interface available since Release 1.0.0 - */ -interface PHPUnit_Framework_MockObject_Builder_Identity -{ - /** - * Sets the identification of the expectation to $id. - * - * @note The identifier is unique per mock object. - * @param string $id Unique identifiation of expectation. - */ - public function id($id); -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Builder interface for stubs which are actions replacing an invocation. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Interface available since Release 1.0.0 - */ -interface PHPUnit_Framework_MockObject_Builder_Stub extends PHPUnit_Framework_MockObject_Builder_Identity -{ - /** - * Stubs the matching method with the stub object $stub. Any invocations of - * the matched method will now be handled by the stub instead. - * - * @param PHPUnit_Framework_MockObject_Stub $stub The stub object. - * @return PHPUnit_Framework_MockObject_Builder_Identity - */ - public function will(PHPUnit_Framework_MockObject_Stub $stub); -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since File available since Release 1.0.0 - */ - -/** - * Interface for all mock objects which are generated by - * PHPUnit_Framework_MockObject_Mock. - * - * @package PHPUnit_MockObject - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.2.3 - * @link http://github.com/sebastianbergmann/phpunit-mock-objects - * @since Interface available since Release 1.0.0 - */ -interface PHPUnit_Framework_MockObject_MockObject /*extends PHPUnit_Framework_MockObject_Verifiable*/ -{ - /** - * Registers a new expectation in the mock object and returns the match - * object which can be infused with further details. - * - * @param PHPUnit_Framework_MockObject_Matcher_Invocation $matcher - * @return PHPUnit_Framework_MockObject_Builder_InvocationMocker - */ - public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher); - - /** - * Registers a new static expectation in the mock object and returns the - * match object which can be infused with further details. - * - * @param PHPUnit_Framework_MockObject_Matcher_Invocation $matcher - * @return PHPUnit_Framework_MockObject_Builder_InvocationMocker - */ - public static function staticExpects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher); - - /** - * @return PHPUnit_Framework_MockObject_InvocationMocker - */ - public function __phpunit_getInvocationMocker(); - - /** - * @return PHPUnit_Framework_MockObject_InvocationMocker - */ - public static function __phpunit_getStaticInvocationMocker(); - - /** - * Verifies that the current expectation is valid. If everything is OK the - * code should just return, if not it must throw an exception. - * - * @throws PHPUnit_Framework_ExpectationFailedException - */ - public function __phpunit_verify(); -} -PHPUnit_MockObject 1.2 -====================== - -This is the list of changes for the PHPUnit_MockObject 1.2 release series. - -PHPUnit_MockObject 1.2.3 ------------------------- - -* Fixed a bug where getting two mocks with different argument cloning options returned the same mock. - -PHPUnit_MockObject 1.2.2 ------------------------- - -* Fixed #100: Removed the unique mock object ID introduced in version 1.2. - -PHPUnit_MockObject 1.2.1 ------------------------- - -* No changes. - -PHPUnit_MockObject 1.2.0 ------------------------- - -* Implemented #47: Make cloning of arguments passed to mocked methods optional. -* Implemented #84: `getMockFromWsdl()` now works with namespaces. -* Fixed #90: Mocks with a fixed class name could only be created once. - -PHPUnit_Selenium - -Copyright (c) 2002-2013, Sebastian Bergmann . -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of Sebastian Bergmann nor the names of his - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - * @since File available since Release 1.2.2 - */ - -/** - * TestSuite class for Selenium 1 tests - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.1 - * @link http://www.phpunit.de/ - * @since Class available since Release 1.2.0 - */ -class PHPUnit_Extensions_SeleniumTestSuite extends PHPUnit_Framework_TestSuite -{ - /** - * Overriding the default: Selenium suites are always built from a TestCase class. - * @var boolean - */ - protected $testCase = TRUE; - - /** - * Making the method public. - */ - public function addTestMethod(ReflectionClass $class, ReflectionMethod $method) - { - return parent::addTestMethod($class, $method); - } - - /** - * @param string $className extending PHPUnit_Extensions_SeleniumTestCase - * @return PHPUnit_Extensions_SeleniumTestSuite - */ - public static function fromTestCaseClass($className) - { - $suite = new self(); - $suite->setName($className); - - $class = new ReflectionClass($className); - $classGroups = PHPUnit_Util_Test::getGroups($className); - $staticProperties = $class->getStaticProperties(); - - //BC: renamed seleneseDirectory -> selenesePath - if (!isset($staticProperties['selenesePath']) && isset($staticProperties['seleneseDirectory'])) { - $staticProperties['selenesePath'] = $staticProperties['seleneseDirectory']; - } - - // Create tests from Selenese/HTML files. - if (isset($staticProperties['selenesePath']) && - (is_dir($staticProperties['selenesePath']) || is_file($staticProperties['selenesePath']))) { - - if (is_dir($staticProperties['selenesePath'])) { - $files = array_merge( - self::getSeleneseFiles($staticProperties['selenesePath'], '.htm'), - self::getSeleneseFiles($staticProperties['selenesePath'], '.html') - ); - } else { - $files[] = realpath($staticProperties['selenesePath']); - } - - // Create tests from Selenese/HTML files for multiple browsers. - if (!empty($staticProperties['browsers'])) { - foreach ($staticProperties['browsers'] as $browser) { - $browserSuite = PHPUnit_Extensions_SeleniumBrowserSuite::fromClassAndBrowser($className, $browser); - - foreach ($files as $file) { - self::addGeneratedTestTo($browserSuite, - new $className($file, array(), '', $browser), - $classGroups - ); - } - - $suite->addTest($browserSuite); - } - } - else { - // Create tests from Selenese/HTML files for single browser. - foreach ($files as $file) { - self::addGeneratedTestTo($suite, - new $className($file), - $classGroups); - } - } - } - - // Create tests from test methods for multiple browsers. - if (!empty($staticProperties['browsers'])) { - foreach ($staticProperties['browsers'] as $browser) { - $browserSuite = PHPUnit_Extensions_SeleniumBrowserSuite::fromClassAndBrowser($className, $browser); - foreach ($class->getMethods() as $method) { - $browserSuite->addTestMethod($class, $method); - } - $browserSuite->setupSpecificBrowser($browser); - - $suite->addTest($browserSuite); - } - } - else { - // Create tests from test methods for single browser. - foreach ($class->getMethods() as $method) { - $suite->addTestMethod($class, $method); - } - } - - return $suite; - } - - private static function addGeneratedTestTo(PHPUnit_Framework_TestSuite $suite, PHPUnit_Framework_TestCase $test, $classGroups) - { - list ($methodName, ) = explode(' ', $test->getName()); - $test->setDependencies( - PHPUnit_Util_Test::getDependencies(get_class($test), $methodName) - ); - $suite->addTest($test, $classGroups); - } - - /** - * @param string $directory - * @param string $suffix - * @return array - */ - private static function getSeleneseFiles($directory, $suffix) - { - $facade = new File_Iterator_Facade; - - return $facade->getFilesAsArray($directory, $suffix); - } - -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - * @since File available since Release 1.2.0 - */ - -/** - * TestCase class that uses Selenium 2 - * (WebDriver API and JsonWire protocol) to provide - * the functionality required for web testing. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.1 - * @link http://www.phpunit.de/ - * @since Class available since Release 1.2.0 - * @method void acceptAlert() Press OK on an alert, or confirms a dialog - * @method mixed alertText() alertText($value = NULL) Gets the alert dialog text, or sets the text for a prompt dialog - * @method void back() - * @method \PHPUnit_Extensions_Selenium2TestCase_Element byClassName() byClassName($value) - * @method \PHPUnit_Extensions_Selenium2TestCase_Element byCssSelector() byCssSelector($value) - * @method \PHPUnit_Extensions_Selenium2TestCase_Element byId() byId($value) - * @method \PHPUnit_Extensions_Selenium2TestCase_Element byLinkText() byLinkText($value) - * @method \PHPUnit_Extensions_Selenium2TestCase_Element byName() byName($value) - * @method \PHPUnit_Extensions_Selenium2TestCase_Element byTag() byTag($value) - * @method \PHPUnit_Extensions_Selenium2TestCase_Element byXPath() byXPath($value) - * @method void click() click(int $button = 0) Click any mouse button (at the coordinates set by the last moveto command). - * @method void clickOnElement() clickOnElement($id) - * @method string currentScreenshot() BLOB of the image file - * @method void dismissAlert() Press Cancel on an alert, or does not confirm a dialog - * @method \PHPUnit_Extensions_Selenium2TestCase_Element element() element(\PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria) Retrieves an element - * @method array elements() elements(\PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria) Retrieves an array of Element instances - * @method string execute() execute($javaScriptCode) Injects arbitrary JavaScript in the page and returns the last - * @method string executeAsync() executeAsync($javaScriptCode) Injects arbitrary JavaScript and wait for the callback (last element of arguments) to be called - * @method void forward() - * @method void frame() frame(mixed $element) Changes the focus to a frame in the page (by frameCount of type int, htmlId of type string, htmlName of type string or element of type \PHPUnit_Extensions_Selenium2TestCase_Element) - * @method void moveto() moveto(\PHPUnit_Extensions_Selenium2TestCase_Element $element) Move the mouse by an offset of the specificed element. - * @method void refresh() - * @method \PHPUnit_Extensions_Selenium2TestCase_Element_Select select() select($element) - * @method string source() Returns the HTML source of the page - * @method \PHPUnit_Extensions_Selenium2TestCase_Session_Timeouts timeouts() - * @method string title() - * @method void|string url() url($url = NULL) - * @method PHPUnit_Extensions_Selenium2TestCase_ElementCriteria using() using($strategy) Factory Method for Criteria objects - * @method void window() window($name) Changes the focus to another window - * @method string windowHandle() Retrieves the current window handle - * @method string windowHandles() Retrieves a list of all available window handles - * @method string keys() Send a sequence of key strokes to the active element. - * @method void closeWindow() Close the current window. - */ -abstract class PHPUnit_Extensions_Selenium2TestCase extends PHPUnit_Framework_TestCase -{ - const VERSION = '1.3.1'; - - /** - * @var string override to provide code coverage data from the server - */ - protected $coverageScriptUrl; - - /** - * @var PHPUnit_Extensions_Selenium2TestCase_Session - */ - private $session; - - /** - * @var array - */ - private $parameters; - - /** - * @var PHPUnit_Extensions_Selenium2TestCase_SessionStrategy - */ - protected static $sessionStrategy; - - /** - * @var PHPUnit_Extensions_Selenium2TestCase_SessionStrategy - */ - protected static $browserSessionStrategy; - - /** - * @var PHPUnit_Extensions_Selenium2TestCase_SessionStrategy - */ - protected $localSessionStrategy; - - /** - * @var array - */ - private static $lastBrowserParams; - - /** - * @var string - */ - private $testId; - - /** - * @var boolean - */ - private $collectCodeCoverageInformation; - - /** - * @var PHPUnit_Extensions_Selenium2TestCase_KeysHolder - */ - private $keysHolder; - - /** - * @param boolean - */ - public static function shareSession($shareSession) - { - if (!is_bool($shareSession)) { - throw new InvalidArgumentException("The shared session support can only be switched on or off."); - } - if (!$shareSession) { - self::$sessionStrategy = self::defaultSessionStrategy(); - } else { - self::$sessionStrategy = new PHPUnit_Extensions_Selenium2TestCase_SessionStrategy_Shared(self::defaultSessionStrategy()); - } - } - - private static function sessionStrategy() - { - if (!self::$sessionStrategy) { - self::$sessionStrategy = self::defaultSessionStrategy(); - } - return self::$sessionStrategy; - } - - private static function defaultSessionStrategy() - { - return new PHPUnit_Extensions_Selenium2TestCase_SessionStrategy_Isolated; - } - - public function __construct($name = NULL, array $data = array(), $dataName = '') - { - parent::__construct($name, $data, $dataName); - $this->parameters = array( - 'host' => 'localhost', - 'port' => 4444, - 'browser' => NULL, - 'browserName' => NULL, - 'desiredCapabilities' => array(), - 'seleniumServerRequestsTimeout' => 60 - ); - - $this->keysHolder = new PHPUnit_Extensions_Selenium2TestCase_KeysHolder(); - } - - public function setupSpecificBrowser($params) - { - $this->setUpSessionStrategy($params); - $params = array_merge($this->parameters, $params); - $this->setHost($params['host']); - $this->setPort($params['port']); - $this->setBrowser($params['browserName']); - $this->parameters['browser'] = $params['browser']; - $this->setDesiredCapabilities($params['desiredCapabilities']); - $this->setSeleniumServerRequestsTimeout( - $params['seleniumServerRequestsTimeout']); - } - - protected function setUpSessionStrategy($params) - { - // This logic enables us to have a session strategy reused for each - // item in self::$browsers. We don't want them both to share one - // and we don't want each test for a specific browser to have a - // new strategy - if ($params == self::$lastBrowserParams) { - // do nothing so we use the same session strategy for this - // browser - } elseif (isset($params['sessionStrategy'])) { - $strat = $params['sessionStrategy']; - if ($strat != "isolated" && $strat != "shared") { - throw new InvalidArgumentException("Session strategy must be either 'isolated' or 'shared'"); - } elseif ($strat == "isolated") { - self::$browserSessionStrategy = new PHPUnit_Extensions_Selenium2TestCase_SessionStrategy_Isolated; - } else { - self::$browserSessionStrategy = new PHPUnit_Extensions_Selenium2TestCase_SessionStrategy_Shared(self::defaultSessionStrategy()); - } - } else { - self::$browserSessionStrategy = self::defaultSessionStrategy(); - } - self::$lastBrowserParams = $params; - $this->localSessionStrategy = self::$browserSessionStrategy; - - } - - private function getStrategy() - { - if ($this->localSessionStrategy) - return $this->localSessionStrategy; - else - return self::sessionStrategy(); - } - - public function prepareSession() - { - try { - if (!$this->session) { - $this->session = $this->getStrategy()->session($this->parameters); - } - } catch (PHPUnit_Extensions_Selenium2TestCase_NoSeleniumException $e) { - $this->markTestSkipped("The Selenium Server is not active on host {$this->parameters['host']} at port {$this->parameters['port']}."); - } - return $this->session; - } - - public function run(PHPUnit_Framework_TestResult $result = NULL) - { - $this->testId = get_class($this) . '__' . $this->getName(); - - if ($result === NULL) { - $result = $this->createResult(); - } - - - $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation(); - - parent::run($result); - - if ($this->collectCodeCoverageInformation) { - $coverage = new PHPUnit_Extensions_SeleniumCommon_RemoteCoverage( - $this->coverageScriptUrl, - $this->testId - ); - $result->getCodeCoverage()->append( - $coverage->get(), $this - ); - } - - // do not call this before to give the time to the Listeners to run - $this->getStrategy()->endOfTest($this->session); - - return $result; - } - - /** - * @throws RuntimeException - */ - protected function runTest() - { - $this->prepareSession(); - - $thrownException = NULL; - - if ($this->collectCodeCoverageInformation) { - $this->session->cookie()->remove('PHPUNIT_SELENIUM_TEST_ID'); - $this->session->cookie()->add('PHPUNIT_SELENIUM_TEST_ID', $this->testId)->set(); - } - - try { - $this->setUpPage(); - $result = parent::runTest(); - - if (!empty($this->verificationErrors)) { - $this->fail(implode("\n", $this->verificationErrors)); - } - } catch (Exception $e) { - $thrownException = $e; - } - - - if (NULL !== $thrownException) { - throw $thrownException; - } - - return $result; - } - - - public static function suite($className) - { - return PHPUnit_Extensions_SeleniumTestSuite::fromTestCaseClass($className); - } - - public function onNotSuccessfulTest(Exception $e) - { - $this->getStrategy()->notSuccessfulTest(); - parent::onNotSuccessfulTest($e); - } - - /** - * Delegate method calls to the Session. - * - * @param string $command - * @param array $arguments - * @return mixed - */ - public function __call($command, $arguments) - { - if ($this->session === NULL) { - throw new PHPUnit_Extensions_Selenium2TestCase_Exception("There is currently no active session to execute the '$command' command. You're probably trying to set some option in setUp() with an incorrect setter name. You may consider using setUpPage() instead."); - } - $result = call_user_func_array( - array($this->session, $command), $arguments - ); - - return $result; - } - - /** - * @param string $host - * @throws InvalidArgumentException - */ - public function setHost($host) - { - if (!is_string($host)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); - } - - $this->parameters['host'] = $host; - } - - public function getHost() - { - return $this->parameters['host']; - } - - /** - * @param integer $port - * @throws InvalidArgumentException - */ - public function setPort($port) - { - if (!is_int($port)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer'); - } - - $this->parameters['port'] = $port; - } - - public function getPort() - { - return $this->parameters['port']; - } - - /** - * @param string $browser - * @throws InvalidArgumentException - */ - public function setBrowser($browserName) - { - if (!is_string($browserName)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); - } - - $this->parameters['browserName'] = $browserName; - } - - public function getBrowser() - { - return $this->parameters['browserName']; - } - - /** - * @param string $browserUrl - * @throws InvalidArgumentException - */ - public function setBrowserUrl($browserUrl) - { - if (!is_string($browserUrl)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); - } - - $this->parameters['browserUrl'] = new PHPUnit_Extensions_Selenium2TestCase_URL($browserUrl); - } - - public function getBrowserUrl() - { - if (isset($this->parameters['browserUrl'])) { - return $this->parameters['browserUrl']; - } - return ''; - } - - /** - * @see http://code.google.com/p/selenium/wiki/JsonWireProtocol - */ - public function setDesiredCapabilities(array $capabilities) - { - $this->parameters['desiredCapabilities'] = $capabilities; - } - - - public function getDesiredCapabilities() - { - return $this->parameters['desiredCapabilities']; - } - - /** - * @param int $timeout seconds - */ - public function setSeleniumServerRequestsTimeout($timeout) - { - $this->parameters['seleniumServerRequestsTimeout'] = $timeout; - } - - public function getSeleniumServerRequestsTimeout() - { - return $this->parameters['seleniumServerRequestsTimeout']; - } - - /** - * Get test id (generated internally) - * @return string - */ - public function getTestId() - { - return $this->testId; - } - - /** - * Get Selenium2 current session id - * @return string - */ - public function getSessionId() - { - if ($this->session) - return $this->session->id(); - - return FALSE; - } - - /** - * Wait until callback isn't null or timeout occurs - * - * @param $callback - * @param null $timeout - * @return mixed - */ - public function waitUntil($callback, $timeout = null) - { - $waitUntil = new PHPUnit_Extensions_Selenium2TestCase_WaitUntil($this); - return $waitUntil->run($callback, $timeout); - } - - /** - * Sends a special key - * Deprecated due to issues with IE webdriver. Use keys() method instead - * @deprecated - * @param string $name - * @throws PHPUnit_Extensions_Selenium2TestCase_Exception - * @see PHPUnit_Extensions_Selenium2TestCase_KeysHolder - */ - public function keysSpecial($name) - { - $names = explode(',', $name); - - foreach ($names as $key) { - $this->keys($this->keysHolder->specialKey(trim($key))); - } - } - - /** - * setUp method that is called after the session has been prepared. - * It is possible to use session-specific commands like url() here. - */ - public function setUpPage() - { - - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - * @since File available since Release 1.0.0 - */ - -/** - * Implementation of the Selenium RC client/server protocol. - * - * @package PHPUnit_Selenium - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.1 - * @link http://www.phpunit.de/ - * @since Class available since Release 1.0.0 - */ -class PHPUnit_Extensions_SeleniumTestCase_Driver -{ - /** - * @var PHPUnit_Extensions_SeleniumTestCase - */ - protected $testCase; - - /** - * @var string - */ - protected $testId; - - /** - * @var string - */ - protected $name; - - /** - * @var string - */ - protected $browser; - - /** - * @var string - */ - protected $browserUrl; - - /** - * @var boolean - */ - protected $collectCodeCoverageInformation = FALSE; - - /** - * @var string - */ - protected $host = 'localhost'; - - /** - * @var integer - */ - protected $port = 4444; - - /** - * @var integer - */ - protected $httpTimeout = 45; - - /** - * @var integer - */ - protected $seleniumTimeout = 30; - - /** - * @var string - */ - protected $sessionId; - - /** - * @var integer - */ - protected $sleep = 0; - - /** - * @var boolean - */ - protected $useWaitForPageToLoad = TRUE; - - /** - * @var boolean - */ - protected $wait = 5; - - /** - * @var array - */ - protected static $autoGeneratedCommands = array(); - - /** - * @var array - */ - protected $commands = array(); - - /** - * @var array $userCommands A numerical array which holds custom user commands. - */ - protected $userCommands = array(); - - /** - * @var array - */ - protected $verificationErrors = array(); - - /** - * @var array - */ - private $webDriverCapabilities; - - public function __construct() - { - if (empty(self::$autoGeneratedCommands)) { - self::autoGenerateCommands(); - } - } - - /** - * Only browserName is supported. - */ - public function setWebDriverCapabilities(array $capabilities) - { - $this->webDriverCapabilities = $capabilities; - } - - /** - * @return string - */ - public function start() - { - if ($this->browserUrl == NULL) { - throw new PHPUnit_Framework_Exception( - 'setBrowserUrl() needs to be called before start().' - ); - } - - if ($this->webDriverCapabilities !== NULL) { - $seleniumServerUrl = PHPUnit_Extensions_Selenium2TestCase_URL::fromHostAndPort($this->host, $this->port); - $driver = new PHPUnit_Extensions_Selenium2TestCase_Driver($seleniumServerUrl); - $session = $driver->startSession($this->webDriverCapabilities, new PHPUnit_Extensions_Selenium2TestCase_URL($this->browserUrl)); - $webDriverSessionId = $session->id(); - $this->sessionId = $this->getString( - 'getNewBrowserSession', - array($this->browser, $this->browserUrl, '', - "webdriver.remote.sessionid=$webDriverSessionId") - ); - - $this->doCommand('setTimeout', array($this->seleniumTimeout * 1000)); - } - - if (!isset($this->sessionId)) { - $this->sessionId = $this->getString( - 'getNewBrowserSession', - array($this->browser, $this->browserUrl) - ); - - $this->doCommand('setTimeout', array($this->seleniumTimeout * 1000)); - } - - return $this->sessionId; - } - - /** - * @return string - * @since Method available since Release 1.1.0 - */ - public function getSessionId() - { - return $this->sessionId; - } - - /** - * @param string - * @since Method available since Release 1.2.0 - */ - public function setSessionId($sessionId) - { - $this->sessionId = $sessionId; - } - - /** - */ - public function stop() - { - if (!isset($this->sessionId)) { - return; - } - - $this->doCommand('testComplete'); - - $this->sessionId = NULL; - } - - /** - * @param boolean $flag - * @throws InvalidArgumentException - */ - public function setCollectCodeCoverageInformation($flag) - { - if (!is_bool($flag)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'boolean'); - } - - $this->collectCodeCoverageInformation = $flag; - } - - /** - * @param PHPUnit_Extensions_SeleniumTestCase $testCase - */ - public function setTestCase(PHPUnit_Extensions_SeleniumTestCase $testCase) - { - $this->testCase = $testCase; - } - - /** - * @param integer $testId - */ - public function setTestId($testId) - { - $this->testId = $testId; - } - - /** - * @param string $name - * @throws InvalidArgumentException - */ - public function setName($name) - { - if (!is_string($name)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); - } - - $this->name = $name; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $browser - * @throws InvalidArgumentException - */ - public function setBrowser($browser) - { - if (!is_string($browser)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); - } - - $this->browser = $browser; - } - - /** - * @return string - */ - public function getBrowser() - { - return $this->browser; - } - - /** - * @param string $browserUrl - * @throws InvalidArgumentException - */ - public function setBrowserUrl($browserUrl) - { - if (!is_string($browserUrl)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); - } - - $this->browserUrl = $browserUrl; - } - - /** - * @param string $host - * @throws InvalidArgumentException - */ - public function setHost($host) - { - if (!is_string($host)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); - } - - $this->host = $host; - } - - /** - * @return string - * @since Method available since Release 1.1.0 - */ - public function getHost() - { - return $this->host; - } - - /** - * @param integer $port - * @throws InvalidArgumentException - */ - public function setPort($port) - { - if (!is_int($port)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer'); - } - - $this->port = $port; - } - - /** - * @return integer - * @since Method available since Release 1.1.0 - */ - public function getPort() - { - return $this->port; - } - - /** - * @param integer $timeout for Selenium RC in seconds - * @throws InvalidArgumentException - */ - public function setTimeout($timeout) - { - if (!is_int($timeout)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer'); - } - - $this->seleniumTimeout = $timeout; - } - - /** - * @param integer $timeout for HTTP connection to Selenium RC in seconds - * @throws InvalidArgumentException - */ - public function setHttpTimeout($timeout) - { - if (!is_int($timeout)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer'); - } - - $this->httpTimeout = $timeout; - } - - /** - * @param integer $seconds - * @throws InvalidArgumentException - */ - public function setSleep($seconds) - { - if (!is_int($seconds)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer'); - } - - $this->sleep = $seconds; - } - - /** - * Sets the number of seconds to sleep() after *AndWait commands - * when setWaitForPageToLoad(FALSE) is used. - * - * @param integer $seconds - * @throws InvalidArgumentException - */ - public function setWait($seconds) - { - if (!is_int($seconds)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer'); - } - - $this->wait = $seconds; - } - - /** - * Sets whether waitForPageToLoad (TRUE) or sleep() (FALSE) - * is used after *AndWait commands. - * - * @param boolean $flag - * @throws InvalidArgumentException - */ - public function setWaitForPageToLoad($flag) - { - if (!is_bool($flag)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'boolean'); - } - - $this->useWaitForPageToLoad = $flag; - } - - /** - * Adds allowed user commands into {@link self::$userCommands}. See - * {@link self::__call()} (switch/case -> default) for usage. - * - * @param string $command A command. - * - * @return $this - * @see self::__call() - */ - public function addUserCommand($command) - { - if (!is_string($command)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); - } - $this->userCommands[] = $command; - return $this; - } - - /** - * This method implements the Selenium RC protocol. - * - * @param string $command - * @param array $arguments - * @return mixed - * @method unknown addLocationStrategy() - * @method unknown addLocationStrategyAndWait() - * @method unknown addScript() - * @method unknown addScriptAndWait() - * @method unknown addSelection() - * @method unknown addSelectionAndWait() - * @method unknown allowNativeXpath() - * @method unknown allowNativeXpathAndWait() - * @method unknown altKeyDown() - * @method unknown altKeyDownAndWait() - * @method unknown altKeyUp() - * @method unknown altKeyUpAndWait() - * @method unknown answerOnNextPrompt() - * @method unknown assignId() - * @method unknown assignIdAndWait() - * @method unknown attachFile() - * @method unknown break() - * @method unknown captureEntirePageScreenshot() - * @method unknown captureEntirePageScreenshotAndWait() - * @method unknown captureEntirePageScreenshotToStringAndWait() - * @method unknown captureScreenshotAndWait() - * @method unknown captureScreenshotToStringAndWait() - * @method unknown check() - * @method unknown checkAndWait() - * @method unknown chooseCancelOnNextConfirmation() - * @method unknown chooseCancelOnNextConfirmationAndWait() - * @method unknown chooseOkOnNextConfirmation() - * @method unknown chooseOkOnNextConfirmationAndWait() - * @method unknown click() - * @method unknown clickAndWait() - * @method unknown clickAt() - * @method unknown clickAtAndWait() - * @method unknown close() - * @method unknown contextMenu() - * @method unknown contextMenuAndWait() - * @method unknown contextMenuAt() - * @method unknown contextMenuAtAndWait() - * @method unknown controlKeyDown() - * @method unknown controlKeyDownAndWait() - * @method unknown controlKeyUp() - * @method unknown controlKeyUpAndWait() - * @method unknown createCookie() - * @method unknown createCookieAndWait() - * @method unknown deleteAllVisibleCookies() - * @method unknown deleteAllVisibleCookiesAndWait() - * @method unknown deleteCookie() - * @method unknown deleteCookieAndWait() - * @method unknown deselectPopUp() - * @method unknown deselectPopUpAndWait() - * @method unknown doubleClick() - * @method unknown doubleClickAndWait() - * @method unknown doubleClickAt() - * @method unknown doubleClickAtAndWait() - * @method unknown dragAndDrop() - * @method unknown dragAndDropAndWait() - * @method unknown dragAndDropToObject() - * @method unknown dragAndDropToObjectAndWait() - * @method unknown dragDrop() - * @method unknown dragDropAndWait() - * @method unknown echo() - * @method unknown fireEvent() - * @method unknown fireEventAndWait() - * @method unknown focus() - * @method unknown focusAndWait() - * @method string getAlert() - * @method array getAllButtons() - * @method array getAllFields() - * @method array getAllLinks() - * @method array getAllWindowIds() - * @method array getAllWindowNames() - * @method array getAllWindowTitles() - * @method string getAttribute(string $attributeLocator) - * @method array getAttributeFromAllWindows(string $attributeName) - * @method string getBodyText() - * @method string getConfirmation() - * @method string getCookie() - * @method string getCookieByName(string $name) - * @method integer getCssCount(string $locator) - * @method integer getCursorPosition(string $locator) - * @method integer getElementHeight(string $locator) - * @method integer getElementIndex(string $locator) - * @method integer getElementPositionLeft(string $locator) - * @method integer getElementPositionTop(string $locator) - * @method integer getElementWidth(string $locator) - * @method string getEval(string $script) - * @method string getExpression(string $expression) - * @method string getHtmlSource() - * @method string getLocation() - * @method string getLogMessages() - * @method integer getMouseSpeed() - * @method string getPrompt() - * @method array getSelectOptions(string $selectLocator) - * @method string getSelectedId(string $selectLocator) - * @method array getSelectedIds(string $selectLocator) - * @method string getSelectedIndex(string $selectLocator) - * @method array getSelectedIndexes(string $selectLocator) - * @method string getSelectedLabel(string $selectLocator) - * @method array getSelectedLabels(string $selectLocator) - * @method string getSelectedValue(string $selectLocator) - * @method array getSelectedValues(string $selectLocator) - * @method unknown getSpeed() - * @method unknown getSpeedAndWait() - * @method string getTable(string $tableCellAddress) - * @method string getText(string $locator) - * @method string getTitle() - * @method string getValue(string $locator) - * @method boolean getWhetherThisFrameMatchFrameExpression(string $currentFrameString, string $target) - * @method boolean getWhetherThisWindowMatchWindowExpression(string $currentWindowString, string $target) - * @method integer getXpathCount(string $xpath) - * @method unknown goBack() - * @method unknown goBackAndWait() - * @method unknown highlight(string $locator) - * @method unknown highlightAndWait(string $locator) - * @method unknown ignoreAttributesWithoutValue(string $ignore) - * @method unknown ignoreAttributesWithoutValueAndWait(string $ignore) - * @method boolean isAlertPresent() - * @method boolean isChecked(locator) - * @method boolean isConfirmationPresent() - * @method boolean isCookiePresent(string $name) - * @method boolean isEditable(string $locator) - * @method boolean isElementPresent(string $locator) - * @method boolean isOrdered(string $locator1, string $locator2) - * @method boolean isPromptPresent() - * @method boolean isSomethingSelected(string $selectLocator) - * @method boolean isTextPresent(pattern) - * @method boolean isVisible(locator) - * @method unknown keyDown() - * @method unknown keyDownAndWait() - * @method unknown keyDownNative() - * @method unknown keyDownNativeAndWait() - * @method unknown keyPress() - * @method unknown keyPressAndWait() - * @method unknown keyPressNative() - * @method unknown keyPressNativeAndWait() - * @method unknown keyUp() - * @method unknown keyUpAndWait() - * @method unknown keyUpNative() - * @method unknown keyUpNativeAndWait() - * @method unknown metaKeyDown() - * @method unknown metaKeyDownAndWait() - * @method unknown metaKeyUp() - * @method unknown metaKeyUpAndWait() - * @method unknown mouseDown() - * @method unknown mouseDownAndWait() - * @method unknown mouseDownAt() - * @method unknown mouseDownAtAndWait() - * @method unknown mouseMove() - * @method unknown mouseMoveAndWait() - * @method unknown mouseMoveAt() - * @method unknown mouseMoveAtAndWait() - * @method unknown mouseOut() - * @method unknown mouseOutAndWait() - * @method unknown mouseOver() - * @method unknown mouseOverAndWait() - * @method unknown mouseUp() - * @method unknown mouseUpAndWait() - * @method unknown mouseUpAt() - * @method unknown mouseUpAtAndWait() - * @method unknown mouseUpRight() - * @method unknown mouseUpRightAndWait() - * @method unknown mouseUpRightAt() - * @method unknown mouseUpRightAtAndWait() - * @method unknown open() - * @method unknown openWindow() - * @method unknown openWindowAndWait() - * @method unknown pause() - * @method unknown refresh() - * @method unknown refreshAndWait() - * @method unknown removeAllSelections() - * @method unknown removeAllSelectionsAndWait() - * @method unknown removeScript() - * @method unknown removeScriptAndWait() - * @method unknown removeSelection() - * @method unknown removeSelectionAndWait() - * @method unknown retrieveLastRemoteControlLogs() - * @method unknown rollup() - * @method unknown rollupAndWait() - * @method unknown runScript() - * @method unknown runScriptAndWait() - * @method unknown select() - * @method unknown selectAndWait() - * @method unknown selectFrame() - * @method unknown selectPopUp() - * @method unknown selectPopUpAndWait() - * @method unknown selectWindow() - * @method unknown setBrowserLogLevel() - * @method unknown setBrowserLogLevelAndWait() - * @method unknown setContext() - * @method unknown setCursorPosition() - * @method unknown setCursorPositionAndWait() - * @method unknown setMouseSpeed() - * @method unknown setMouseSpeedAndWait() - * @method unknown setSpeed() - * @method unknown setSpeedAndWait() - * @method unknown shiftKeyDown() - * @method unknown shiftKeyDownAndWait() - * @method unknown shiftKeyUp() - * @method unknown shiftKeyUpAndWait() - * @method unknown shutDownSeleniumServer() - * @method unknown store() - * @method unknown submit() - * @method unknown submitAndWait() - * @method unknown type() - * @method unknown typeAndWait() - * @method unknown typeKeys() - * @method unknown typeKeysAndWait() - * @method unknown uncheck() - * @method unknown uncheckAndWait() - * @method unknown useXpathLibrary() - * @method unknown useXpathLibraryAndWait() - * @method unknown waitForCondition() - * @method unknown waitForElementPresent() - * @method unknown waitForElementNotPresent() - * @method unknown waitForPageToLoad() - * @method unknown waitForPopUp() - * @method unknown windowFocus() - * @method unknown windowMaximize() - */ - public function __call($command, $arguments) - { - $arguments = $this->preprocessParameters($arguments); - - $wait = FALSE; - - if (substr($command, -7, 7) == 'AndWait') { - $command = substr($command, 0, -7); - $wait = TRUE; - } - - switch ($command) { - case 'addLocationStrategy': - case 'addScript': - case 'addSelection': - case 'allowNativeXpath': - case 'altKeyDown': - case 'altKeyUp': - case 'answerOnNextPrompt': - case 'assignId': - case 'attachFile': - case 'break': - case 'captureEntirePageScreenshot': - case 'captureScreenshot': - case 'check': - case 'chooseCancelOnNextConfirmation': - case 'chooseOkOnNextConfirmation': - case 'click': - case 'clickAt': - case 'close': - case 'contextMenu': - case 'contextMenuAt': - case 'controlKeyDown': - case 'controlKeyUp': - case 'createCookie': - case 'deleteAllVisibleCookies': - case 'deleteCookie': - case 'deselectPopUp': - case 'doubleClick': - case 'doubleClickAt': - case 'dragAndDrop': - case 'dragAndDropToObject': - case 'dragDrop': - case 'echo': - case 'fireEvent': - case 'focus': - case 'goBack': - case 'highlight': - case 'ignoreAttributesWithoutValue': - case 'keyDown': - case 'keyDownNative': - case 'keyPress': - case 'keyPressNative': - case 'keyUp': - case 'keyUpNative': - case 'metaKeyDown': - case 'metaKeyUp': - case 'mouseDown': - case 'mouseDownAt': - case 'mouseMove': - case 'mouseMoveAt': - case 'mouseOut': - case 'mouseOver': - case 'mouseUp': - case 'mouseUpAt': - case 'mouseUpRight': - case 'mouseUpRightAt': - case 'open': - case 'openWindow': - case 'pause': - case 'refresh': - case 'removeAllSelections': - case 'removeScript': - case 'removeSelection': - case 'retrieveLastRemoteControlLogs': - case 'rollup': - case 'runScript': - case 'select': - case 'selectFrame': - case 'selectPopUp': - case 'selectWindow': - case 'setBrowserLogLevel': - case 'setContext': - case 'setCursorPosition': - case 'setMouseSpeed': - case 'setSpeed': - case 'shiftKeyDown': - case 'shiftKeyUp': - case 'shutDownSeleniumServer': - case 'store': - case 'submit': - case 'type': - case 'typeKeys': - case 'uncheck': - case 'useXpathLibrary': - case 'windowFocus': - case 'windowMaximize': - case isset(self::$autoGeneratedCommands[$command]): { - // Pre-Command Actions - switch ($command) { - case 'open': - case 'openWindow': { - if ($this->collectCodeCoverageInformation) { - $this->deleteCookie('PHPUNIT_SELENIUM_TEST_ID', 'path=/'); - - $this->createCookie( - 'PHPUNIT_SELENIUM_TEST_ID=' . $this->testId, - 'path=/' - ); - } - } - break; - case 'store': - // store is a synonym of storeExpression - // and RC only understands storeExpression - $command = 'storeExpression'; - break; - } - - if (isset(self::$autoGeneratedCommands[$command]) && self::$autoGeneratedCommands[$command]['functionHelper']) { - $helperArguments = array($command, $arguments, self::$autoGeneratedCommands[$command]); - call_user_func_array(array($this, self::$autoGeneratedCommands[$command]['functionHelper']), $helperArguments); - } else { - $this->doCommand($command, $arguments); - } - - // Post-Command Actions - switch ($command) { - case 'addLocationStrategy': - case 'allowNativeXpath': - case 'assignId': - case 'captureEntirePageScreenshot': - case 'captureScreenshot': { - // intentionally empty - } - break; - - default: { - if ($wait) { - if ($this->useWaitForPageToLoad) { - $this->waitForPageToLoad($this->seleniumTimeout * 1000); - } else { - sleep($this->wait); - } - } - - if ($this->sleep > 0) { - sleep($this->sleep); - } - - $this->testCase->runDefaultAssertions($command); - } - } - } - break; - - case 'getWhetherThisFrameMatchFrameExpression': - case 'getWhetherThisWindowMatchWindowExpression': - case 'isAlertPresent': - case 'isChecked': - case 'isConfirmationPresent': - case 'isCookiePresent': - case 'isEditable': - case 'isElementPresent': - case 'isOrdered': - case 'isPromptPresent': - case 'isSomethingSelected': - case 'isTextPresent': - case 'isVisible': { - return $this->getBoolean($command, $arguments); - } - break; - - case 'getCssCount': - case 'getCursorPosition': - case 'getElementHeight': - case 'getElementIndex': - case 'getElementPositionLeft': - case 'getElementPositionTop': - case 'getElementWidth': - case 'getMouseSpeed': - case 'getSpeed': - case 'getXpathCount': { - $result = $this->getNumber($command, $arguments); - - if ($wait) { - $this->waitForPageToLoad($this->seleniumTimeout * 1000); - } - - return $result; - } - break; - - case 'getAlert': - case 'getAttribute': - case 'getBodyText': - case 'getConfirmation': - case 'getCookie': - case 'getCookieByName': - case 'getEval': - case 'getExpression': - case 'getHtmlSource': - case 'getLocation': - case 'getLogMessages': - case 'getPrompt': - case 'getSelectedId': - case 'getSelectedIndex': - case 'getSelectedLabel': - case 'getSelectedValue': - case 'getTable': - case 'getText': - case 'getTitle': - case 'captureEntirePageScreenshotToString': - case 'captureScreenshotToString': - case 'getValue': { - $result = $this->getString($command, $arguments); - - if ($wait) { - $this->waitForPageToLoad($this->seleniumTimeout * 1000); - } - - return $result; - } - break; - - case 'getAllButtons': - case 'getAllFields': - case 'getAllLinks': - case 'getAllWindowIds': - case 'getAllWindowNames': - case 'getAllWindowTitles': - case 'getAttributeFromAllWindows': - case 'getSelectedIds': - case 'getSelectedIndexes': - case 'getSelectedLabels': - case 'getSelectedValues': - case 'getSelectOptions': { - $result = $this->getStringArray($command, $arguments); - - if ($wait) { - $this->waitForPageToLoad($this->seleniumTimeout * 1000); - } - - return $result; - } - break; - - case 'waitForCondition': - case 'waitForElementPresent': - case 'waitForElementNotPresent': - case 'waitForFrameToLoad': - case 'waitForPopUp': { - if (count($arguments) == 1) { - $arguments[] = $this->seleniumTimeout * 1000; - } - - $this->doCommand($command, $arguments); - $this->testCase->runDefaultAssertions($command); - } - break; - - case 'waitForPageToLoad': { - if (empty($arguments)) { - $arguments[] = $this->seleniumTimeout * 1000; - } - - $this->doCommand($command, $arguments); - $this->testCase->runDefaultAssertions($command); - } - break; - - default: { - if (!in_array($command, $this->userCommands)) { - throw new BadMethodCallException( - "Method $command not defined." - ); - } - $this->doCommand($command, $arguments); - } - } - } - - /** - * Send a command to the Selenium RC server. - * - * @param string $command - * @param array $arguments - * @param array $namedArguments - * @return string - * @author Seth Casana - */ - protected function doCommand($command, array $arguments = array(), array $namedArguments = array()) - { - $url = sprintf( - 'http://%s:%s/selenium-server/driver/', - $this->host, - $this->port - ); - - $numArguments = count($arguments); - $postData = sprintf('cmd=%s', urlencode($command)); - for ($i = 0; $i < $numArguments; $i++) { - $argNum = strval($i + 1); - - if ($arguments[$i] == ' ') { - $postData .= sprintf('&%s=%s', $argNum, urlencode($arguments[$i])); - } else { - $postData .= sprintf('&%s=%s', $argNum, urlencode(trim($arguments[$i]))); - } - } - foreach ($namedArguments as $key => $value) { - $postData .= sprintf('&%s=%s', $key, urlencode($value)); - } - - if (isset($this->sessionId)) { - $postData .= sprintf('&%s=%s', 'sessionId', $this->sessionId); - } - - $curl = curl_init(); - curl_setopt($curl, CURLOPT_URL, $url); - curl_setopt($curl, CURLOPT_HEADER, 0); - curl_setopt($curl, CURLOPT_POST, TRUE); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - curl_setopt($curl, CURLOPT_HTTPHEADER, array( - 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' - )); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60); - - $response = curl_exec($curl); - $info = curl_getinfo($curl); - - if (!$response) { - throw new RuntimeException("CURL error while accessing the Selenium Server at '$url': " . curl_error($curl)); - } - - curl_close($curl); - - if (!preg_match('/^OK/', $response)) { - throw new RuntimeException("Invalid response while accessing the Selenium Server at '$url': " . $response); - } - - if ($info['http_code'] != 200) { - throw new RuntimeException( - 'The response from the Selenium RC server is invalid: ' . - $response - ); - } - - return $response; - } - - protected function preprocessParameters($params) - { - foreach ($params as $key => $param ) { - if (is_string($param) && (strlen($param) > 0)) { - $params[$key] = $this->getString('getExpression', array($param)); - } - } - return $params; - } - - /** - * Send a command to the Selenium RC server and treat the result - * as a boolean. - * - * @param string $command - * @param array $arguments - * @return boolean - * @author Shin Ohno - * @author Bjoern Schotte - */ - protected function getBoolean($command, array $arguments) - { - $result = $this->getString($command, $arguments); - - switch ($result) { - case 'true': return TRUE; - - case 'false': return FALSE; - - default: { - throw new PHPUnit_Framework_Exception( - 'Result is neither "true" nor "false": ' . PHPUnit_Util_Type::export($result) - ); - } - } - } - - /** - * Send a command to the Selenium RC server and treat the result - * as a number. - * - * @param string $command - * @param array $arguments - * @return numeric - * @author Shin Ohno - * @author Bjoern Schotte - */ - protected function getNumber($command, array $arguments) - { - $result = $this->getString($command, $arguments); - - if (!is_numeric($result)) { - throw new PHPUnit_Framework_Exception( - 'Result is not numeric: ' . PHPUnit_Util_Type::export($result) - ); - } - - return $result; - } - - /** - * Send a command to the Selenium RC server and treat the result - * as a string. - * - * @param string $command - * @param array $arguments - * @return string - * @author Shin Ohno - * @author Bjoern Schotte - */ - protected function getString($command, array $arguments) - { - try { - $result = $this->doCommand($command, $arguments); - } - - catch (RuntimeException $e) { - throw $e; - } - - return (strlen($result) > 3) ? substr($result, 3) : ''; - } - - /** - * Send a command to the Selenium RC server and treat the result - * as an array of strings. - * - * @param string $command - * @param array $arguments - * @return array - * @author Shin Ohno - * @author Bjoern Schotte - */ - protected function getStringArray($command, array $arguments) - { - $csv = $this->getString($command, $arguments); - $token = ''; - $tokens = array(); - $letters = preg_split('//', $csv, -1, PREG_SPLIT_NO_EMPTY); - $count = count($letters); - - for ($i = 0; $i < $count; $i++) { - $letter = $letters[$i]; - - switch($letter) { - case '\\': { - $letter = $letters[++$i]; - $token .= $letter; - } - break; - - case ',': { - $tokens[] = $token; - $token = ''; - } - break; - - default: { - $token .= $letter; - } - } - } - - $tokens[] = $token; - - return $tokens; - } - - public function getVerificationErrors() - { - return $this->verificationErrors; - } - - public function clearVerificationErrors() - { - $this->verificationErrors = array(); - } - - protected function assertCommand($command, $arguments, $info) - { - $method = $info['originalMethod']; - $requiresTarget = $info['requiresTarget']; - $result = $this->__call($method, $arguments); - $message = "Failed command: " . $command . "('" - . (array_key_exists(0, $arguments) ? $arguments[0] . "'" : '') - . (array_key_exists(1, $arguments) ? ", '" . $arguments[1] . "'" : '') - . ")"; - - if ($info['isBoolean']) { - if (!isset($info['negative']) || !$info['negative']) { - PHPUnit_Framework_Assert::assertTrue($result, $message); - } else { - PHPUnit_Framework_Assert::assertFalse($result, $message); - } - } else { - if ($requiresTarget === TRUE) { - $expected = $arguments[1]; - } else { - $expected = $arguments[0]; - } - - if (strpos($expected, 'exact:') === 0) { - $expected = substr($expected, strlen('exact:')); - - if (!isset($info['negative']) || !$info['negative']) { - PHPUnit_Framework_Assert::assertEquals($expected, $result, $message); - } else { - PHPUnit_Framework_Assert::assertNotEquals($expected, $result, $message); - } - } else { - $caseInsensitive = FALSE; - - if (strpos($expected, 'regexp:') === 0) { - $expected = substr($expected, strlen('regexp:')); - } - - else if (strpos($expected, 'regexpi:') === 0) { - $expected = substr($expected, strlen('regexpi:')); - $caseInsensitive = TRUE; - } - - else { - if (strpos($expected, 'glob:') === 0) { - $expected = substr($expected, strlen('glob:')); - } - - $expected = '^' . str_replace( - array('*', '?'), array('.*', '.?'), $expected - ) . '$'; - } - - $expected = '/' . str_replace('/', '\/', $expected) . '/'; - - if ($caseInsensitive) { - $expected .= 'i'; - } - - if (!isset($info['negative']) || !$info['negative']) { - PHPUnit_Framework_Assert::assertRegExp( - $expected, $result, $message - ); - } else { - PHPUnit_Framework_Assert::assertNotRegExp( - $expected, $result, $message - ); - } - } - } - } - - protected function verifyCommand($command, $arguments, $info) - { - try { - $this->assertCommand($command, $arguments, $info); - } - - catch (PHPUnit_Framework_AssertionFailedError $e) { - array_push($this->verificationErrors, $e->toString()); - } - } - - protected function waitForCommand($command, $arguments, $info) - { - $lastExceptionMessage = ''; - for ($second = 0; ; $second++) { - if ($second > $this->httpTimeout) { - PHPUnit_Framework_Assert::fail( - "WaitFor timeout. \n" - . "Last exception message: \n" . $lastExceptionMessage - ); - } - - try { - $this->assertCommand($command, $arguments, $info); - return; - } - - catch (Exception $e) { - $lastExceptionMessage = $e->getMessage(); - } - - sleep(1); - } - } - - /** - * Parses the docblock of PHPUnit_Extensions_SeleniumTestCase_Driver::__call - * for get*(), is*(), assert*(), verify*(), assertNot*(), verifyNot*(), - * store*(), waitFor*(), and waitForNot*() methods. - */ - protected static function autoGenerateCommands() - { - $method = new ReflectionMethod(__CLASS__, '__call'); - $docComment = $method->getDocComment(); - - if (preg_match_all('(@method\s+(\w+)\s+([\w]+)\((.*)\))', $docComment, $matches)) { - foreach ($matches[2] as $methodKey => $method) { - if (preg_match('/^(get|is)([A-Z].+)$/', $method, $methodMatches)) { - $baseName = $methodMatches[2]; - $isBoolean = $methodMatches[1] == 'is'; - $requiresTarget = (strlen($matches[3][$methodKey]) > 0); - - if (preg_match('/^(.*)Present$/', $baseName, $methodMatches)) { - $notBaseName = $methodMatches[1] . 'NotPresent'; - } else { - $notBaseName = 'Not' . $baseName; - } - - self::$autoGeneratedCommands['store' . $baseName] = array( - 'functionHelper' => FALSE - ); - - self::$autoGeneratedCommands['assert' . $baseName] = array( - 'originalMethod' => $method, - 'isBoolean' => $isBoolean, - 'functionHelper' => 'assertCommand', - 'requiresTarget' => $requiresTarget - ); - - self::$autoGeneratedCommands['assert' . $notBaseName] = array( - 'originalMethod' => $method, - 'isBoolean' => $isBoolean, - 'negative' => TRUE, - 'functionHelper' => 'assertCommand', - 'requiresTarget' => $requiresTarget - ); - - self::$autoGeneratedCommands['verify' . $baseName] = array( - 'originalMethod' => $method, - 'isBoolean' => $isBoolean, - 'functionHelper' => 'verifyCommand', - 'requiresTarget' => $requiresTarget - ); - - self::$autoGeneratedCommands['verify' . $notBaseName] = array( - 'originalMethod' => $method, - 'isBoolean' => $isBoolean, - 'negative' => TRUE, - 'functionHelper' => 'verifyCommand', - 'requiresTarget' => $requiresTarget - ); - - self::$autoGeneratedCommands['waitFor' . $baseName] = array( - 'originalMethod' => $method, - 'isBoolean' => $isBoolean, - 'functionHelper' => 'waitForCommand', - 'requiresTarget' => $requiresTarget - ); - - self::$autoGeneratedCommands['waitFor' . $notBaseName] = array( - 'originalMethod' => $method, - 'isBoolean' => $isBoolean, - 'negative' => TRUE, - 'functionHelper' => 'waitForCommand', - 'requiresTarget' => $requiresTarget - ); - } - } - } - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - * @since File available since Release 1.2.6 - */ - -/** - * TestSuite class for a set of tests from a single Testcase Class - * executed with a particular browser. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.1 - * @link http://www.phpunit.de/ - * @since Class available since Release 1.2.6 - */ -class PHPUnit_Extensions_SeleniumBrowserSuite extends PHPUnit_Framework_TestSuite -{ - /** - * Overriding the default: Selenium suites are always built from a TestCase class. - * @var boolean - */ - protected $testCase = TRUE; - - public function addTestMethod(ReflectionClass $class, ReflectionMethod $method) - { - return parent::addTestMethod($class, $method); - } - - public static function fromClassAndBrowser($className, array $browser) - { - $browserSuite = new self(); - if (isset($browser['browserName'])) { - $name = $browser['browserName']; - } else if (isset($browser['name'])) { - $name = $browser['name']; - } else { - $name = $browser['browser']; - } - $browserSuite->setName($className . ': ' . $name); - return $browserSuite; - } - - public function setupSpecificBrowser(array $browser) - { - $this->browserOnAllTests($this, $browser); - } - - private function browserOnAllTests(PHPUnit_Framework_TestSuite $suite, array $browser) - { - foreach ($suite->tests() as $test) { - if ($test instanceof PHPUnit_Framework_TestSuite) { - $this->browserOnAllTests($test, $browser); - } else { - $test->setupSpecificBrowser($browser); - } - } - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - * @since File available since Release 1.0.0 - */ - -/** - * TestCase class that uses Selenium to provide - * the functionality required for web testing. - * - * @package PHPUnit_Selenium - * @author Sebastian Bergmann - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.1 - * @link http://www.phpunit.de/ - * @since Class available since Release 1.0.0 - * - * @method unknown addLocationStrategy() - * @method unknown addLocationStrategyAndWait() - * @method unknown addScript() - * @method unknown addScriptAndWait() - * @method unknown addSelection() - * @method unknown addSelectionAndWait() - * @method unknown allowNativeXpath() - * @method unknown allowNativeXpathAndWait() - * @method unknown altKeyDown() - * @method unknown altKeyDownAndWait() - * @method unknown altKeyUp() - * @method unknown altKeyUpAndWait() - * @method unknown answerOnNextPrompt() - * @method unknown assignId() - * @method unknown assignIdAndWait() - * @method unknown assertAlert - * @method unknown assertAlertNotPresent - * @method unknown assertAlertPresent - * @method unknown assertAllButtons - * @method unknown assertAllFields - * @method unknown assertAllLinks - * @method unknown assertAllWindowIds - * @method unknown assertAllWindowNames - * @method unknown assertAllWindowTitles - * @method unknown assertAttribute - * @method unknown assertAttributeFromAllWindows - * @method unknown assertBodyText - * @method unknown assertChecked - * @method unknown assertConfirmation - * @method unknown assertConfirmationNotPresent - * @method unknown assertConfirmationPresent - * @method unknown assertCookie - * @method unknown assertCookieByName - * @method unknown assertCookieNotPresent - * @method unknown assertCookiePresent - * @method unknown assertCssCount - * @method unknown assertCursorPosition - * @method unknown assertEditable - * @method unknown assertElementHeight - * @method unknown assertElementIndex - * @method unknown assertElementNotPresent - * @method unknown assertElementPositionLeft - * @method unknown assertElementPositionTop - * @method unknown assertElementPresent - * @method unknown assertElementWidth - * @method unknown assertEval - * @method unknown assertExpression - * @method unknown assertHtmlSource - * @method unknown assertLocation - * @method unknown assertLogMessages - * @method unknown assertMouseSpeed - * @method unknown assertNotAlert - * @method unknown assertNotAllButtons - * @method unknown assertNotAllFields - * @method unknown assertNotAllLinks - * @method unknown assertNotAllWindowIds - * @method unknown assertNotAllWindowNames - * @method unknown assertNotAllWindowTitles - * @method unknown assertNotAttribute - * @method unknown assertNotAttributeFromAllWindows - * @method unknown assertNotBodyText - * @method unknown assertNotChecked - * @method unknown assertNotConfirmation - * @method unknown assertNotCookie - * @method unknown assertNotCookieByName - * @method unknown assertNotCssCount - * @method unknown assertNotCursorPosition - * @method unknown assertNotEditable - * @method unknown assertNotElementHeight - * @method unknown assertNotElementIndex - * @method unknown assertNotElementPositionLeft - * @method unknown assertNotElementPositionTop - * @method unknown assertNotElementWidth - * @method unknown assertNotEval - * @method unknown assertNotExpression - * @method unknown assertNotHtmlSource - * @method unknown assertNotLocation - * @method unknown assertNotLogMessages - * @method unknown assertNotMouseSpeed - * @method unknown assertNotOrdered - * @method unknown assertNotPrompt - * @method unknown assertNotSelectOptions - * @method unknown assertNotSelectedId - * @method unknown assertNotSelectedIds - * @method unknown assertNotSelectedIndex - * @method unknown assertNotSelectedIndexes - * @method unknown assertNotSelectedLabel - * @method unknown assertNotSelectedLabels - * @method unknown assertNotSelectedValue - * @method unknown assertNotSelectedValues - * @method unknown assertNotSomethingSelected - * @method unknown assertNotSpeed - * @method unknown assertNotSpeedAndWait - * @method unknown assertNotTable - * @method unknown assertNotText - * @method unknown assertNotTitle - * @method unknown assertNotValue - * @method unknown assertNotVisible - * @method unknown assertNotWhetherThisFrameMatchFrameExpression - * @method unknown assertNotWhetherThisWindowMatchWindowExpression - * @method unknown assertNotXpathCount - * @method unknown assertOrdered - * @method unknown assertPrompt - * @method unknown assertPromptNotPresent - * @method unknown assertPromptPresent - * @method unknown assertSelectOptions - * @method unknown assertSelectedId - * @method unknown assertSelectedIds - * @method unknown assertSelectedIndex - * @method unknown assertSelectedIndexes - * @method unknown assertSelectedLabel - * @method unknown assertSelectedLabels - * @method unknown assertSelectedValue - * @method unknown assertSelectedValues - * @method unknown assertSomethingSelected - * @method unknown assertSpeed - * @method unknown assertSpeedAndWait - * @method unknown assertTable - * @method unknown assertText - * @method unknown assertTextNotPresent - * @method unknown assertTextPresent - * @method unknown assertTitle - * @method unknown assertValue - * @method unknown assertVisible - * @method unknown assertWhetherThisFrameMatchFrameExpression - * @method unknown assertWhetherThisWindowMatchWindowExpression - * @method unknown assertXpathCount - * @method unknown attachFile() - * @method unknown break() - * @method unknown captureEntirePageScreenshot() - * @method unknown captureEntirePageScreenshotAndWait() - * @method unknown captureEntirePageScreenshotToStringAndWait() - * @method unknown captureScreenshotAndWait() - * @method unknown captureScreenshotToStringAndWait() - * @method unknown check() - * @method unknown checkAndWait() - * @method unknown chooseCancelOnNextConfirmation() - * @method unknown chooseCancelOnNextConfirmationAndWait() - * @method unknown chooseOkOnNextConfirmation() - * @method unknown chooseOkOnNextConfirmationAndWait() - * @method unknown click() - * @method unknown clickAndWait() - * @method unknown clickAt() - * @method unknown clickAtAndWait() - * @method unknown close() - * @method unknown contextMenu() - * @method unknown contextMenuAndWait() - * @method unknown contextMenuAt() - * @method unknown contextMenuAtAndWait() - * @method unknown controlKeyDown() - * @method unknown controlKeyDownAndWait() - * @method unknown controlKeyUp() - * @method unknown controlKeyUpAndWait() - * @method unknown createCookie() - * @method unknown createCookieAndWait() - * @method unknown deleteAllVisibleCookies() - * @method unknown deleteAllVisibleCookiesAndWait() - * @method unknown deleteCookie() - * @method unknown deleteCookieAndWait() - * @method unknown deselectPopUp() - * @method unknown deselectPopUpAndWait() - * @method unknown doubleClick() - * @method unknown doubleClickAndWait() - * @method unknown doubleClickAt() - * @method unknown doubleClickAtAndWait() - * @method unknown dragAndDrop() - * @method unknown dragAndDropAndWait() - * @method unknown dragAndDropToObject() - * @method unknown dragAndDropToObjectAndWait() - * @method unknown dragDrop() - * @method unknown dragDropAndWait() - * @method unknown echo() - * @method unknown fireEvent() - * @method unknown fireEventAndWait() - * @method unknown focus() - * @method unknown focusAndWait() - * @method string getAlert() - * @method array getAllButtons() - * @method array getAllFields() - * @method array getAllLinks() - * @method array getAllWindowIds() - * @method array getAllWindowNames() - * @method array getAllWindowTitles() - * @method string getAttribute() - * @method array getAttributeFromAllWindows() - * @method string getBodyText() - * @method string getConfirmation() - * @method string getCookie() - * @method string getCookieByName() - * @method integer getCursorPosition() - * @method integer getElementHeight() - * @method integer getElementIndex() - * @method integer getElementPositionLeft() - * @method integer getElementPositionTop() - * @method integer getElementWidth() - * @method string getEval() - * @method string getExpression() - * @method string getHtmlSource() - * @method string getLocation() - * @method string getLogMessages() - * @method integer getMouseSpeed() - * @method string getPrompt() - * @method array getSelectOptions() - * @method string getSelectedId() - * @method array getSelectedIds() - * @method string getSelectedIndex() - * @method array getSelectedIndexes() - * @method string getSelectedLabel() - * @method array getSelectedLabels() - * @method string getSelectedValue() - * @method array getSelectedValues() - * @method unknown getSpeed() - * @method unknown getSpeedAndWait() - * @method string getTable() - * @method string getText() - * @method string getTitle() - * @method string getValue() - * @method boolean getWhetherThisFrameMatchFrameExpression() - * @method boolean getWhetherThisWindowMatchWindowExpression() - * @method integer getXpathCount() - * @method unknown goBack() - * @method unknown goBackAndWait() - * @method unknown highlight() - * @method unknown highlightAndWait() - * @method unknown ignoreAttributesWithoutValue() - * @method unknown ignoreAttributesWithoutValueAndWait() - * @method boolean isAlertPresent() - * @method boolean isChecked() - * @method boolean isConfirmationPresent() - * @method boolean isCookiePresent() - * @method boolean isEditable() - * @method boolean isElementPresent() - * @method boolean isOrdered() - * @method boolean isPromptPresent() - * @method boolean isSomethingSelected() - * @method boolean isTextPresent() - * @method boolean isVisible() - * @method unknown keyDown() - * @method unknown keyDownAndWait() - * @method unknown keyDownNative() - * @method unknown keyDownNativeAndWait() - * @method unknown keyPress() - * @method unknown keyPressAndWait() - * @method unknown keyPressNative() - * @method unknown keyPressNativeAndWait() - * @method unknown keyUp() - * @method unknown keyUpAndWait() - * @method unknown keyUpNative() - * @method unknown keyUpNativeAndWait() - * @method unknown metaKeyDown() - * @method unknown metaKeyDownAndWait() - * @method unknown metaKeyUp() - * @method unknown metaKeyUpAndWait() - * @method unknown mouseDown() - * @method unknown mouseDownAndWait() - * @method unknown mouseDownAt() - * @method unknown mouseDownAtAndWait() - * @method unknown mouseMove() - * @method unknown mouseMoveAndWait() - * @method unknown mouseMoveAt() - * @method unknown mouseMoveAtAndWait() - * @method unknown mouseOut() - * @method unknown mouseOutAndWait() - * @method unknown mouseOver() - * @method unknown mouseOverAndWait() - * @method unknown mouseUp() - * @method unknown mouseUpAndWait() - * @method unknown mouseUpAt() - * @method unknown mouseUpAtAndWait() - * @method unknown mouseUpRight() - * @method unknown mouseUpRightAndWait() - * @method unknown mouseUpRightAt() - * @method unknown mouseUpRightAtAndWait() - * @method unknown open() - * @method unknown openWindow() - * @method unknown openWindowAndWait() - * @method unknown pause() - * @method unknown refresh() - * @method unknown refreshAndWait() - * @method unknown removeAllSelections() - * @method unknown removeAllSelectionsAndWait() - * @method unknown removeScript() - * @method unknown removeScriptAndWait() - * @method unknown removeSelection() - * @method unknown removeSelectionAndWait() - * @method unknown retrieveLastRemoteControlLogs() - * @method unknown rollup() - * @method unknown rollupAndWait() - * @method unknown runScript() - * @method unknown runScriptAndWait() - * @method unknown select() - * @method unknown selectAndWait() - * @method unknown selectFrame() - * @method unknown selectPopUp() - * @method unknown selectPopUpAndWait() - * @method unknown selectWindow() - * @method unknown setBrowserLogLevel() - * @method unknown setBrowserLogLevelAndWait() - * @method unknown setContext() - * @method unknown setCursorPosition() - * @method unknown setCursorPositionAndWait() - * @method unknown setMouseSpeed() - * @method unknown setMouseSpeedAndWait() - * @method unknown setSpeed() - * @method unknown setSpeedAndWait() - * @method unknown shiftKeyDown() - * @method unknown shiftKeyDownAndWait() - * @method unknown shiftKeyUp() - * @method unknown shiftKeyUpAndWait() - * @method unknown shutDownSeleniumServer() - * @method unknown store() - * @method unknown submit() - * @method unknown submitAndWait() - * @method unknown type() - * @method unknown typeAndWait() - * @method unknown typeKeys() - * @method unknown typeKeysAndWait() - * @method unknown uncheck() - * @method unknown uncheckAndWait() - * @method unknown useXpathLibrary() - * @method unknown useXpathLibraryAndWait() - * @method unknown waitForAlert - * @method unknown waitForAlertNotPresent - * @method unknown waitForAlertPresent - * @method unknown waitForAllButtons - * @method unknown waitForAllFields - * @method unknown waitForAllLinks - * @method unknown waitForAllWindowIds - * @method unknown waitForAllWindowNames - * @method unknown waitForAllWindowTitles - * @method unknown waitForAttribute - * @method unknown waitForAttributeFromAllWindows - * @method unknown waitForBodyText - * @method unknown waitForChecked - * @method unknown waitForCondition() - * @method unknown waitForConfirmation - * @method unknown waitForConfirmationNotPresent - * @method unknown waitForConfirmationPresent - * @method unknown waitForCookie - * @method unknown waitForCookieByName - * @method unknown waitForCookieNotPresent - * @method unknown waitForCookiePresent - * @method unknown waitForCssCount - * @method unknown waitForCursorPosition - * @method unknown waitForEditable - * @method unknown waitForElementHeight - * @method unknown waitForElementIndex - * @method unknown waitForElementNotPresent - * @method unknown waitForElementPositionLeft - * @method unknown waitForElementPositionTop - * @method unknown waitForElementPresent - * @method unknown waitForElementWidth - * @method unknown waitForEval - * @method unknown waitForExpression - * @method unknown waitForHtmlSource - * @method unknown waitForLocation - * @method unknown waitForLogMessages - * @method unknown waitForMouseSpeed - * @method unknown waitForNotAlert - * @method unknown waitForNotAllButtons - * @method unknown waitForNotAllFields - * @method unknown waitForNotAllLinks - * @method unknown waitForNotAllWindowIds - * @method unknown waitForNotAllWindowNames - * @method unknown waitForNotAllWindowTitles - * @method unknown waitForNotAttribute - * @method unknown waitForNotAttributeFromAllWindows - * @method unknown waitForNotBodyText - * @method unknown waitForNotChecked - * @method unknown waitForNotConfirmation - * @method unknown waitForNotCookie - * @method unknown waitForNotCookieByName - * @method unknown waitForNotCssCount - * @method unknown waitForNotCursorPosition - * @method unknown waitForNotEditable - * @method unknown waitForNotElementHeight - * @method unknown waitForNotElementIndex - * @method unknown waitForNotElementPositionLeft - * @method unknown waitForNotElementPositionTop - * @method unknown waitForNotElementWidth - * @method unknown waitForNotEval - * @method unknown waitForNotExpression - * @method unknown waitForNotHtmlSource - * @method unknown waitForNotLocation - * @method unknown waitForNotLogMessages - * @method unknown waitForNotMouseSpeed - * @method unknown waitForNotOrdered - * @method unknown waitForNotPrompt - * @method unknown waitForNotSelectOptions - * @method unknown waitForNotSelectedId - * @method unknown waitForNotSelectedIds - * @method unknown waitForNotSelectedIndex - * @method unknown waitForNotSelectedIndexes - * @method unknown waitForNotSelectedLabel - * @method unknown waitForNotSelectedLabels - * @method unknown waitForNotSelectedValue - * @method unknown waitForNotSelectedValues - * @method unknown waitForNotSomethingSelected - * @method unknown waitForNotSpeed - * @method unknown waitForNotSpeedAndWait - * @method unknown waitForNotTable - * @method unknown waitForNotText - * @method unknown waitForNotTitle - * @method unknown waitForNotValue - * @method unknown waitForNotVisible - * @method unknown waitForNotWhetherThisFrameMatchFrameExpression - * @method unknown waitForNotWhetherThisWindowMatchWindowExpression - * @method unknown waitForNotXpathCount - * @method unknown waitForOrdered - * @method unknown waitForPageToLoad() - * @method unknown waitForPopUp() - * @method unknown waitForPrompt - * @method unknown waitForPromptNotPresent - * @method unknown waitForPromptPresent - * @method unknown waitForSelectOptions - * @method unknown waitForSelectedId - * @method unknown waitForSelectedIds - * @method unknown waitForSelectedIndex - * @method unknown waitForSelectedIndexes - * @method unknown waitForSelectedLabel - * @method unknown waitForSelectedLabels - * @method unknown waitForSelectedValue - * @method unknown waitForSelectedValues - * @method unknown waitForSomethingSelected - * @method unknown waitForSpeed - * @method unknown waitForSpeedAndWait - * @method unknown waitForTable - * @method unknown waitForText - * @method unknown waitForTextNotPresent - * @method unknown waitForTextPresent - * @method unknown waitForTitle - * @method unknown waitForValue - * @method unknown waitForVisible - * @method unknown waitForWhetherThisFrameMatchFrameExpression - * @method unknown waitForWhetherThisWindowMatchWindowExpression - * @method unknown waitForXpathCount - * @method unknown windowFocus() - * @method unknown windowMaximize() - */ -abstract class PHPUnit_Extensions_SeleniumTestCase extends PHPUnit_Framework_TestCase -{ - /** - * @var array - */ - public static $browsers = array(); - - /** - * @var string - */ - protected $browserName; - - /** - * @var boolean - */ - protected $collectCodeCoverageInformation = FALSE; - - /** - * @var string - */ - protected $coverageScriptUrl = ''; - - /** - * @var PHPUnit_Extensions_SeleniumTestCase_Driver[] - */ - protected $drivers = array(); - - /** - * @var boolean - */ - protected $inDefaultAssertions = FALSE; - - /** - * @var string - */ - protected $testId; - - /** - * @var array - * @access protected - */ - protected $verificationErrors = array(); - - /** - * @var boolean - */ - protected $captureScreenshotOnFailure = FALSE; - - /** - * @var string - */ - protected $screenshotPath = ''; - - /** - * @var string - */ - protected $screenshotUrl = ''; - - /** - * @var integer the number of seconds to wait before declaring - * the Selenium server not reachable - */ - protected $serverConnectionTimeOut = 10; - - /** - * @var boolean - */ - private $serverRunning; - - /** - * @var boolean - */ - private static $shareSession; - - /** - * The last sessionId used for running a test. - * @var string - */ - private static $sessionId; - - /** - * @param boolean - */ - public static function shareSession($shareSession) - { - self::$shareSession = $shareSession; - } - - /** - * @param string $name - * @param array $data - * @param string $dataName - * @param array $browser - * @throws InvalidArgumentException - */ - public function __construct($name = NULL, array $data = array(), $dataName = '') - { - parent::__construct($name, $data, $dataName); - $this->testId = md5(uniqid(rand(), TRUE)); - $this->getDriver(array()); - } - - public function setupSpecificBrowser(array $browser) - { - $this->getDriver($browser); - } - - /** - * Stops any shared session still open at the end of the current - * PHPUnit process. - */ - public function __destruct() - { - $this->stopSession(); - } - - /** - * @param string $className - * @return PHPUnit_Framework_TestSuite - */ - public static function suite($className) - { - return PHPUnit_Extensions_SeleniumTestSuite::fromTestCaseClass($className); - } - - /** - * Runs the test case and collects the results in a TestResult object. - * If no TestResult object is passed a new one will be created. - * - * @param PHPUnit_Framework_TestResult $result - * @return PHPUnit_Framework_TestResult - * @throws InvalidArgumentException - */ - public function run(PHPUnit_Framework_TestResult $result = NULL) - { - if ($result === NULL) { - $result = $this->createResult(); - } - - $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation(); - - foreach ($this->drivers as $driver) { - $driver->setCollectCodeCoverageInformation( - $this->collectCodeCoverageInformation - ); - } - - parent::run($result); - - if ($this->collectCodeCoverageInformation) { - $result->getCodeCoverage()->append( - $this->getCodeCoverage(), $this - ); - } - - return $result; - } - - /** - * @param array $browser - * @return PHPUnit_Extensions_SeleniumTestCase_Driver - */ - protected function getDriver(array $browser) - { - if (isset($browser['name'])) { - if (!is_string($browser['name'])) { - throw new InvalidArgumentException( - 'Array element "name" is no string.' - ); - } - } else { - $browser['name'] = ''; - } - - if (isset($browser['browser'])) { - if (!is_string($browser['browser'])) { - throw new InvalidArgumentException( - 'Array element "browser" is no string.' - ); - } - } else { - $browser['browser'] = ''; - } - - if (isset($browser['host'])) { - if (!is_string($browser['host'])) { - throw new InvalidArgumentException( - 'Array element "host" is no string.' - ); - } - } else { - $browser['host'] = 'localhost'; - } - - if (isset($browser['port'])) { - if (!is_int($browser['port'])) { - throw new InvalidArgumentException( - 'Array element "port" is no integer.' - ); - } - } else { - $browser['port'] = 4444; - } - - if (isset($browser['timeout'])) { - if (!is_int($browser['timeout'])) { - throw new InvalidArgumentException( - 'Array element "timeout" is no integer.' - ); - } - } else { - $browser['timeout'] = 30; - } - - if (isset($browser['httpTimeout'])) { - if (!is_int($browser['httpTimeout'])) { - throw new InvalidArgumentException( - 'Array element "httpTimeout" is no integer.' - ); - } - } else { - $browser['httpTimeout'] = 45; - } - - $driver = new PHPUnit_Extensions_SeleniumTestCase_Driver; - $driver->setName($browser['name']); - $driver->setBrowser($browser['browser']); - $driver->setHost($browser['host']); - $driver->setPort($browser['port']); - $driver->setTimeout($browser['timeout']); - $driver->setHttpTimeout($browser['httpTimeout']); - $driver->setTestCase($this); - $driver->setTestId($this->testId); - - $this->drivers[0] = $driver; - - return $driver; - } - - public function skipWithNoServerRunning() - { - try { - fsockopen($this->drivers[0]->getHost(), $this->drivers[0]->getPort(), $errno, $errstr, $this->serverConnectionTimeOut); - $this->serverRunning = TRUE; - } catch (PHPUnit_Framework_Error_Warning $e) { - $this->markTestSkipped( - sprintf( - 'Could not connect to the Selenium Server on %s:%d.', - $this->drivers[0]->getHost(), - $this->drivers[0]->getPort() - ) - ); - $this->serverRunning = FALSE; - } - } - - /** - * @return string - */ - protected function prepareTestSession() - { - $testCaseClassVars = get_class_vars(get_class($this)); - if ($testCaseClassVars['browsers']) { - return $this->start(); - } - if (self::$shareSession && self::$sessionId !== NULL) { - $this->setSessionId(self::$sessionId); - $this->selectWindow('null'); - } else { - self::$sessionId = $this->start(); - } - - return self::$sessionId; - } - - /** - * @throws RuntimeException - */ - protected function runTest() - { - $this->skipWithNoServerRunning(); - - $this->prepareTestSession(); - - if (!is_file($this->getName(FALSE))) { - $result = parent::runTest(); - } else { - $this->runSelenese($this->getName(FALSE)); - $result = NULL; - } - - if (!empty($this->verificationErrors)) { - $this->fail(implode("\n", $this->verificationErrors)); - } - - if (!self::$shareSession) { - $this->stopSession(); - } - - return $result; - } - - private function stopSession() - { - try { - $this->stop(); - } catch (RuntimeException $e) { } - } - - /** - * Returns a string representation of the test case. - * - * @return string - */ - public function toString() - { - $buffer = parent::toString(); - - if (!empty($this->browserName)) { - $buffer .= ' with browser ' . $this->browserName; - } - - return $buffer; - } - - /** - * Runs a test from a Selenese (HTML) specification. - * - * @param string $filename - */ - public function runSelenese($filename) - { - $document = PHPUnit_Util_XML::loadFile($filename, TRUE); - $xpath = new DOMXPath($document); - $rows = $xpath->query('body/table/tbody/tr'); - - foreach ($rows as $row) { - $action = NULL; - $arguments = array(); - $columns = $xpath->query('td', $row); - - foreach ($columns as $column) { - if ($action === NULL) { - $action = PHPUnit_Util_XML::nodeToText($column); - } else { - $arguments[] = PHPUnit_Util_XML::nodeToText($column); - } - } - - if (method_exists($this, $action)) { - call_user_func_array(array($this, $action), $arguments); - } else { - $this->__call($action, $arguments); - } - } - } - - /** - * Delegate method calls to the driver. - * - * @param string $command - * @param array $arguments - * @return mixed - */ - public function __call($command, $arguments) - { - $result = call_user_func_array( - array($this->drivers[0], $command), $arguments - ); - - $this->verificationErrors = array_merge( - $this->verificationErrors, $this->drivers[0]->getVerificationErrors() - ); - - $this->drivers[0]->clearVerificationErrors(); - - return $result; - } - - /** - * Asserts that an element's value is equal to a given string. - * - * @param string $locator - * @param string $text - * @param string $message - */ - public function assertElementValueEquals($locator, $text, $message = '') - { - $this->assertEquals($text, $this->getValue($locator), $message); - } - - /** - * Asserts that an element's value is not equal to a given string. - * - * @param string $locator - * @param string $text - * @param string $message - */ - public function assertElementValueNotEquals($locator, $text, $message = '') - { - $this->assertNotEquals($text, $this->getValue($locator), $message); - } - - /** - * Asserts that an element's value contains a given string. - * - * @param string $locator - * @param string $text - * @param string $message - */ - public function assertElementValueContains($locator, $text, $message = '') - { - $this->assertContains($text, $this->getValue($locator), $message); - } - - /** - * Asserts that an element's value does not contain a given string. - * - * @param string $locator - * @param string $text - * @param string $message - */ - public function assertElementValueNotContains($locator, $text, $message = '') - { - $this->assertNotContains($text, $this->getValue($locator), $message); - } - - /** - * Asserts that an element contains a given string. - * - * @param string $locator - * @param string $text - * @param string $message - */ - public function assertElementContainsText($locator, $text, $message = '') - { - $this->assertContains($text, $this->getText($locator), $message); - } - - /** - * Asserts that an element does not contain a given string. - * - * @param string $locator - * @param string $text - * @param string $message - */ - public function assertElementNotContainsText($locator, $text, $message = '') - { - $this->assertNotContains($text, $this->getText($locator), $message); - } - - /** - * Asserts that a select element has a specific option. - * - * @param string $selectLocator - * @param string $option - * @param string $message - */ - public function assertSelectHasOption($selectLocator, $option, $message = '') - { - $this->assertContains($option, $this->getSelectOptions($selectLocator), $message); - } - - /** - * Asserts that a select element does not have a specific option. - * - * @param string $selectLocator - * @param string $option - * @param string $message - */ - public function assertSelectNotHasOption($selectLocator, $option, $message = '') - { - $this->assertNotContains($option, $this->getSelectOptions($selectLocator), $message); - } - - /** - * Asserts that a specific label is selected. - * - * @param string $selectLocator - * @param string $value - * @param string $message - */ - public function assertSelected($selectLocator, $option, $message = '') - { - if ($message == '') { - $message = sprintf( - 'Label "%s" not selected in "%s".', - $option, - $selectLocator - ); - } - - $this->assertEquals( - $option, - $this->getSelectedLabel($selectLocator), - $message - ); - } - - /** - * Asserts that a specific label is not selected. - * - * @param string $selectLocator - * @param string $value - * @param string $message - */ - public function assertNotSelected($selectLocator, $option, $message = '') - { - if ($message == '') { - $message = sprintf( - 'Label "%s" selected in "%s".', - $option, - $selectLocator - ); - } - - $this->assertNotEquals( - $option, - $this->getSelectedLabel($selectLocator), - $message - ); - } - - /** - * Asserts that a specific value is selected. - * - * @param string $selectLocator - * @param string $value - * @param string $message - */ - public function assertIsSelected($selectLocator, $value, $message = '') - { - if ($message == '') { - $message = sprintf( - 'Value "%s" not selected in "%s".', - $value, - $selectLocator - ); - } - - $this->assertEquals( - $value, $this->getSelectedValue($selectLocator), - $message - ); - } - - /** - * Asserts that a specific value is not selected. - * - * @param string $selectLocator - * @param string $value - * @param string $message - */ - public function assertIsNotSelected($selectLocator, $value, $message = '') - { - if ($message == '') { - $message = sprintf( - 'Value "%s" selected in "%s".', - $value, - $selectLocator - ); - } - - $this->assertNotEquals( - $value, - $this->getSelectedValue($selectLocator), - $message - ); - } - - /** - * Template Method that is called after Selenium actions. - * - * @param string $action - */ - protected function defaultAssertions($action) - { - } - - /** - * @return array - */ - protected function getCodeCoverage() - { - $coverage = new PHPUnit_Extensions_SeleniumCommon_RemoteCoverage( - $this->coverageScriptUrl, - $this->testId - ); - return $coverage->get(); - } - - /** - * @param string $action - */ - public function runDefaultAssertions($action) - { - if (!$this->inDefaultAssertions) { - $this->inDefaultAssertions = TRUE; - $this->defaultAssertions($action); - $this->inDefaultAssertions = FALSE; - } - } - - /** - * This method is called when a test method did not execute successfully. - * - * @param Exception $e - */ - protected function onNotSuccessfulTest(Exception $e) - { - if (!$this->serverRunning) { - throw $e; - } - - try { - $this->restoreSessionStateAfterFailedTest(); - $buffer = ''; - - if ($this->captureScreenshotOnFailure) { - $buffer .= 'Current URL: ' . $this->drivers[0]->getLocation() . - "\n"; - - $screenshotInfo = $this->takeScreenshot(); - if ($screenshotInfo != '') { - $buffer .= $screenshotInfo; - } - } - - $this->stopSession(); - } catch (Exception $another) { - $buffer = "Issues while capturing the screenshot:\n" . $another->getMessage(); - } - - if ($e instanceof PHPUnit_Framework_ExpectationFailedException - && is_object($e->getComparisonFailure())) { - $message = $e->getComparisonFailure()->toString(); - } else { - $message = $e->getMessage(); - } - - $buffer .= "\n" . $message; - - // gain the screenshot path, lose the stack trace - if ($this->captureScreenshotOnFailure) { - throw new PHPUnit_Framework_Error($buffer, $e->getCode(), $e->getFile(), $e->getLine(), $e); - } - - // yes to stack trace and everything - if ($e instanceof PHPUnit_Framework_IncompleteTestError - || $e instanceof PHPUnit_Framework_SkippedTestError - || $e instanceof PHPUnit_Framework_AssertionFailedError) { - throw $e; - } - - // yes to stack trace, only for F tests - // PHPUnit issue 471 prevents getTrace() from being useful - throw new PHPUnit_Framework_Error($buffer, $e->getCode(), $e->getFile(), $e->getLine(), $e); - } - - private function restoreSessionStateAfterFailedTest() - { - self::$sessionId = NULL; - } - - /** - * Returns correct path to screenshot save path. - * - * @return string - */ - protected function getScreenshotPath() - { - $path = $this->screenshotPath; - - if (!in_array(substr($path, strlen($path) -1, 1), array("/","\\"))) { - $path .= DIRECTORY_SEPARATOR; - } - - return $path; - } - - /** - * Take a screenshot and return information about it. - * Return an empty string if the screenshotPath and screenshotUrl - * properties are empty. - * Issue #88. - * - * @access protected - * @return string - */ - protected function takeScreenshot() - { - if (!empty($this->screenshotPath) && - !empty($this->screenshotUrl)) { - $filename = $this->getScreenshotPath() . $this->testId . '.png'; - - $this->drivers[0]->captureEntirePageScreenshot($filename); - - return 'Screenshot: ' . $this->screenshotUrl . '/' . - $this->testId . ".png\n"; - } else { - return ''; - } - } - - /** - * Pause support for runSelenese() HTML cases - * @param $milliseconds - */ - protected function pause($milliseconds){ - sleep(round($milliseconds/1000)); - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - * @since File available since Release 1.2.4 - */ - -/** - * Retrieves the value of a CSS property. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.1 - * @link http://www.phpunit.de/ - * @since Class available since Release 1.2.4 - */ -class PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Css - extends PHPUnit_Extensions_Selenium2TestCase_Command -{ - /** - * @param array $propertyName - */ - public function __construct($propertyName, - PHPUnit_Extensions_Selenium2TestCase_URL $cssResourceBaseUrl) - { - $this->jsonParameters = array(); - $this->url = $cssResourceBaseUrl->descend($propertyName); - } - - public function httpMethod() - { - return 'GET'; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - * @since File available since Release 1.2.0 - */ - -/** - * Class for implementing commands that just return a value - * (obtained with GET). - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.1 - * @link http://www.phpunit.de/ - * @since Class available since Release 1.2.0 - */ -class PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericAccessor - extends PHPUnit_Extensions_Selenium2TestCase_Command -{ - public function httpMethod() - { - return 'GET'; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - * @since File available since Release 1.2.4 - */ - -/** - * Checks equality (same element on the page) with another DOM element. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.1 - * @link http://www.phpunit.de/ - * @since Class available since Release 1.2.4 - */ -class PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Equals - extends PHPUnit_Extensions_Selenium2TestCase_Command -{ - /** - * @param array $parameter - */ - public function __construct($parameter, - PHPUnit_Extensions_Selenium2TestCase_URL $equalsResourceBaseUrl) - { - $this->jsonParameters = array(); - if (!($parameter instanceof PHPUnit_Extensions_Selenium2TestCase_Element)) { - throw new InvalidArgumentException("Elements can only test equality with other Element instances."); - } - $this->url = $equalsResourceBaseUrl->descend($parameter->getId()); - } - - public function httpMethod() - { - return 'GET'; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2012 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - * @since File available since Release 1.2.4 - */ - -/** - * Class for implementing commands that just accomplishes an action (via POST). - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2012 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.1 - * @link http://www.phpunit.de/ - * @since Class available since Release 1.2.4 - */ -class PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericPost - extends PHPUnit_Extensions_Selenium2TestCase_Command -{ - public function httpMethod() - { - return 'POST'; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - * @since File available since Release 1.2.0 - */ - -/** - * Get and set the element's value attribute. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.1 - * @link http://www.phpunit.de/ - * @since Class available since Release 1.2.0 - */ -class PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Value - extends PHPUnit_Extensions_Selenium2TestCase_SessionCommand_Keys -{ - public function httpMethod() - { - if ($this->jsonParameters) { - return 'POST'; - } - - return 'GET'; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - * @since File available since Release 1.2.4 - */ - -/** - * Retrieves an attribute of a DOM element. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.1 - * @link http://www.phpunit.de/ - * @since Class available since Release 1.2.4 - */ -class PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Attribute - extends PHPUnit_Extensions_Selenium2TestCase_Command -{ - /** - * @param array $parameter - */ - public function __construct($parameter, - PHPUnit_Extensions_Selenium2TestCase_URL $attributeResourceBaseUrl) - { - $this->jsonParameters = array(); - $this->url = $attributeResourceBaseUrl->descend($parameter); - } - - public function httpMethod() - { - return 'GET'; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - * @since File available since Release 1.2.0 - */ - -/** - * Clicks ok on an alert popup. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.1 - * @link http://www.phpunit.de/ - * @since Class available since Release 1.2.0 - */ -class PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Click - extends PHPUnit_Extensions_Selenium2TestCase_Command -{ - public function httpMethod() - { - return 'POST'; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @author Ivan Kurnosov - * @copyright 2010-2011 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - * @since File available since Release 1.2.12 - */ - -/** - * Class-mapper, that converts requested special key into correspondent Unicode character - * - * @package PHPUnit_Selenium - * @author Ivan Kurnosov - * @copyright 2010-2011 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.1 - * @link http://www.phpunit.de/ - * @since Class available since Release 1.2.12 - * @see http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value - */ -class PHPUnit_Extensions_Selenium2TestCase_KeysHolder -{ - private $_keys = array( - 'null' => "\xEE\x80\x80", - 'cancel' => "\xEE\x80\x81", - 'help' => "\xEE\x80\x82", - 'backspace' => "\xEE\x80\x83", - 'tab' => "\xEE\x80\x84", - 'clear' => "\xEE\x80\x85", - 'return' => "\xEE\x80\x86", - 'enter' => "\xEE\x80\x87", - 'shift' => "\xEE\x80\x88", - 'control' => "\xEE\x80\x89", - 'alt' => "\xEE\x80\x8A", - 'pause' => "\xEE\x80\x8B", - 'escape' => "\xEE\x80\x8C", - 'space' => "\xEE\x80\x8D", - 'pageup' => "\xEE\x80\x8E", - 'pagedown' => "\xEE\x80\x8F", - 'end' => "\xEE\x80\x90", - 'home' => "\xEE\x80\x91", - 'left' => "\xEE\x80\x92", - 'up' => "\xEE\x80\x93", - 'right' => "\xEE\x80\x94", - 'down' => "\xEE\x80\x95", - 'insert' => "\xEE\x80\x96", - 'delete' => "\xEE\x80\x97", - 'semicolon' => "\xEE\x80\x98", - 'equals' => "\xEE\x80\x99", - 'numpad0' => "\xEE\x80\x9A", - 'numpad1' => "\xEE\x80\x9B", - 'numpad2' => "\xEE\x80\x9C", - 'numpad3' => "\xEE\x80\x9D", - 'numpad4' => "\xEE\x80\x9E", - 'numpad5' => "\xEE\x80\x9F", - 'numpad6' => "\xEE\x80\xA0", - 'numpad7' => "\xEE\x80\xA1", - 'numpad8' => "\xEE\x80\xA2", - 'numpad9' => "\xEE\x80\xA3", - 'multiply' => "\xEE\x80\xA4", - 'add' => "\xEE\x80\xA5", - 'separator' => "\xEE\x80\xA6", - 'subtract' => "\xEE\x80\xA7", - 'decimal' => "\xEE\x80\xA8", - 'divide' => "\xEE\x80\xA9", - 'f1' => "\xEE\x80\xB1", - 'f2' => "\xEE\x80\xB2", - 'f3' => "\xEE\x80\xB3", - 'f4' => "\xEE\x80\xB4", - 'f5' => "\xEE\x80\xB5", - 'f6' => "\xEE\x80\xB6", - 'f7' => "\xEE\x80\xB7", - 'f8' => "\xEE\x80\xB8", - 'f9' => "\xEE\x80\xB9", - 'f10' => "\xEE\x80\xBA", - 'f11' => "\xEE\x80\xBB", - 'f12' => "\xEE\x80\xBC", - 'command' => "\xEE\x80\xBD", - ); - - public function specialKey($name) - { - $normalizedName = strtolower($name); - - if (!isset($this->_keys[$normalizedName])) { - throw new PHPUnit_Extensions_Selenium2TestCase_Exception("There is no special key '$name' defined"); - } - - return $this->_keys[$normalizedName]; - } -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - */ - - -/** - * Provides access to /element and /elements commands - * - * @package PHPUnit_Selenium - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @version Release: 1.3.1 - * @link http://www.phpunit.de/ - */ -abstract class PHPUnit_Extensions_Selenium2TestCase_Element_Accessor - extends PHPUnit_Extensions_Selenium2TestCase_CommandsHolder -{ - - /** - * @param string $value e.g. 'container' - * @return PHPUnit_Extensions_Selenium2TestCase_Element - */ - public function byClassName($value) - { - return $this->by('class name', $value); - } - - /** - * @param string $value e.g. 'div.container' - * @return PHPUnit_Extensions_Selenium2TestCase_Element - */ - public function byCssSelector($value) - { - return $this->by('css selector', $value); - } - - /** - * @param string $value e.g. 'uniqueId' - * @return PHPUnit_Extensions_Selenium2TestCase_Element - */ - public function byId($value) - { - return $this->by('id', $value); - } - - /** - * @param string $value e.g. 'Link text' - * @return PHPUnit_Extensions_Selenium2TestCase_Element - */ - public function byLinkText($value) - { - return $this->by('link text', $value); - } - - /** - * @param string $value e.g. 'email_address' - * @return PHPUnit_Extensions_Selenium2TestCase_Element - */ - public function byName($value) - { - return $this->by('name', $value); - } - - /** - * @param string $value e.g. 'body' - * @return PHPUnit_Extensions_Selenium2TestCase_Element - */ - public function byTag($value) - { - return $this->by('tag name', $value); - } - - /** - * @param string $value e.g. '/div[@attribute="value"]' - * @return PHPUnit_Extensions_Selenium2TestCase_Element - */ - public function byXPath($value) - { - return $this->by('xpath', $value); - } - - /** - * @return PHPUnit_Extensions_Selenium2TestCase_Element - */ - public function element(PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria) - { - $value = $this->postCommand('element', $criteria); - return PHPUnit_Extensions_Selenium2TestCase_Element::fromResponseValue( - $value, $this->getSessionUrl()->descend('element'), $this->driver); - } - - /** - * @return array instances of PHPUnit_Extensions_Selenium2TestCase_Element - */ - public function elements(PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria) - { - $values = $this->postCommand('elements', $criteria); - $elements = array(); - foreach ($values as $value) { - $elements[] = - PHPUnit_Extensions_Selenium2TestCase_Element::fromResponseValue( - $value, $this->getSessionUrl()->descend('element'), $this->driver); - } - return $elements; - } - - /** - * @param string $strategy - * @return PHPUnit_Extensions_Selenium2TestCase_ElementCriteria - */ - public function using($strategy) - { - return new PHPUnit_Extensions_Selenium2TestCase_ElementCriteria($strategy); - } - - /** - * @return PHPUnit_Extensions_Selenium2TestCase_URL - */ - protected abstract function getSessionUrl(); - - /** - * @param string $strategy supported by JsonWireProtocol element/ command - * @param string $value - * @return PHPUnit_Extensions_Selenium2TestCase_Element - */ - private function by($strategy, $value) - { - return $this->element($this->using($strategy)->value($value)); - } - -} -. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHPUnit_Selenium - * @author Giorgio Sironi - * @copyright 2010-2013 Sebastian Bergmann - * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License - * @link http://www.phpunit.de/ - * @since File available since Release 1.2.2 - */ - -/** - * Object representing a ",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="
t
",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="
",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj; -return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="
",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/\s*$/g,At={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X
","
"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?""!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l) -}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("