In PHP, False is Sometimes True
Sometimes it’s the little things that get you. This is more of just a reminder than anything else. One of the fun quirks (and I hesitate to call it a quirk because it’s technically working as defined) in PHP.
Sometimes it’s the little things that get you. This is more of just a reminder than anything else. One of the fun quirks (and I hesitate to call it a quirk because it’s technically working as defined) in PHP.
I’m very lucky to receive multiple LinkedIn requests to connect each week. I rarely accept them, unless I happen to recognize or know the person. Also, if they have a compelling message and I think they might follow up, then fine, too. But that’s where it usually ends…
I’m guilty of creating stub-like classes in my tests to unit test traits, sometimes. So, you end up with a special class inside your unit test file, perhaps at the bottom, that is empty but only extends the trait or something like that. This is not a good idea, but it was my only way that I could figure out how to unit-test traits separately - especially if they were made of protected methods.
Every PHP programmer knows you can’t extend multiple classes with PHP. You can only do one - which is fine. In fact, if you need more shared code, make sure to focus on using traits instead.
I hate to admit it, but I do like Laravel’s Tinker package. Sometimes, just testing out your relationships on the command line before you go further is super helpful.
One of my projects involves Google AdWords. I was dealing with ad groups in AdWords and I realized I had made a few case mistakes with the filenames. I had files named Adgroup.php
instead of AdGroup.php
. I went and changed the file name, but, since my project is managed with git, I couldn’t commit the changes. My Mac drive was not case sensitive. Oops, forgot about that.
So, after reading some of my own entries on my blog, I realized that my last re-design made the font kind of hard to read. Plus, I was reading it on a 27" monitor, and it became hard to keep the long lines of text straight. So, I opted for a re-design… but not before I looked at my Google Analytics.
Normally, when I write unit tests, I don’t use Laravel’s facade and fakery methods. I do a lot of injection of services, but in one particular case, when working with the Queue system, I had to use the facade for faking the queue and asserting some jobs were pushed.
If you’re not using Swagger (or OpenAPI) yet to document your APIs, you should start. It’s pretty simple to get started - especially in PHP. I recommend using the swagger-php package - it’s pretty easy. Just use annotations, and then generate the Swagger definition when you’re done.
“The real reason we’re not successful or getting a bunch of sales, is because we’re missing feature X, Y and Z! Add them immediately!”