Skip to content

Instantly share code, notes, and snippets.

View thorsten's full-sized avatar
:octocat:
I love it when a plan comes together.

Thorsten Rinne thorsten

:octocat:
I love it when a plan comes together.
View GitHub Profile
PHPUnit 12 has removed deprecated methods like willReturnCallback() and changed how some mock behaviors are defined. Here’s how to rewrite your PHPUnit 12 test code in a compatible way:
✅ Original snippet (pre PHPUnit 12)
$redis = $this->createMock(RedisClient::class);
$redis->expects($this->exactly(3))
->method('callAsync')
->willReturnOnConsecutiveCalls(
@thorsten
thorsten / sbom-node.json
Last active March 2, 2025 15:50
SBOM for phpMyFAQ
{
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"version": 1,
"metadata": {
"timestamp": "2025-02-09T18:14:46.613Z",
"lifecycles": [
{
"phase": "build"
@thorsten
thorsten / setUserAgent.js
Created May 9, 2016 15:12
Override user agent on all browsers
function setUserAgent(window, userAgent) {
// Works on Firefox, Chrome, Opera and IE9+
if (navigator.__defineGetter__) {
navigator.__defineGetter__('userAgent', function () {
return userAgent;
});
} else if (Object.defineProperty) {
Object.defineProperty(navigator, 'userAgent', {
get: function () {
return userAgent;
console.log('Loading a web page');
var page = require('webpage').create();
page.open('http://www.billigflieger.de/', function(status) {
page.render('billigflieger.png');
console.log(status);
phantom.exit();
});