DefaultPropertySetTest extends TestCase
Tests the DefaultPropertySet class This is partially an integration test as DefaultPropertySet properties can't really be mocked.
Table of Contents
$instance | Property set instance | IPropertySet |
---|---|---|
$props | Test property config array | array |
setUp() | void | |
createIPropertySet() | IPropertySet | |
testContructor() | Tests the DefaultPropertySet constructor. | void |
testUniqueId() | Tests that the unique id property for some property works. | void |
testMagicClone() | Test the DefaultPropertySet::__clone() magic method. | void |
testGetProperty() | Test IPropertySet::getProperty() When supplied with a property name that is a member of the property set, this will return an IProperty instance. | void |
testGetPrimaryKey() | Test IPropertySet::getPrimaryKey() Expects a single IProperty instance with the PRIMARY flag set on the IPropertyFlags instance. | void |
testGetPrimaryKeys() | Test IPropertySet::getPrimaryKeys() If more than one IProperty instance in the set has the IPropertyFlags::PRIMARY flag set, this will return all of corresponding IProperty instances. | void |
testGetProperties() | Test IPropertySet::getProperties() Expects all IProperty instances to be returned that are contained in the set | void |
testFindProperty() | Test IPropertySet::findProperty() Expects a list of IProperty instances to be returned that have any of the supplied IPropertyFlags bits enabled. | void |
testGetPropertiesByType() | Test IPropertySet::getPropertiesByType() Expects a list of IProperty instances to be returned that have the same type as the supplied argument. | void |
Properties
$instance
Property set instance
private
IPropertySet
$instance
$props
Test property config array
private
array
$props
Methods
setUp()
public
setUp(
)
: void
createIPropertySet()
protected
createIPropertySet(
$props :
array
)
: IPropertySet
Parameters
- $props : array
Return values
IPropertySettestContructor()
Tests the DefaultPropertySet constructor.
public
testContructor(
)
: void
This expects: 1) The members of the set must match all property names in the config 2) The set must have a value of zero (zero bits set) 3) Supplying a factory that returns something other than IProperty instances MUST throw an \InvalidArgumentException
This tests with PropertyFactory and QuickProperties
Tags
testUniqueId()
Tests that the unique id property for some property works.
public
testUniqueId(
)
: void
As per the config in this file, the name property is expected to have an id of 1, and all other properties have an id of zero.
testMagicClone()
Test the DefaultPropertySet::__clone() magic method.
public
testMagicClone(
)
: void
This expects the clone operator to clone all of the internal IProperty instances.
testGetProperty()
Test IPropertySet::getProperty() When supplied with a property name that is a member of the property set, this will return an IProperty instance.
public
testGetProperty(
)
: void
If an invalid property name is supplied, this throws an InvalidArgumentException.
testGetPrimaryKey()
Test IPropertySet::getPrimaryKey() Expects a single IProperty instance with the PRIMARY flag set on the IPropertyFlags instance.
public
testGetPrimaryKey(
)
: void
If no primary key is defined, an Exception is expected
testGetPrimaryKeys()
Test IPropertySet::getPrimaryKeys() If more than one IProperty instance in the set has the IPropertyFlags::PRIMARY flag set, this will return all of corresponding IProperty instances.
public
testGetPrimaryKeys(
)
: void
testGetProperties()
Test IPropertySet::getProperties() Expects all IProperty instances to be returned that are contained in the set
public
testGetProperties(
)
: void
testFindProperty()
Test IPropertySet::findProperty() Expects a list of IProperty instances to be returned that have any of the supplied IPropertyFlags bits enabled.
public
testFindProperty(
)
: void
testGetPropertiesByType()
Test IPropertySet::getPropertiesByType() Expects a list of IProperty instances to be returned that have the same type as the supplied argument.
public
testGetPropertiesByType(
)
: void