예제 #1
2
파일: UserTest.php 프로젝트: ndrx-io/elude
 public function __construct($name = null, array $data = array(), $dataName = '')
 {
     $this->faker = \Faker\Factory::create();
     if (is_null(self::$password)) {
         self::$password = $this->faker->password();
     }
     parent::__construct($name, $data, $dataName);
 }
예제 #2
0
 public function setUp()
 {
     $this->manager = $this->getManager();
     parent::setUp();
     $this->user = $this->userRepository->create(new \App\User(['username' => $this->faker->userName, 'email' => $this->faker->safeEmail, 'password' => $this->faker->password()]));
     $this->group = $this->groupRepository->create(new \App\Group(['name' => uniqid()]));
     $this->role = $this->roleRepository->create(new \App\Role(['name' => uniqid(), 'filter' => 'A']));
     $this->roleRevoke = $this->roleRepository->create(new \App\Role(['name' => uniqid(), 'filter' => 'R']));
     $this->permissionFirst = $this->permissionRepository->create(new \App\Permission(['area' => uniqid(), 'permission' => uniqid(), 'description' => 'test']));
     $this->permissionSecond = $this->permissionRepository->create(new \App\Permission(['area' => uniqid(), 'permission' => uniqid(), 'description' => 'test']));
     $this->initiate();
 }
예제 #3
0
파일: UserTest.php 프로젝트: ndrx-io/elude
 public function testAddPermissionTwice()
 {
     $permission = \App\Permission::create(['area' => uniqid(), 'permission' => uniqid(), 'description' => uniqid()]);
     $user = $this->repository->create(new \App\User(['username' => $this->faker->userName, 'email' => $this->faker->safeEmail, 'password' => $this->faker->password()]));
     $this->assertModel($user, true);
     $this->repository->addPermission($user, $permission);
     $this->repository->addPermission($user, $permission);
 }
예제 #4
0
 public function testPasswordIsValid()
 {
     $this->assertRegexp('/^.{6}$/', $this->faker->password(6, 6));
 }
예제 #5
0
 /**
  * Generate a password
  *
  * @return  string
  */
 public function password()
 {
     return $this->faker->password();
 }