コード例 #1
0
ファイル: RepositoryTest.php プロジェクト: jaggy/epoch
 /** @test **/
 public function it_takes_in_parses_builds_and_persists_the_configuration()
 {
     $file = support_path('stubs/post_entity_stub.yml');
     $repository = new Repository($file);
     $repository->save();
     $this->seeInDatabase('entities', ['name' => 'Post']);
     $this->seeInDatabase('attributes', ['name' => 'id', 'type' => 'integer', 'required' => true, 'increments' => true]);
     $this->seeInDatabase('attributes', ['name' => 'title', 'type' => 'string', 'required' => true]);
     $this->seeInDatabase('attributes', ['name' => 'content', 'type' => 'markdown', 'required' => true]);
     $this->seeInDatabase('attributes', ['name' => 'status', 'type' => 'string', 'default' => 'draft']);
     $this->seeInDatabase('attributes', ['name' => 'modified_at', 'type' => 'datetime', 'default' => 'time->now()']);
 }
コード例 #2
0
ファイル: helpers.php プロジェクト: jaggy/epoch
 function createEntity($entity)
 {
     $file = support_path("factories/{$entity}.yml");
     $repository = new Alchemy\Config\Repository($file);
     return $repository->save();
 }