first commit

This commit is contained in:
root
2022-03-06 11:49:27 +00:00
commit 1984e55837
1387 changed files with 121949 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<?php
abstract class AbstractMockTestClass implements MockTestInterface
{
abstract public function doSomething();
public function returnAnything()
{
return 1;
}
}

View File

@ -0,0 +1,15 @@
<?php
trait AbstractTrait
{
abstract public function doSomething();
public function mockableMethod()
{
return true;
}
public function anotherMockableMethod()
{
return true;
}
}

View File

@ -0,0 +1,5 @@
<?php
interface AnInterface
{
public function doSomething();
}

View File

@ -0,0 +1,5 @@
<?php
interface AnInterfaceWithReturnType
{
public function returnAnArray(): array;
}

View File

@ -0,0 +1,5 @@
<?php
interface AnotherInterface
{
public function doSomethingElse();
}

View File

@ -0,0 +1,8 @@
<?php
class Bar
{
public function doSomethingElse()
{
return 'result';
}
}

View File

@ -0,0 +1,15 @@
<?php
class ClassThatImplementsSerializable implements Serializable
{
public function serialize()
{
return get_object_vars($this);
}
public function unserialize($serialized)
{
foreach (unserialize($serialized) as $key => $value) {
$this->{$key} = $value;
}
}
}

View File

@ -0,0 +1,7 @@
<?php
class ClassWithSelfTypeHint
{
public function foo(self $foo)
{
}
}

View File

@ -0,0 +1,7 @@
<?php
class ClassWithStaticMethod
{
public static function staticMethod()
{
}
}

View File

@ -0,0 +1,8 @@
<?php
class Foo
{
public function doSomething(Bar $bar)
{
return $bar->doSomethingElse();
}
}

View File

@ -0,0 +1,9 @@
<?php
function functionCallback()
{
$args = func_get_args();
if ($args == ['foo', 'bar']) {
return 'pass';
}
}

View File

