D9705996

Experience

65,090

1 Best Reply Awards

  • Member Since 2 Years Ago
  • 670 Lessons Completed
  • 0 Favorites

9th April, 2018

D9705996 left a reply on Use A Different Database For A Single Test? • 2 months ago

@jlrdw - Prefect Thank you. I added DB::connection('mysql'); at the top of the affected test.

6th April, 2018

D9705996 started a new conversation Use A Different Database For A Single Test? • 2 months ago

I have the following test setup that tries to add an entry to a model and when I run the following test with the sqlite in-memory database everything passes.

        $this->json('POST', 'api/v1/authentications/ssh/credentials', [
            'username' => 'root',
            'password' => 'goofFnBfo9mi0Y',
            'description' => 'test'
        ])->assertStatus(Response::HTTP_CREATED);

However when I try to replicate the test with the production API I get a "Data too long for column" error from MySQL because the password value is being encrypted and is longer that the 191 character limit on the field.

I am going to change the column type to fix the problem but I really want to fix the test.

Is it possible to configure this single test to override the default database to use a MySQL database?

9th March, 2018

D9705996 left a reply on Best Practice To Store Decimal Values In Database • 3 months ago

This has good example of how to deal with currency and underlines @martinbean comments

17th February, 2018

D9705996 left a reply on How Can I Solve "Connection Could Not Be Established With Host Smtp.gmail.com"? • 4 months ago

@moses - do you have access to the command line on your staging server? If so you can try

telnet smtp.gmail.com 587

If you don't get a connection refused error then the issue is not network related

16th February, 2018

D9705996 left a reply on End To End Testing Of A Network Service • 4 months ago

I will do but I had to revert the changes as I need approval to install the PECL RPM in my work CI estate and didn't commit the changes locally :(

15th February, 2018

D9705996 left a reply on End To End Testing Of A Network Service • 4 months ago

@Borisu - I tried this out and it worked. I replaced the while loop true value in the example with a carbon instance in the future and checked if now was greater and if so end.

14th February, 2018

D9705996 left a reply on Vue-test-utils And Vuex • 4 months ago

I have managed to find a solution to the problem and to be frank it is clearly documented so a complete misunderstanding issue.

import Vuex from 'vuex';
import vuexstore from '../../../resources/assets/js/store.js'

