public function testDefaults() { $this->assertTrue($this->config->propertyIgnored('backupGlobals')); $this->assertTrue($this->config->propertyIgnored('dependencies')); $this->assertTrue($this->config->propertyIsDeeplyCloned('user')); $this->assertFalse($this->config->propertyIsShallowCloned('user')); }
/** * @param $properties * @return array */ private function specifyCloneProperties($properties) { foreach ($properties as $property => $val) { if ($this->specifyConfig->propertyIgnored($property)) { continue; } if ($this->specifyConfig->classIgnored($val)) { continue; } if ($this->specifyConfig->propertyIsShallowCloned($property)) { if (is_object($val)) { $this->{$property} = clone $val; } else { $this->{$property} = $val; } } if ($this->specifyConfig->propertyIsDeeplyCloned($property)) { $this->{$property} = $this->copier->copy($val); } } }
/** * @return ObjectProperty[] */ private function getSpecifyObjectProperties() { $objectReflection = new \ReflectionObject($this); $propertiesToClone = $objectReflection->getProperties(); if (($classProperties = $this->specifyGetClassPrivateProperties()) !== []) { $propertiesToClone = array_merge($propertiesToClone, $classProperties); } $properties = []; foreach ($propertiesToClone as $property) { if ($this->specifyConfig->propertyIgnored($property->getName())) { continue; } $properties[] = new ObjectProperty($this, $property); } // isolate mockObjects property from PHPUnit_Framework_TestCase if (($phpUnitReflection = $this->specifyGetPhpUnitReflection()) !== null) { $properties[] = $mockObjects = new ObjectProperty($this, $phpUnitReflection->getProperty('mockObjects')); // remove all mock objects inherited from parent scope(s) $mockObjects->setValue([]); } return $properties; }