After a lot of other stuff I’m back at it. TIL that php ENUMS are kind of hard to do assertions on in PHPUnit. assertSame and assertEquals both don’t work.

What I can do though is this:

$this->assertSame(SyncStatus::Pending->value, $syncStatusAfter->value);

#buildinpublic #mbsync

After many hours of familystuff, I’m back trying to see why one of the tests is still failing, now that my sidequest about the seeder is complete. #buildinpublic #mbsync

[Just noticed I never sent this…]

#buildinpublic #mbsync

Alright, so the seeder works and I can skip registering all the time when resetting the db. 😅

Instead I only need to run:

artisan migrate:fresh

and then:

artisan db:seed

And I’m good to go!

The code needed some trial and error to get right, but looks basically like this:

<?php

namespace Database\Seeders;

use App\Models\Blog;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Hash;

class AddAdminUserSeeder extends Seeder
{
    public function run(): void
    {
        $user = User::create([
		//...
        ]);
        $user->save();
        $blogs = [
		//...
        ];
        $user->blogs()->saveMany($blogs);
        $user->selected_blog_id = $blogs[0]->id;
        $user->save();
    }
}

It’s just really cool to me how powerful laravel’s db abstractions are. I may not know yet how to express my needs and then try to do it old-school directly in sql at first, but that it’s possible to express my needs and I can otherwise just focus on the code is so cool. #buildinpublic #mbsync

I’m working on a little side quest atm. I’m creating a database seeder that automatically adds a user to the db so that I can reset the db quicker. It’s pretty easy with laravel and I love the distinction between migrations (schema changes) and seeders (data additions) #buildinpublic #mbsync

At the moment I’m working on implementing the minimalistic sync engine - even calling it that gives it too much credit. One test is failing, it seems that the sync status is not marked as pending when we mark a post for sync. #buildinpublic #mbsync

I’ll continue my work on mb-sync. It’s always a little hard to know how much time I have - so I might need to do something else soon, but I’ll at least start. #buildinpublic #mbsync

The metrics that people in charge at my work care about the most seem(!; to me) to be not reached. It’s true, I can be kind of slow but what I do is mostly thought through. It just takes time. Sometimes too much, I guess.

Amazing, how quickly confidence wanes under pressure. Tomorrow’s another day.

Wanting to do a good job and wanting to do a quality job aren’t always congruent.

Okay fixed the theme next/previous links: {{ $cleanContentNext := .NextPage.Content | plainify }} {{ if gt (len $cleanContentNext) 20 }} {{ printf "%.20s" $cleanContentNext }} {{ else }} {{ $cleanContentNext }} {{ end }} {{ end }} And the other problem seems to have been a category filter not having run through. There is no pagination, it just shows all the posts on one page. Which is fine for now.

My theme switch has lead to a couple of problems that I have to solve it seems in time I don’t have. 1. posts without a title lead to links without one in the single post view An annotated screenshot ilustrating the invisible links problem 2. for some reason the categories view is not paged and you can’t view posts in a category past the 11th post. Why? An annotated screenshot ilustrating the missing pagination in categories problem Great. Great stuff.