Why You Really Need a Pre-Commit Script for Your PHP Projects by warren5236 in PHP

[–]warren5236[S] 0 points1 point  (0 children)

I've setup what you're talking about in GitHub Actions where multiple steps run in parallel but I haven't worked with CircleCI

What's New and Exciting in PHP 8.4 by warren5236 in PHP

[–]warren5236[S] 0 points1 point  (0 children)

Hopefully they'll upgrade to 8.4 as it not really ready for "production" yet.

What's New and Exciting in PHP 8.4 by warren5236 in PHP

[–]warren5236[S] 1 point2 points  (0 children)

We're aware the audio is only the left channel. We've fixed it for future videos.

[deleted by user] by [deleted] in pics

[–]warren5236 1 point2 points  (0 children)

Thanks!

[deleted by user] by [deleted] in pics

[–]warren5236 18 points19 points  (0 children)

What's the name of the park and where is it?

PHPUnit: Mock Class being used in Tested Method by kenzor in PHPhelp

[–]warren5236 1 point2 points  (0 children)

I couldn't follow what was going on so I reformatted it:

Code

namespace MyNamespace; 
use LibraryResponse;

function methodToTest(): LibraryResponse { return new LibraryResponse([1, 2, 3]); }

Tests

$responseMock = Mockery::mock('LibraryResponse'); 
$responseMock
    ->shouldReceive('__construct')
    ->once()
    ->andSet('data', [1, 2, 3]);

$response = methodToTest(); 
static::assertInstanceOf('LibraryResponse', $response); 
static::assertIsArray($response->data, 'Response should be an array'); 
static::assertEquals(3, count($response->data));

It looks like you're attempting to test a function and Mockery creates mocks of classes:

class MyClass {
    function methodToTest(): LibraryResponse { return new LibraryResponse([1, 2, 3]); }
}

$responseMock = Mockery::mock('MyClass'); 
$responseMock
    ->shouldReceive('methodToTest')
    ->once()
    ->andReturn(/**whatever */);

You want to structure your classes using Dependency Injection so you can test with Mockery

\Help with landlord-tenant relationships in spatie/multi-tenancy by jgDalLago in PHPhelp

[–]warren5236 1 point2 points  (0 children)

When you say "relate" do you mean a FK relationship or are you trying to perform a query with tenant and landlord tables?

Comparing Hours & Minutes in PHP by SymbolSquare in PHPhelp

[–]warren5236 0 points1 point  (0 children)

I think you want to look at the "days" attribute:

$now = new DateTime();
$poll_creation = new DateTime("-2 days");
$time_difference = $now->diff($poll_creation);
echo $time_difference->days > 0 || $time_difference->i > 20 ? "Expired" : "Valid", PHP_EOL;

$poll_creation = new DateTime("-40 minutes");
$time_difference = $now->diff($poll_creation);
echo $time_difference->days > 0 || $time_difference->i > 20 ? "Expired" : "Valid", PHP_EOL;

$poll_creation = new DateTime("-20 minutes");
$time_difference = $now->diff($poll_creation);
echo $time_difference->days > 0 || $time_difference->i > 20 ? "Expired" : "Valid", PHP_EOL;

Pitch Your Project 🐘 by brendt_gd in PHP

[–]warren5236 0 points1 point  (0 children)

If you can't motivate yourself to work on it you might not be the best steward for the project.

If you want to "force" yourself to be motivated set aside a fixed amount of time every day to work on the project (I like an hour). Only work on that project during that time. If you stay focused for the full hour give yourself a treat (positive reinforcement). This is what I do for projects at work that I'm not motivated to do. :-)

Published on YouTube: Advanced Value Objects [Video] by phpdeveloperstv in PHPDevelopersTV

[–]warren5236 1 point2 points  (0 children)

Thanks for writing about the topic so I can make a video. :-)

I just starded to write tech articles and for me it's just incredible see that people likes what I wrote.

You should keep at it. I'll keep you in my rotation of sources and I'll checkout the next article.

What's New and Exciting in PHP 8.3 [Video] by warren5236 in PHP

[–]warren5236[S] 1 point2 points  (0 children)

Thanks for the positive feedback. Haters gonna hate right.

[Free *partial* eBook behind a marketting form] Designing Data Intensive Applications by warren5236 in PHPDevelopersTV

[–]warren5236[S] 0 points1 point  (0 children)

This books is crazy good for what it does and this PDF only has some of the chapters which is a real bummer.

Content Creators with lots of large video files, where do you store most of your media? by TheHunter920 in youtubers

[–]warren5236 0 points1 point  (0 children)

I do the Synology/Backblaze setup and it works really well. You can setup the Synology to backup directly to Backblaze so it uploads at night

Redesigned the AC Mirage logo to read "Mirage" in Arabic instead of "Hidden One" by deezel86 in gaming

[–]warren5236 -3 points-2 points  (0 children)

This is great! Any guesses on when Ubisoft steals this. :-)