Laravel Testing: Authorization, Traits, and MySQL vs SQLite

Поділитися
Вставка
  • Опубліковано 8 січ 2025

КОМЕНТАРІ • 28

  • @chlouis-girardot
    @chlouis-girardot 2 роки тому +1

    Always useful, thanks a lot Sir 🙏. I'll improve my tests 💪

  • @yungifez
    @yungifez 2 роки тому +6

    I forgot to refactor the academic year test🤣🤣

  • @MohammadRoshandelpoor
    @MohammadRoshandelpoor Рік тому

    It was useful, I really appreciate it

  • @CyanidePierce90
    @CyanidePierce90 2 роки тому +1

    While watching this it made me think of maybe a good scenario to do a video on. What if you had a bit of a legacy Laravel app and wanted to introduce testing.
    Take a simple blog/comments app that already has data in the database, there would no migrations or seeders. How would you set up testing, could you use refresh database etc?

    • @LaravelDaily
      @LaravelDaily  2 роки тому +1

      Good idea, but that's not a video, it would be a 4-hour course marked as "horror stories" :) not sure if people would pay for it

    • @CyanidePierce90
      @CyanidePierce90 2 роки тому

      @@LaravelDaily is there really that much work involved? I think that right justify a course on it. We too often get the nice/happy path in tutorials which can halt problem solving skills

    • @LaravelDaily
      @LaravelDaily  2 роки тому +2

      The last time I had to upgrade Laravel 5.4 app to Laravel 8, it took 3 weeks full time.

    • @elmalleable
      @elmalleable 2 роки тому +2

      so a project i have been working on and off for a while, with only migrations and at a point another dev had to add features and went straight to adding tables and columns directly into the db and requiring everying to now have an actual copy.
      lucky there is a package that can look at your database and spin up migration files for you. so i did that then gradually worked in some seeders and minimum test over a couple of days.
      but then i wanted to use sqlite and run into the same kind of challenges Povilas run to in this video because the running databases are mysql.
      testing in an environment that is different from what your production environment will be honest is a waste of effort and time unless you have some business case.
      Around this same point, i used to develop heavily on windows and deploy to linux and then i started running into issues like the code works fine on windows but will not follow my orders no matter how much i beg and debug.
      Long story short i just installed a vm to run linux and all development work so that i have the same environment as my servers... and it is support enjoyable.
      The knowledge and experience gained from running into issues and prod and on local is now sharable.
      but a question to Povillas, realising that sqlite is useful due to how fast it can run unit test.
      can you share insights into getting sqlite to work for unit test or would you share my opinion of not wasting time on it if we can use useDatabaseRefresh to make the reasonably performant because honestly i think if all tests are completing in a good amount of time the struggling to fix sqllite issues is a distraction and takes away time from solving or working on features that bring revenue or strenghtens the position of the business.
      However if you have test that take a while and realise sqlite can reduce the testing time by a good factor or quantity then it definitly makes sense to spend time on it to get it to work because it is going to count towards improvement of the position and revenue of the business

  • @Dan-pm4hd
    @Dan-pm4hd Рік тому

    Hi, how did you set up MySQL test database? Spent a few weeks trying to configure it and I just run into a wall every time.

  • @jderdmann1
    @jderdmann1 2 роки тому +2

    I have 2565 tests for my business site. I don't deploy anything to it without tests.

    • @trap7369
      @trap7369 2 роки тому +1

      O.o how many loc you have for all these tests?

    • @jderdmann1
      @jderdmann1 2 роки тому

      @@trap7369 I don't know what you mean by "loc"

  • @khaledwaleed6395
    @khaledwaleed6395 2 роки тому

    hi
    I'm struggling with subscription I'm getting my card (The card was declined.)
    I double-checked the amount and it's OK

    • @LaravelDaily
      @LaravelDaily  2 роки тому

      Sorry but I can't do much about it, payments are handled by the Teachable platform, email support@teachable.com

  • @PIka15Channel
    @PIka15Channel 2 роки тому

    Thanks for the stream as always!~
    Anyway, can you make a course about laravel testing via browser interaction like from jquery (show/hide modal, ajax, etc.)? I want to start writing a test, but I'm using jquery for all of my projects and incoming projects. Thanks in advance.

    • @LaravelDaily
      @LaravelDaily  2 роки тому

      Then tou probably need Laravel Dusk, read its documentation.

  • @haraldndb.1250
    @haraldndb.1250 2 роки тому

    Thx Povilas!

  • @jatinchauhan323
    @jatinchauhan323 2 роки тому

    Is it possible to save something in env from controller method?

    • @yungifez
      @yungifez 2 роки тому

      I would not advice on that, but yes
      Please do not do this

    • @jatinchauhan323
      @jatinchauhan323 2 роки тому

      @@yungifez why?

    • @yungifez
      @yungifez 2 роки тому

      @@jatinchauhan323 for what purposes exactly

    • @yungifez
      @yungifez 2 роки тому

      @@jatinchauhan323 i wrote a method for this
      But not in controller

    • @jatinchauhan323
      @jatinchauhan323 2 роки тому

      @@yungifez what is it?