コード例 #1
0
ファイル: ConfigTest.php プロジェクト: 501st-alpha1/Specify
 public function testCloneModes()
 {
     $this->config->is_deep = false;
     $this->config->deep[] = 'user';
     $this->assertTrue($this->config->propertyIsShallowCloned('profile'));
     $this->assertFalse($this->config->propertyIsShallowCloned('user'));
     $this->assertTrue($this->config->propertyIsDeeplyCloned('user'));
 }
コード例 #2
0
 /**
  * @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);
         }
     }
 }
コード例 #3
0
ファイル: Specify.php プロジェクト: codeception/specify
 /**
  * @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;
 }
コード例 #4
0
ファイル: Unit.php プロジェクト: phalcon/cphalcon
 /**
  * Executed before each test.
  *
  * @param TestInterface $test
  */
 public function _before(TestInterface $test)
 {
     $this->test = $test;
     SpecifyConfig::setDeepClone(false);
 }
コード例 #5
0
<?php

// This is global bootstrap for autoloading
require_once __DIR__ . '/../src/ArchiDelivery/Autoloader.php';
use ArchiDelivery\Autoloader;
Autoloader::init();
\Codeception\Specify\Config::setDeepClone(false);
コード例 #6
0
 public function specifyConfig()
 {
     if (!$this->specifyConfig) {
         $this->specifyConfig = Config::create();
     }
     return new ConfigBuilder($this->specifyConfig);
 }