lade...

Akrabat.com

Akrabat.com

an avatar

a logo

Converting a PHPUnit TestListener to an Event Subscriber

An article by Rob Allen

🌐 Visit Akrabat.com 🌐 Akrabat.com besuchen

✍️Write rieview ✍️Rezension schreiben 🏷️Get Badge! 🏷️Abzeichen holen! ⚙️Edit entry ⚙️Eintrag bearbeiten 📰News 📰Neuigkeiten

Webfan Website Badge

Tags:

Rieviews

Bewertungen

not yet rated noch nicht bewertet 0%

Be the first one
and write a rieview
about akrabat.com.
Sein Sie der erste
und schreiben Sie eine Rezension
über akrabat.com.

Akrabat.com News

Privileges app: sudo for macOS

https://akrabat.com/privileges-a...

By default, the first user that you create on macOS is an administrator and has more power over the system than a normal user account. The reason it does this is obvious as you need this power to create other users, to install software and so on. However it also means that the computer is slightly more vulnerable to attack via a vulnerability in the software I use day to day. To combat this, I… continue reading.

11.3.2025 11:00Privileges app: sudo for macOS
https://akrabat.com/privileges-a...

Cloudflare SSL/TLS setting for an encrypted connection to upstream

https://akrabat.com/cloudflare-s...

I was helping a friend set up a new website and hit a problem where the website was in an infinite redirect loop: I could see this in curl quite easily: $ curl -I https://myfriendswebsite.example.com/ HTTP/1.1 301 Moved Permanently Location: https://myfriendswebsite.example.com/ To debug, we turned off Cloudflare by setting the Proxy status on the DNS record in Cloudflare's admin to "DNS only" and the problem went away. Further investigation led to the SSL/TLS setting in… continue reading.

4.3.2025 11:00Cloudflare SSL/TLS setting for an encrypted connection to upstream
https://akrabat.com/cloudflare-s...

Converting a PHPUnit TestListener to an Event Subscriber

https://akrabat.com/converting-a...

