Avatar 💻

recca0120 Tech Notes

Software Developer / Tech Notes

  1. Home
  2. Archives
  3. Categories
  4. Tags
  5. Search
  6. About
    1. Dark Mode

Archives

2026 25
2024 3
2023 11
2022 13
2020 15
More

Categories

PHP Laravel Frontend Testing Database DevOps Tools MacOS Windows Python

Tags

Laravel PHP Testing Javascript PHPUnit SQLite Typescript Aws Blade Composer Developer-Tools Guzzle Mockery Sql.js Validation Devops Docker Linux MacOS Migration
Featured image of post Pass Python Requests to PHP via PSR-7 Message Format
PHP

Pass Python Requests to PHP via PSR-7 Message Format

Have Python output HTTP responses as PSR-7 message strings and parse them in PHP with Message::parseResponse — no manual header or body splitting needed.

2022 年 12 月 26 日
正體中文
PHP PSR-7 Guzzle Symfony
Featured image of post Speed Up Laravel Tests 7x with PDO::exec Schema Load
Laravel Testing

Speed Up Laravel Tests 7x with PDO::exec Schema Load

Load schema dump into SQLite in-memory database via PDO::exec, skipping per-file migrations. Cuts Laravel test time from 2:21 minutes down to 18 seconds.

2022 年 12 月 19 日
正體中文
Laravel SQLite Testing Migration
Featured image of post Fix Laravel Migration Unknown Database Type Enum Error
Laravel Database

Fix Laravel Migration Unknown Database Type Enum Error

Doctrine DBAL does not recognize MySQL enum type, causing migration failures. Covers Type::addType and registerDoctrineTypeMapping with when to use each fix.

2022 年 12 月 13 日
正體中文
Laravel Migration MySQL
Featured image of post PHPUnit for VSCode 3.0: VS Code Testing API and Docker
Testing PHP

PHPUnit for VSCode 3.0: VS Code Testing API and Docker

A complete rewrite of PHPUnit for VSCode using the VS Code Testing API for real-time sidebar results, now with Docker and SSH remote execution support.

2022 年 12 月 6 日
正體中文
PHPUnit PHP VS Code Docker Testing
Featured image of post Laravel Queue Job Reads Stale Data in Transaction: Fix
Laravel PHP

Laravel Queue Job Reads Stale Data in Transaction: Fix

Jobs dispatched in a transaction re-query the DB via SerializesModels before commit, reading stale data. Use afterCommit() to delay dispatch until after commit.

2022 年 12 月 2 日
正體中文
Laravel Queue Redis
Featured image of post Laravel Testing: Assert View Data Without Parsing HTML
Laravel Testing

Laravel Testing: Assert View Data Without Parsing HTML

HTML assertions on complex views are brittle. Use viewData() to assert view variables directly, and compare Models by id or toArray() to avoid identity issues.

2022 年 11 月 29 日
正體中文
Laravel Testing Blade
Featured image of post PHPUnit: Test Closures with Mockery::spy
Testing PHP

PHPUnit: Test Closures with Mockery::spy

Assertions inside a closure pass silently even if never called. Wrap the closure in Mockery::spy to verify invocation count and arguments in PHPUnit tests.

2022 年 11 月 26 日
正體中文
PHPUnit Mockery PHP Testing
Featured image of post Mock IteratorAggregate with Mockery to Fix foreach in Tests
Testing PHP

Mock IteratorAggregate with Mockery to Fix foreach in Tests

Mocking IteratorAggregate breaks foreach in PHPUnit. Return an ArrayObject from the mocked getIterator method to make foreach iterate over test data correctly.

2022 年 11 月 25 日
正體中文
Mockery PHPUnit PHP Testing
Featured image of post Why Laravel min/max Fails on Numbers: Add the numeric Rule
Laravel PHP

Why Laravel min/max Fails on Numbers: Add the numeric Rule

Laravel min/max rules compare string length by default, letting 0 pass validation. Add the numeric rule to switch to value comparison and fix the bug.

2022 年 11 月 23 日
正體中文
Laravel Validation PHP
Featured image of post Write Deterministic PHPUnit Assertions with Mockery::capture
Testing PHP

Write Deterministic PHPUnit Assertions with Mockery::capture

When a method uses random_int internally, Mockery::capture with passthru captures the intermediate value so you can compute the expected result and assert it.

2022 年 11 月 22 日
正體中文
PHP Mockery PHPUnit Testing
1 2 3 4 5 6 7
© 2020 - 2026 recca0120 Tech Notes
recca0120 on GitHub
Built with Hugo
Theme Stack designed by Jimmy