Example #1
0
 protected function addContent()
 {
     $faker = Faker\Factory::create();
     $data = ['libelle' => $faker->realText(20), 'body_type' => \Distilleries\Expendable\Helpers\StaticLabel::BODY_TYPE_HTML, 'action' => uniqid(), 'cc' => $faker->email, 'bcc' => $faker->email, 'content' => $faker->text(), 'status' => \Distilleries\Expendable\Helpers\StaticLabel::STATUS_ONLINE];
     $result = \Distilleries\Expendable\Models\Email::create($data);
     \Distilleries\Expendable\Models\Translation::create(['id_element' => $result->id, 'model' => $result->getTable(), 'id_source' => 0, 'iso' => app()->getLocale()]);
     $result = \Distilleries\Expendable\Models\Email::find($result->id);
     return [$data, $result];
 }
 public function testPostReminder()
 {
     $this->app->make('Illuminate\\Contracts\\Config\\Repository')->set('mail.from', ['address' => '*****@*****.**', 'name' => '*****@*****.**']);
     $this->app->make('Illuminate\\Contracts\\Config\\Repository')->set('mail.pretend', true);
     $faker = Faker\Factory::create();
     $data = ['libelle' => $faker->realText(20), 'body_type' => \Distilleries\Expendable\Helpers\StaticLabel::BODY_TYPE_HTML, 'action' => 'emails.password', 'cc' => $faker->email, 'bcc' => $faker->email, 'content' => $faker->text(), 'status' => \Distilleries\Expendable\Helpers\StaticLabel::STATUS_ONLINE];
     $result = \Distilleries\Expendable\Models\Email::create($data);
     \Distilleries\Expendable\Models\Translation::create(['id_element' => $result->id, 'model' => $result->getTable(), 'id_source' => 0, 'iso' => app()->getLocale()]);
     \Distilleries\Expendable\Models\Role::create(['libelle' => 'admin', 'initials' => '@a', 'overide_permission' => true]);
     \Distilleries\Expendable\Models\Service::create(['action' => 'test']);
     $faker = Faker\Factory::create();
     $email = $faker->email;
     $user = \Distilleries\Expendable\Models\User::create(['email' => $email, 'password' => \Hash::make('test'), 'status' => true, 'role_id' => 1]);
     \Distilleries\Expendable\Models\Permission::create(['role_id' => 1, 'service_id' => 1]);
     $response = $this->call('POST', action('Admin\\LoginController@postRemind'), ['email' => $email]);
     $this->assertSessionHas(\Distilleries\Expendable\Formatter\Message::MESSAGE);
 }
 public function testDatatableApi()
 {
     $faker = Faker\Factory::create();
     $data = ['libelle' => str_replace('\'', '', $faker->realText(20)), 'body_type' => \Distilleries\Expendable\Helpers\StaticLabel::BODY_TYPE_HTML, 'action' => 'emails.password', 'cc' => $faker->email, 'bcc' => $faker->email, 'content' => str_replace('\'', '', $faker->text()), 'status' => \Distilleries\Expendable\Helpers\StaticLabel::STATUS_ONLINE];
     $email = \Distilleries\Expendable\Models\Email::create($data);
     \Distilleries\Expendable\Models\Translation::create(['id_element' => $email->id, 'model' => 'emails', 'id_source' => 0, 'iso' => app()->getLocale()]);
     $response = $this->call('GET', action($this->controller . '@getDatatable'));
     $this->assertResponseOk();
     $result = json_decode($response->getContent());
     $this->assertEquals(1, $result->iTotalRecords);
     $this->assertEquals($email->id, $result->aaData[0]->{0});
     $this->assertEquals($email->libelle, $result->aaData[0]->{1});
 }