Semantic MediaWiki and related extensions
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SMW\Tests\Utils\Mock\MockObjectBuilder Class Reference
Collaboration diagram for SMW\Tests\Utils\Mock\MockObjectBuilder:
Collaboration graph
[legend]

Public Member Functions

 __construct (MockObjectRepository $repository=null)
 
 registerRepository (MockObjectRepository $repository)
 
 newObject ($objectName, $objectArguments=array())
 
 getInvokedMethods ()
 
 newRandomString ($length=10, $prefix=null)
 
 hasValue ($key)
 
 setValue ($key, $default=null)
 
 setCallback ($key, $default=null)
 

Protected Member Functions

 findRepositoryForObject ($objectName)
 
 setupConfiguration ($config)
 

Protected Attributes

 $configuration
 
 $repository = array()
 

Detailed Description

MockObject builder provides methods that are being used by the mock repository to define and create a mock object

$title = new MockObjectBuilder() $title->newObject( 'Foo', array( 'Bar' => ... ) )

SMW SMWExtension

GNU GPL v2+

Since
1.9
Author
mwjames

Constructor & Destructor Documentation

SMW\Tests\Utils\Mock\MockObjectBuilder::__construct ( MockObjectRepository  $repository = null)
Since
1.9
Parameters
MockObjectRepository | null$repository

Member Function Documentation

SMW\Tests\Utils\Mock\MockObjectBuilder::findRepositoryForObject (   $objectName)
protected
Since
1.9
Parameters
$objectName
Returns
MockObjectRepository|null
SMW\Tests\Utils\Mock\MockObjectBuilder::getInvokedMethods ( )

Returns invoked configuration keys

Since
1.9
Returns
array
SMW\Tests\Utils\Mock\MockObjectBuilder::hasValue (   $key)

Whether the configuration is known

Since
1.9
Parameters
$key
Returns
boolean
SMW\Tests\Utils\Mock\MockObjectBuilder::newObject (   $objectName,
  $objectArguments = array() 
)

Helper method that stores configuration settings

Since
1.9
Parameters
$objectName
$objectArguments
Returns
mixed
SMW\Tests\Utils\Mock\MockObjectBuilder::newRandomString (   $length = 10,
  $prefix = null 
)

Helper method that returns a random string

Since
1.9
Parameters
$length
$prefixidentify a specific random string during testing
Returns
string
SMW\Tests\Utils\Mock\MockObjectBuilder::registerRepository ( MockObjectRepository  $repository)
Since
1.9
Parameters
MockObjectRepository$repository
SMW\Tests\Utils\Mock\MockObjectBuilder::setCallback (   $key,
  $default = null 
)

Determine callback function otherwise return simple value

Since
1.9
Parameters
$key
$default
Returns
mixed|null
SMW\Tests\Utils\Mock\MockObjectBuilder::setupConfiguration (   $config)
protected
Since
1.9
Parameters
$config
SMW\Tests\Utils\Mock\MockObjectBuilder::setValue (   $key,
  $default = null 
)

Sets value

Since
1.9
Parameters
$key
$default
Returns
mixed|null

Member Data Documentation

SMW\Tests\Utils\Mock\MockObjectBuilder::$configuration
protected
SMW\Tests\Utils\Mock\MockObjectBuilder::$repository = array()
protected

The documentation for this class was generated from the following file: