/**
  * A basic test example.
  *
  * @return void
  */
 public function test_read_configuration_for_reminder_days()
 {
     // emulate config set
     $expected = [3, 7, 15];
     $expectedStr = implode(',', $expected);
     \Config::set('custom.remindOnDays', $expectedStr);
     // get config values
     $reminderCalculator = new LicenceReminderCalculator();
     $remindOnDays = $reminderCalculator->getReminderDays();
     // assert
     //
     // Expected to remind for Licence expiration
     // 3, 7, 15 days before expiration day.
     $this->assertEquals($expected, $remindOnDays);
 }
 /**
  * On specific day reminder action should be listed
  */
 public function test_list_reminder_on_day()
 {
     // emulate config set
     $expected = [1, 2];
     $expectedStr = implode(',', $expected);
     \Config::set('custom.remindOnDays', $expectedStr);
     $user = factory(User::class, 'admin')->create();
     $companyOne = factory(Company::class)->create();
     $companyTwo = factory(Company::class)->create();
     $this->seeInDatabase('companies', ['id' => $companyOne->id, 'name' => $companyOne->name, 'licence_expire_at' => null])->seeInDatabase('companies', ['id' => $companyTwo->id, 'name' => $companyTwo->name, 'licence_expire_at' => null])->actingAs($user)->visit('/company/' . $companyOne->id . '/edit')->see($companyOne->name)->see('name="licence_expire_at"')->type('2016-04-30', 'licence_expire_at')->press('Save Edit')->seeInDatabase('companies', ['id' => $companyOne->id, 'licence_expire_at' => '2016-04-30', 'is_suspended' => false])->seeInDatabase('schedules', ['who_object' => Company::class, 'who_id' => $companyOne->id, 'run_at' => '2016-04-29', 'action' => ActionCommandSendReminderEmailCommand::class])->seeInDatabase('schedules', ['who_object' => Company::class, 'who_id' => $companyOne->id, 'run_at' => '2016-04-28', 'action' => ActionCommandSendReminderEmailCommand::class]);
     $this->visit('/company/' . $companyTwo->id . '/edit')->see($companyTwo->name)->see('name="licence_expire_at"')->type('2016-04-30', 'licence_expire_at')->press('Save Edit')->seeInDatabase('companies', ['id' => $companyTwo->id, 'licence_expire_at' => '2016-04-30', 'is_suspended' => false])->seeInDatabase('schedules', ['who_object' => Company::class, 'who_id' => $companyTwo->id, 'run_at' => '2016-04-29', 'action' => ActionCommandSendReminderEmailCommand::class])->seeInDatabase('schedules', ['who_object' => Company::class, 'who_id' => $companyTwo->id, 'run_at' => '2016-04-28', 'action' => ActionCommandSendReminderEmailCommand::class]);
     $repository = new ScheduleRepository();
     $date = new Carbon('2016-04-28');
     $list = $repository->getActionsForDate($date);
     $this->assertCount(2, $list);
     $list = $repository->getNewActionsForDate($date);
     $this->assertCount(2, $list);
 }
 public function testLists()
 {
     $postage = new Postage(Config::get());
     $response = $postage->lists();
     $this->assertTrue(is_array($response));
 }
 /**
  * @depends testGetSub
  */
 public function testGetProperty($cateId)
 {
     $postage = new Product(Config::get());
     $response = $postage->getProperty($cateId);
     $this->assertTrue(is_array($response));
     return $response;
 }
 /**
  * @depends testAdd
  */
 public function testGetById($groupId)
 {
     $group = new Group(Config::get());
     $response = $group->getById($groupId);
     $this->assertTrue(is_array($response));
 }
 /**
  * @depends testGetById
  */
 public function testClose($orderId)
 {
     $order = new Order(Config::get());
     $response = $order->close($orderId);
     $this->assertTrue($response);
 }
 /**
  * @depends testAdd
  */
 public function testGetById($shelfId)
 {
     $shelf = new Shelf(Config::get());
     $response = $shelf->getById($shelfId);
     $this->assertTrue(is_array($response));
 }
 public function testGetSkuInfo()
 {
     $stock = new Stock(Config::get());
     $data = $stock->getSkuInfo(array(array('a', 'a1'), array('b', 'b1')));
     $this->assertEquals('a:a1;b:b1', $data);
 }