What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

spryker, please stop using statics and global constants. It's a nightmare to unit test. And please d

UNBSW8S8K
UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet
edited September 2020 in Help

spryker, please stop using statics and global constants. It's a nightmare to unit test. And please depracate/remove LoggerTrait and ErrorLogger, as it is braking https://en.wikipedia.org/wiki/Dependency_inversion_principle.

Comments

  • Stanislav Matveyev
    Stanislav Matveyev Tech Lead @ Spryker Sprykee Posts: 211 πŸ§‘πŸ»β€πŸš€ - Cadet

    What do you mean statics and global const?

    any example to get your question?

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited September 2020

    Search in vendor for any global constant like:

    APPLICATION_ROOT_DIR
    APPLICATION_ENV
    ...
    

    Search in vendor for ErrorLogger:: or Config:: or Store:: and then, please unit test these classes in reasonable way. Good luck!

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    Why do you need to unit test ErrorLogger? For Config you can set any config value for test with \SprykerTest\Shared\Testify\HelperConfigHelper.

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    I don't need unit test error logger. But because you guys love to use statics, it is hard to test if logger is logging something.

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    If I understand you correctly you call a method and then you want to see if something ended up in the log?

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    No. If I inject logger interface mock, and I put expectation on it, I expect it is called. Sounds like you never unit tested...

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    And you are super judgmental about people that you never meet or worked with.

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    Yeah, not the first time "Spryker" acting as developing gods.

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    I pointed out this issue to one of your senior architects more than year ago, now it is getting worse and worse.

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    But again, you guys are the "gods", and I, as a user am stuck with this.

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    As far as I can see from this thread you have exactly 3 examples

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    and none are affecting the actual logic, but I might be wrong

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited September 2020

    Ok, test this method, that you expect exception logged https://sprykercommunity.slack.com/archives/CKJRJM5FG/p1600695919008200

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    who is you? I am seeing this code for the first time πŸ˜„

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    Whatever...

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    This example is not the best one for sure and I would not write it like this.

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    I don't care about your thoughts.

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    And spryker is full of examples like that.

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    I have a stupid question, why are you testing Spryker code? Shouldn' you test your logic that you wrote?

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    I am not testing spryker code. I am extending spryker code which is depending on that method. And I want to know that I didn't brake original behavior.

    Stop asking stupid questions, please.

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    This is like testing if libraries work. But maybe I am missing a point of testing. If there is a bug feel free to report it.

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    You are the bug

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    Stop commenting, please. Unless you have valuable input.

  • Thomas Lehner
    Thomas Lehner Support Engineer @ Spryker Posts: 289 πŸ› - Council (mod)

    @UNBSW8S8K your opinion is noted, thank you. And while we appreciate your feedback (we really do, you make our product better), please take a step back and evaluate whether you approach here is yielding the results you are after

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    @tom.lehner please ask people to stop giving input if it is useless.

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    Thanks for noting this serious issue in whole spryker codebase.