describe('Navigation Toggler', () => {

  let wrapper;
  let store;

  const localVue = createLocalVue();

  localVue.use(Vuex);

  beforeEach(() => {
    store = new Vuex.Store(vuexstore);
    wrapper = mount(NavigationToggler, { store, localVue })
  });

...

The above sets up a local Vue instance with access to the store and uses this to create the wrapper.

Not sure if it is regarded as best practice but I will mark as the correct solution

D9705996 left a reply on End To End Testing Of A Network Service • 4 months ago

@borisu - Very interesting. I was aware of inotify but didn't realise there was a PHP implementation. I will try this out and if it works and doesn't make the tests too complex I will award you the deserved credit :D

13th February, 2018

D9705996 started a new conversation End To End Testing Of A Network Service • 4 months ago

I have an endpoint that accepts JSON data and fires an event to push that via UDP to a local network service (A graphite time series database)

In all but one of my tests that interact with the backend I am faking the event class and ensuring that the correct events are being fired (there is business logic involved to determine what parts of the JSON should be stored)

This is almost perfect but to catch any problems when I upgrade the backend (and to let me sleep easier at night as this score to the application), I have one test that fires one event and then checks to see if the corresponding file appears in the local file system.

As there is a short delay between the event being handled and the backend creating the file I have had to add a half second sleep to the test. It works but seems wrong. I thought about a loop to repeatedly check for the file and fail after X seconds but seems equally wrong.

I wonder if anyone else has had similar experience and found anything more elegant.

D9705996 left a reply on Once Again, Polymorphic Many To Many? • 4 months ago

As a report job can only be of a single type you don't need a many to many relationship.

A polymorphic relationship will suffice.

You just need to ensure that when report job is created you specify the correct Id and type are inserted into the morph fields and to you can then access the eloquent relationship as per a non-polymorphic version

D9705996 left a reply on Query Sqlite Database While Test Is Running. • 4 months ago

It looks like this is not possible.

It would not be normal to interrogate the database directly with SQL mid test. Is their a reason you cannot do dd the all the models records in your test

e.g. dd(User::all());

D9705996 left a reply on Vue-test-utils And Vuex • 4 months ago

@syropian - what you seems to make sense to me to certain extent but I am trying to follow the testing vue series mantra of test the "public" api of the component. E.g. I only care that when the component is clicked the icon the user sees changes (there are other things that occur in the UI at a variety of levels in the hierarchy).

To avoid having to emit and listen to events all of the application I feel Vuex is the correct solution and has created some pretty elegant structured code.

Do you have any examples or suggestions about "a different test" might look like that doesn't involve duplicating the logic from the store (I briefly toyed with this idea but in the words of Jeff it had a high ick factor)

D9705996 started a new conversation Vue-test-utils And Vuex • 4 months ago

I am working on a my first larger application with Laravel and Vue and I am trying to figure out how to integrate Vuex into vue-test-utils using mocha-webpack and expect. Below is a simplified view of the store

{
    "ui": {
        "navigation": {
            "toggled":false
        }
    }
}

I have an mutation that toggles the toggled boolean value which is commited when the user clicks a button.

Everything works as expected in the browser but when I try to run the following in a test

  it('should toggle', () => {
    wrapper = mount(NavigationToggler); 
    wrapper.find('ul').trigger('click');
    expect(wrapper.find('svg').attributes()['data-icon']).toBe('chevron-circle-right');

    wrapper.find('ul').trigger('click');
    expect(wrapper.find('svg').attributes()['data-icon']).toBe('chevron-circle-left');
  })

I am getting the following error

       "before each" hook for "should have the correct positioning":
     TypeError: Cannot read property 'state' of undefined

I am pretty sure it is because the mounted component doesn't have access have access to the Vuex store but looking through the documentation I have become a little lost as the documentation is talking about mocking the store using createLocalVue but I think this is testing that specific mutations, actions, etc are being fired but I am trying to blackbox test the full thing.

Any pointers gratefully accepted

10th February, 2018

D9705996 left a reply on Passport Working On One Dev Machine But Not The Other • 4 months ago

Ah ok, I know with apache you have to configure it to accept the authorization header but not relevant to you.

Any additional information in any logs?

9th February, 2018

D9705996 left a reply on Passport Working On One Dev Machine But Not The Other • 4 months ago

What webserver are you using? Is it apache?

6th February, 2018

D9705996 left a reply on Taylor Otwell Cancelled My Account Without Asking Me • 4 months ago

@georgek - this doesn't seem to be your first issue with forge. Regardless of interpretation of the t&c's for forge it does look like a sensible outcome. You now have a provider you are happy with and Taylor can continue to support the many customers using this service successfully. I'm sure if you need support in the future and if you abide by the laracasts code of conduct you will receive the full support of all of its members

19th January, 2018

D9705996 left a reply on Git Workflow Question • 4 months ago

Gitlab is super easy to install, update and maintain. It also has advanced features like continuous integration that you can use if/when you need them. I will warn that git is complex but worth it compared with svn, etc.

https://laracasts.com/series/git-me-some-version-control will get you through it.

If you need any gitlab help please let me know.

17th July, 2017

D9705996 left a reply on Delay Execution Of An Event Listener By A Specific Time • 11 months ago

Without seeing your code it's hard to tell exactly how you plan to achieve you goal but sounds ok. What I would do though is in the controller create the model as normal without performing the thumbnail creation and then fire an event from the controller that performs the isolated image optimisation (You can pass the model into the event constructor)

16th July, 2017

D9705996 left a reply on Delay Execution Of An Event Listener By A Specific Time • 11 months ago

https://laravel.com/docs/5.4/events#dispatching-events

You for firing an instance of your event class

15th July, 2017

D9705996 left a reply on Delay Execution Of An Event Listener By A Specific Time • 11 months ago

You can use the global event method in your model e.g. event(new whateverYourEvent) to fire your event

14th July, 2017

D9705996 left a reply on Delay Execution Of An Event Listener By A Specific Time • 11 months ago

You probably want a delayed job to when fire your event https://laravel.com/docs/5.4/queues#delayed-dispatching

12th April, 2016

D9705996 left a reply on Discovering Report Classes • 2 years ago

I would inject the array into the class through the constructor rather than a protected function. You could then use a service provider to generate the array ( https://laracasts.com/series/laravel-5-from-scratch/episodes/16 should help). You then only have to modify the service provider any time you want to add a new report.

You could also retrieve the report names from a database, etc in the service provider.

If you are not already doing so I would ensure that you are programming your reports to a common interface. You can then sanity check the classes you are newing up using

class_implements($class)

and making sure the return array contains your interface otherwise throw an exception before trying to use the methods.

11th April, 2016

D9705996 left a reply on Discovering Report Classes • 2 years ago

I found this tutorial really useful for a very similar problemhttp://zaengle.com/blog/replace-conditional-with-polymorphism

7th April, 2016

D9705996 left a reply on Full Course Vs Series Lessons • 2 years ago

Completely agree. The individual lessons are superb and some individual ones are worth the monthlt cost alone but sometimes feels like @jeff_way isnt sure in which direction a series is going. The latest vue series is a prime dxample...is this finished or not? There were mentions of vuex by jeff. Appreciate some of the series are based on bleeding edge technology and predicting the future is hard!

The above is meant in a constructive way and not trying to pick holes in what is one of the best resources i have ever used.

D9705996 left a reply on Saving A Model With One More Key Than Just Id • 2 years ago

https://github.com/vinkla/hashids is useful to obfuscate the primary keys from the user whilst maintaing the benefits of integer based keys in the database.

D9705996 left a reply on Full Course Vs Series Lessons • 2 years ago

One problem I have is not the lesson frequency but what lessons are going to compromise a course. Would great to see a list of all lessons proposed in a series when it is created. Personally if this changes of the lifecycle of the series fine (change is inevitable) but having a rough idea of where a series is going would really help

D9705996 left a reply on Saving A Model With One More Key Than Just Id • 2 years ago

Taylor's comments at https://github.com/laravel/framework/issues/5355 mean eloquent isn't ever going to be an option if you need this feature. You maybe able to workaround it though from some of the comments

D9705996 left a reply on Saving A Model With One More Key Than Just Id • 2 years ago

I think that eloquent doesn't and won't support composite keys. You may need to use the query builder with the id array from the above. If I can find the GitHub issue I will post a link

19th December, 2015

D9705996 left a reply on Need Some Help With The Schema For "card Game As A Service" • 2 years ago

From your schema i dont see the direct relationship between team and deck. A player plays in a team and a team plays a game. Would create a table for gamedeckcard. The pk is game id deck id and card id and has a played attribute. You can then update this table with the used and available cards

Also i hope its a cards against humanity like game and your not just copying the content as that is very ropey on a copyright front!

27th November, 2015

D9705996 left a reply on Jeffrey Is A Superhero • 2 years ago

I love that the videos are a mix of concept and deep dive

18th November, 2015

D9705996 left a reply on WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! • 2 years ago

You probably want avoid deleting known hosts file. The error tells you the file and line number /Users/USERNAME/.ssh/known_hosts:2 to fix you can do vi /Users/USERNAME/.ssh/known_hosts +2 to open at second line then do dd to delete the line then :wq to save then try ssh again

5th November, 2015

D9705996 left a reply on Is It Possible To Create A Monitoring Page For Your Server? • 2 years ago

You probably don't want to roll your own. Look at collectd, graphite and grafana which will give you customised dashboards

30th October, 2015

D9705996 left a reply on Vue.js Acces Parent Methods • 2 years ago

As much as a pita it might be i would look to remove anything not 1.x.x from your vue code.

I spent hours looking a components and events with 0.12.x and even the betas and ended up with an absolute mess. The official release just works. Using dispath and broadcast events.

Hardest part is building ghe hierarchy

D9705996 left a reply on Vue Events - Siblings • 2 years ago

Oh and anyone not using vue - start now, it is amazing. I wrote a small app in 1 hour that would have taken weeks with jquery et al

D9705996 started a new conversation Vue Events - Siblings • 2 years ago

I am writing an app where i have some vue components in a hierarchy. I can send events to a parent component and broadcast to all children which works fine.

Is it possible to notify siblings of an event directly?

15th September, 2015

D9705996 left a reply on How To Pass Vue Variables To Php Functions • 2 years ago

You can use the v-cloak directive (http://vuejs.org/api/directives.html#v-cloak) to hide the application until everything is ready

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.