public function testSave()
 {
     $faker = Faker\Factory::create();
     $data = ['libelle' => $faker->name, 'initials' => $faker->name, 'overide_permission' => true];
     $this->call('POST', action($this->controller . '@postEdit'), $data);
     $total = \Distilleries\Expendable\Models\Role::where('initials', $data['initials'])->where('libelle', $data['libelle'])->count();
     $this->assertEquals(1, $total);
 }
Esempio n. 2
0
 public function applyFilters()
 {
     parent::applyFilters();
     if (UserUtils::isNotSuperAdmin()) {
         $super_admin = Role::where('initials', '=', '@sa')->get()->last();
         if (!empty($super_admin)) {
             $this->model = $this->model->where('role_id', '!=', $super_admin->id);
         }
     }
 }