public function testGetIncompleteProductLoadsWhenIdHasProduct()
 {
     $user = Factory::create('Giftertipster\\Entity\\Eloquent\\User', ['permissions' => ['test']]);
     $prod_req = Factory::create('Giftertipster\\Entity\\Eloquent\\ProductRequest', ['created_at' => Carbon::tomorrow(), 'user_id' => 1, 'product_id' => 1, 'vendor' => 'foo', 'vendor_id' => 'bar']);
     $idea = Factory::create('Giftertipster\\Entity\\Eloquent\\Idea', ['created_at' => Carbon::today(), 'user_id' => 1, 'description' => 'foobar idea', 'is_fulfilled' => 0]);
     $repo_result = $this->repo()->getIncompleteProductLoads(1);
     //since keys aren't adjusted after sorting, re apply keys:
     foreach ($repo_result as $item) {
         $result[] = $item;
     }
     assertThat($result, not(emptyArray()));
     assertThat($result[0], hasKeyValuePair('type', 'idea load'));
     assertThat($result[0], hasKey('created_at'));
     assertThat($result[0], hasKey('updated_at'));
     assertThat($result[0], hasKey('description'));
     assertThat($result[0], hasKeyValuePair('query', ['idea_description' => 'foobar idea']));
     assertThat($result[0], hasKey('human_time_diff'));
     assertThat($result, not(hasKey(1)));
 }
Exemplo n.º 2
0
 public function getCancel($user, $token)
 {
     switch ($token) {
         case 'now':
             $this->runCancel('', array('id' => $user->id));
             break;
         case 'later':
             $date = Carbon::now()->addMinutes(15);
             Queue::later($date, 'UserController@runCancel', array('id' => $user->id));
             break;
         case 'tomorrow':
             $date = Carbon::tomorrow();
             Queue::later($date, 'UserController@runCancel', array('id' => $user->id));
             break;
         case 'disable':
             if ($user->cancelled) {
                 DB::table('users')->where('id', $user->id)->update(array('confirmed' => true, 'cancelled' => false));
             }
             break;
     }
     Activity::log(array('contentID' => $user->id, 'contentType' => 'account_cancelled', 'description' => $user->id, 'details' => '', 'updated' => $user->id));
     return Redirect::to('user')->with('success', Lang::get('user/user.user_account_updated'));
 }