Recent content by Earl

  1. Earl

    Implemented Remote Attachments storage

    Where is this implemented in core? How to use external server for attachments?
  2. Earl

    XF 2.2 user list oder by last_activity is caching, how to force update it?

    Okay, I found these two lines from the hourly cleanUp job: /** @var \XF\Repository\SessionActivity $activityRepo */ $activityRepo = $this->repository('XF:SessionActivity'); $activityRepo->updateUserLastActivityFromSession(); I believe adding these two lines to my add-on code would fix it, but...
  3. Earl

    XF 2.2 user list oder by last_activity is caching, how to force update it?

    I have this line in my repository $recent_active_user = $this->finder('XF:User')->where('user_id', $userIds)->>order( 'last_activity', 'DESC', )->fetchOne(); $userIds has few ID numbers, and I want to find the recent active user from this few users, but I don't get the accurate update when I...
  4. Earl

    XF 2.2 A simple refresh <xf:button />

    thank you! this works
  5. Earl

    XF 2.2 A simple refresh <xf:button />

    This can be a silly question but please help, I have a custom template in notice system. I need to add a simple refresh button in it. which parameters and values should I add to the <xf:button /> ?
  6. Earl

    XF 2.2 Locate example code to page update when data updated (thread view page)

    oh, it seems like this div block js-newMessagesIndicator pops out only when a message is being typed. I am trying to develop an account activation system in which some data gets updated via API calls, and I want to refresh a special page that is only allowed to be viewed by a specific user when...
  7. Earl

    XF 2.2 Locate example code to page update when data updated (thread view page)

    Just like in the thread view page, when someone adds a reply, we can see a small message that new posts have been added. Where to locate this code? My add-on has a different page. I need to update that page when some data is received in the database, without the user hitting the refresh button.
  8. Earl

    Unit testing XenForo addons - tutorial

    it worked! This line $res = $client->get("http://api.ipstack.com/$earliest_ip?access_key=$api"); stays inside my repository method named getIPCountryOfUser(User $user){..} As you can see it only accepts the User object, so I thought I had dependency inject a Client object into this method...
  9. Earl

    Unit testing XenForo addons - tutorial

    fakesHttp returns the client object? and aren't we supposed to use that client object to make the request? Because I var_dumped the history, and I received a bunch of HTTP data and I don't think it shortcircuits the request.
  10. Earl

    Unit testing XenForo addons - tutorial

    I will share something related to unit testing here with everyone who's interested in mocking $this->app()->http()->client() in a different way: I have this line in my addon code, and I am going to mock the response as opposed to sending the HTTP request to server (api.ipstack.com): $res =...
  11. Earl

    XF 2.2 Is there a way to enable a disabled event handler on-fly ?

    I am writing a test case, and mocking the http client() request using the http_client_options event listener. But I do not want that event listener always enabled. Is there a way to keep it off, and turn it on programmatically? (please change the threat type to Question if a moderator see this...
  12. Earl

    Unit testing XenForo addons - tutorial

    Ah! I found the reason. I'm supposed to add parent::setUp(); inside setUp() otherwise $this->app does not work.
  13. Earl

    Unit testing XenForo addons - tutorial

    I tried to mock the user entity $user_mock = $this->mockEntity('XF:User'); but I'm getting this error: Error: Call to a member function em() on null /opt/project/code/src/addons/Earl/PV/vendor/hampel/xenforo-test-framework/src/Concerns/InteractsWithEntityManager.php:67...
  14. Earl

    Unit testing XenForo addons - tutorial

    Okay, here is the real problem I'm facing now. I have added a new API endpoint, and the controller class that belongs to it has the "actionPost" method. what is the correct procedure to create a controller instance for the testing purpose of this actionPost method? edit: maybe I asked another...
Back
Top Bottom