Add unit test for #12813
- [x] closes #12813
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

The bug was already fixed with my previous PR but this adds a fixture to a unit test to also test read-only arrays as factorize input.