@ -0,0 +1,198 @@
<?xml version="1.0"?>
<!-- WSDL description of the Google Web APIs.
The Google Web APIs are in beta release. All interfaces are subject to
change as we refine and extend our APIs. Please see the terms of use
for more information. -->
<!-- Revision 2002-08-16 -->
<definitions name="GoogleSearch"
targetNamespace="urn:GoogleSearch"
xmlns:typens="urn:GoogleSearch"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<!-- Types for search - result elements, directory categories -->
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:GoogleSearch">
<xsd:complexType name="GoogleSearchResult">
<xsd:all>
<xsd:element name="documentFiltering" type="xsd:boolean"/>
<xsd:element name="searchComments" type="xsd:string"/>
<xsd:element name="estimatedTotalResultsCount" type="xsd:int"/>
<xsd:element name="estimateIsExact" type="xsd:boolean"/>
<xsd:element name="resultElements" type="typens:ResultElementArray"/>
<xsd:element name="searchQuery" type="xsd:string"/>
<xsd:element name="startIndex" type="xsd:int"/>
<xsd:element name="endIndex" type="xsd:int"/>
<xsd:element name="searchTips" type="xsd:string"/>
<xsd:element name="directoryCategories" type="typens:DirectoryCategoryArray"/>
<xsd:element name="searchTime" type="xsd:double"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="ResultElement">
<xsd:all>
<xsd:element name="summary" type="xsd:string"/>
<xsd:element name="URL" type="xsd:string"/>
<xsd:element name="snippet" type="xsd:string"/>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="cachedSize" type="xsd:string"/>
<xsd:element name="relatedInformationPresent" type="xsd:boolean"/>
<xsd:element name="hostName" type="xsd:string"/>
<xsd:element name="directoryCategory" type="typens:DirectoryCategory"/>
<xsd:element name="directoryTitle" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="ResultElementArray">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:ResultElement[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="DirectoryCategoryArray">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:DirectoryCategory[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="DirectoryCategory">
<xsd:all>
<xsd:element name="fullViewableName" type="xsd:string"/>
<xsd:element name="specialEncoding" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
</types>
<!-- Messages for Google Web APIs - cached page, search, spelling. -->
<message name="doGetCachedPage">
<part name="key" type="xsd:string"/>
<part name="url" type="xsd:string"/>
</message>
<message name="doGetCachedPageResponse">
<part name="return" type="xsd:base64Binary"/>
</message>
<message name="doSpellingSuggestion">
<part name="key" type="xsd:string"/>
<part name="phrase" type="xsd:string"/>
</message>
<message name="doSpellingSuggestionResponse">
<part name="return" type="xsd:string"/>
</message>
<!-- note, ie and oe are ignored by server; all traffic is UTF-8. -->
<message name="doGoogleSearch">
<part name="key" type="xsd:string"/>
<part name="q" type="xsd:string"/>
<part name="start" type="xsd:int"/>
<part name="maxResults" type="xsd:int"/>
<part name="filter" type="xsd:boolean"/>
<part name="restrict" type="xsd:string"/>
<part name="safeSearch" type="xsd:boolean"/>
<part name="lr" type="xsd:string"/>
<part name="ie" type="xsd:string"/>
<part name="oe" type="xsd:string"/>
</message>
<message name="doGoogleSearchResponse">
<part name="return" type="typens:GoogleSearchResult"/>
</message>
<!-- Port for Google Web APIs, "GoogleSearch" -->
<portType name="GoogleSearchPort">
<operation name="doGetCachedPage">
<input message="typens:doGetCachedPage"/>
<output message="typens:doGetCachedPageResponse"/>
</operation>
<operation name="doSpellingSuggestion">
<input message="typens:doSpellingSuggestion"/>
<output message="typens:doSpellingSuggestionResponse"/>
</operation>
<operation name="doGoogleSearch">
<input message="typens:doGoogleSearch"/>
<output message="typens:doGoogleSearchResponse"/>
</operation>
</portType>
<!-- Binding for Google Web APIs - RPC, SOAP over HTTP -->
<binding name="GoogleSearchBinding" type="typens:GoogleSearchPort">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="doGetCachedPage">
<soap:operation soapAction="urn:GoogleSearchAction"/>
<input>
<soap:body use="encoded"
namespace="urn:GoogleSearch"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded"
namespace="urn:GoogleSearch"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="doSpellingSuggestion">
<soap:operation soapAction="urn:GoogleSearchAction"/>
<input>
<soap:body use="encoded"
namespace="urn:GoogleSearch"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded"
namespace="urn:GoogleSearch"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="doGoogleSearch">
<soap:operation soapAction="urn:GoogleSearchAction"/>
<input>
<soap:body use="encoded"
namespace="urn:GoogleSearch"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded"
namespace="urn:GoogleSearch"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<!-- Endpoint for Google Web APIs -->
<service name="GoogleSearchService">
<port name="GoogleSearchPort" binding="typens:GoogleSearchBinding">
<soap:address location="http://api.google.com/search/beta2"/>
</port>
</service>
</definitions>

View File

@ -0,0 +1,5 @@
<?php
interface InterfaceWithSemiReservedMethodName
{
public function unset();
}

View File

@ -0,0 +1,5 @@
<?php
interface InterfaceWithStaticMethod
{
public static function staticMethod();
}

View File

@ -0,0 +1,21 @@
<?php
class MethodCallback
{
public static function staticCallback()
{
$args = func_get_args();
if ($args == ['foo', 'bar']) {
return 'pass';
}
}
public function nonStaticCallback()
{
$args = func_get_args();
if ($args == ['foo', 'bar']) {
return 'pass';
}
}
}

View File

@ -0,0 +1,13 @@
<?php
class MethodCallbackByReference
{
public function bar(&$a, &$b, $c)
{
Legacy::bar($a, $b, $c);
}
public function callback(&$a, &$b, $c)
{
$b = 1;
}
}

View File

@ -0,0 +1,6 @@
<?php
interface MockTestInterface
{
public function returnAnything();
public function returnAnythingElse();
}

View File

@ -0,0 +1,28 @@
<?php
class Mockable
{
public $constructorArgs;
public $cloned;
public function __construct($arg1 = null, $arg2 = null)
{
$this->constructorArgs = [$arg1, $arg2];
}
public function mockableMethod()
{
// something different from NULL
return true;
}
public function anotherMockableMethod()
{
// something different from NULL
return true;
}
public function __clone()
{
$this->cloned = true;
}
}

View File

@ -0,0 +1,18 @@
<?php
class PartialMockTestClass
{
public $constructorCalled = false;
public function __construct()
{
$this->constructorCalled = true;
}
public function doSomething()
{
}
public function doAnotherThing()
{
}
}

View File

@ -0,0 +1,28 @@
<?php
class SingletonClass
{
public static function getInstance()
{
}
public function doSomething()
{
}
protected function __construct()
{
}
final private function __sleep()
{
}
final private function __wakeup()
{
}
final private function __clone()
{
}
}

View File

@ -0,0 +1,13 @@
<?php
class SomeClass
{
public function doSomething($a, $b)
{
return;
}
public function doSomethingElse($c)
{
return;
}
}

View File

@ -0,0 +1,12 @@
<?php
class StaticMockTestClass
{
public static function doSomething()
{
}
public static function doSomethingElse()
{
return static::doSomething();
}
}

View File

@ -0,0 +1,8 @@
<?php
class StringableClass
{
public function __toString()
{
return '12345';
}
}

View File

@ -0,0 +1,4 @@
<?php
interface TraversableMockTestInterface extends Traversable
{
}