示例#1
0
 /**
  * Create dummy instances
  */
 protected function setUp()
 {
     DB::table('dummy_fakable_models')->truncate();
     $this->model = new DummyFakableModel();
     $this->fakable = new Fakable($this->model);
     $this->fakable->setSaved(false);
 }
示例#2
0
 public function testCanSetFixtureForAllFutureFakableInstances()
 {
     Fakable::$baseFixture = __DIR__ . '/_meta/fixture.yml';
     $model = new DummyFakableModel();
     $model = $model->fakable()->fakeModel();
     $this->assertRegExp('/[a-z]/', $model->name);
 }
 /**
  * Generate multiple entries
  *
  * @param integer $min
  * @param integer $max
  * @param array   $attributes
  *
  * @return array
  */
 public function generateEntries($min = 5, $max = null, array $attributes = array())
 {
     $isEmpty = $this->generateEntry();
     if (empty($isEmpty)) {
         return array();
     }
     $entries = [];
     $max = $max ?: $min + 5;
     $pool = $this->fakable->getFaker()->numberBetween($min, $max);
     for ($i = 0; $i < $pool; $i++) {
         $entries[] = $this->generateEntry($attributes);
     }
     return $entries;
 }
示例#4
0
 /**
  * Get a fakable instance
  *
  * @param Command $command
  *
  * @return Fakable
  */
 public static function fakable(Command $command = null)
 {
     $fakable = new Fakable(new static());
     $fakable->setCommand($command);
     return $fakable;
 }