One of the bigger changes in PHPUnit 10 was the introduction of the new extension system which replaced listeners and hooks. The old way On one of my projects we have a TestListener that sets up the database before we run some functional tests against it. It looks like this: <?php declare(strict_types=1); namespace App\Test\Listeners; use App\Test\Functional\Helpers\DbHelper; use PHPUnit\Framework\TestListenerDefaultImplementation; use PHPUnit\Framework\TestSuite; class TestListener implements \PHPUnit\Framework\TestListener { use TestListenerDefaultImplementation; public function startTestSuite(TestSuite $suite): void { if (str_contains($suite->getName(),… continue reading.

25.2.2025 11:00Converting a PHPUnit TestListener to an Event Subscriber
https://akrabat.com/converting-a...

OAuth scopes vs user roles

https://akrabat.com/oauth-scopes...

There is a different between OAuth scopes and roles. A scope is the abilities that the client requests that the user can then decide if they are going to authorise that client to do those things. A role is the rights that a given user has within the application. Scope examples are "read-name", "read-address", "read-email", 'write-all", etc. Example roles might be "moderator", "user", "administrator", etc. and is used by the app to determine what the… continue reading.

18.2.2025 11:00OAuth scopes vs user roles
https://akrabat.com/oauth-scopes...

Writing out the page contents in Playwright

https://akrabat.com/writing-out-...

I recently had a problem with a failing Playwright test that only happened when running in Docker. The test that was failing was: let locator = page.locator('a[href="/login"].nav-link'); await locator.click(); await expect(page).toHaveTitle(/Log in/); The test clicks the link to go to /login and then checks that the next page's title contains the text "Log in". Not an especially complicated test, so I was quite surprised when it failed claiming that the title was blank. To work… continue reading.

11.2.2025 11:00Writing out the page contents in Playwright
https://akrabat.com/writing-out-...

Comment on Using uv as your shebang line by Rob

https://akrabat.com/using-uv-as-...

In reply to <a href="https://akrabat.com/using-uv-as-your-shebang-line/#comment-109284">Adam Nelson</a>. Yes. I linked to <a href="https://akrabat.com/defining-python-dependencies-at-the-top-of-the-file/" rel="ugc">my post about PEP-723</a> in the first line of the post 😉

5.2.2025 11:16Comment on Using uv as your shebang line by Rob
https://akrabat.com/using-uv-as-...

Activating rather than relaunching a menu bar app on macOS

https://akrabat.com/activating-r...

One very minor thing that's been bugging me since macOS Sequoia came out is that if you launch an app that lives in your menu bar, but also has a hidden Dock icon a second time, then the Dock icon will re-appear. This happens to me a lot because I use Alfred to launch apps and also to bring an app to the front. This works because opening a running app will bring it to… continue reading.

4.2.2025 11:00Activating rather than relaunching a menu bar app on macOS
https://akrabat.com/activating-r...

Comment on Using uv as your shebang line by Adam Nelson

https://akrabat.com/using-uv-as-...

This is indeed a cool feature. But it actually gets cooler! If your Python script has dependencies, you can declare them in a fenced code block in a leading comment and uv will parse and install those in a temp venv before invoking the script! For example: <code>#!/usr/bin/env -S uv run --script # /// script # requires-python = ">=3.12" # dependencies = [ # "ffmpeg-normalize", # ] # ///</code> That’s not my example I just copied it from https://treyhunner.com/2024/12/lazy-self-installing-python-scripts-with-uv/ which you should definitely read to learn more.

29.1.2025 19:09Comment on Using uv as your shebang line by Adam Nelson
https://akrabat.com/using-uv-as-...

Comment on Defining Python dependencies at the top of the file by Andrew Ferrier

https://akrabat.com/defining-pyt...

This is an excellent tip, thank you. I'll port all my Python scripts over straight away :) It's probably worth saying that Python can cover almost all of the capability of bash without needed any dependencies outside of the standard Python library though, so even without this, Python would be a good substitute for bash in many cases.

29.1.2025 08:35Comment on Defining Python dependencies at the top of the file by Andrew Ferrier
https://akrabat.com/defining-pyt...

Comment on Sunrise and sunset times on the Mac command line by Dave

https://akrabat.com/sunrise-and-...

Awk's equally-powerful pattern matching permits the removal of the pipe to grep: corebrightnessdiag nightshift-internal | awk '/sunrise|sunset/ {print $1, $4}'

29.1.2025 06:18Comment on Sunrise and sunset times on the Mac command line by Dave
https://akrabat.com/sunrise-and-...

Using uv as your shebang line

https://akrabat.com/using-uv-as-...

I create a fair few scripts in my ~/bin/ directory to automate tasks. Since discovering uv and inline script metadata, I've started using Python far more for these. As ~/bin is on my path, I want to run the script by calling it directly on the command line. To do this, I use this shebang: #!/usr/bin/env -S uv run --script The command line will now run uv run --script and pass the file as the… continue reading.

28.1.2025 11:00Using uv as your shebang line
https://akrabat.com/using-uv-as-...

Always expand the Fantastical editor popover

https://akrabat.com/always-expan...

My preferred calendar app for the Apple ecosystem is Fantastical as I've found that it meets my needs well. One minor irritant is that the editor popover defaults to a collapsed view and I have to expand it to see everything, in particular the notes field which I use frequently. I recently discovered that there's a hidden preference to change this. It's set via a custom url of x-fantastical3://defaults?key=AlwaysShowAll&value=1&type=bool&group=1. Just click this link to set… continue reading.

21.1.2025 11:00Always expand the Fantastical editor popover
https://akrabat.com/always-expan...

Global git ignore patterns

https://akrabat.com/global-git-i...

One thing that I've found helpful is to add a set of patterns to my global git ignore file (config/git/ignore for me) that allow me to create temporary files that are automatically excluded from git. The patterns I use are these: # Ignore a file by renaming it with ignore its name *.ignore ignore.* *.ignore.* This lets me create a file with a prefix ignore., a postfix of .ignore or add .ignore. somewhere in the… continue reading.

14.1.2025 11:00Global git ignore patterns
https://akrabat.com/global-git-i...

Enabling a focus mode when an app is running on Mac

https://akrabat.com/enabling-a-f...

When I'm on a Zoom or FaceTime call, I want stop all notifications on my Mac so that I'm not distracted by them and would like this automated. It's not easy to tell when a call is happening, so I simplified the problem to stopping all notifications if the Zoom or FaceTime is running as I only run these apps if I'm on call. To do this, I created two Shortcuts to turn the Do… continue reading.

7.1.2025 11:00Enabling a focus mode when an app is running on Mac
https://akrabat.com/enabling-a-f...

Comment on Getting status code and body from curl in a bash script by Bryan

https://akrabat.com/getting-stat...

I looked at curl(1) and discovered I prefer to have http_code on stdout since I almost always use -o, so I added it to my ~/.curlrc file instead: ---------- -sSL -w "%{stdout}%{http_code}\n" ----------

12.7.2024 22:01Comment on Getting status code and body from curl in a bash script by Bryan
https://akrabat.com/getting-stat...

Comment on macOS tips and tricks by Rob

https://akrabat.com/macos-tips-a...

In reply to <a href="https://akrabat.com/macos-tips-and-tricks/#comment-108992">Sam</a>. Thanks. I've now fixed the Keyboard Maestro link.

14.5.2024 15:51Comment on macOS tips and tricks by Rob
https://akrabat.com/macos-tips-a...

Comment on macOS tips and tricks by Sam

https://akrabat.com/macos-tips-a...

Very useful, thanks - I've been a Mac user for a few years now and I learned a couple of new things here! (The "Keyboard Maestro" link appears to be broken BTW)

14.5.2024 15:48Comment on macOS tips and tricks by Sam
https://akrabat.com/macos-tips-a...

Comment on Check licenses of composer dependencies by Ben Ramsey

https://akrabat.com/check-licens...

Hey, Rob. Also check out https://github.com/madewithlove/license-checker-php. It’s a Composer plugin that provides some of this functionality.

13.4.2024 04:25Comment on Check licenses of composer dependencies by Ben Ramsey
https://akrabat.com/check-licens...

Comment on Check licenses of composer dependencies by Stephan Hochdörfer

https://akrabat.com/check-licens...

In the past, I used the madewithlove/license-checker package with great success. https://github.com/madewithlove/license-checker-php

10.4.2024 17:00Comment on Check licenses of composer dependencies by Stephan Hochdörfer
https://akrabat.com/check-licens...

Comment on Check licenses of composer dependencies by Philippe Gamache

https://akrabat.com/check-licens...

Hi, it's really cool. I think it should be a composer plug-in.

9.4.2024 15:28Comment on Check licenses of composer dependencies by Philippe Gamache
https://akrabat.com/check-licens...
Subscribe

🔝

Datenschutzerklärung    Impressum