public function testGet()
 {
     $this->assertEquals('hoge', FactorySequence::get('hoge'));
     $this->assertEquals('test_0', FactorySequence::get('test_{{sequence}}'));
     $this->assertEquals('test_1', FactorySequence::get('test_{{sequence}}'));
     $this->assertEquals('test_0', FactorySequence::get('test_{{sequence(:hoge)}}'));
 }
Example #2
0
 protected function buildAttributes($class, $args = array(), $alias = null)
 {
     $classAttr = $this->getFactory($class);
     $attributes = $classAttr['attributes'];
     if ($alias !== null) {
         $attributes = array_merge($attributes, $classAttr[$alias]);
     }
     $attributes = array_merge($attributes, $args);
     foreach ($attributes as $key => $value) {
         $attributes[$key] = FactorySequence::get($value);
     }
     return $attributes;
 }
 public function setup()
 {
     $this->factoryGirl = new FactoryGirl();
     FactorySequence::resetAll();
 }
 /**
  * All Reset Sequence Number
  */
 public static function resetAll()
 {
     self::$_sequence = array();
 }