Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip search and replace on objects that can't deserialize safely #192

Merged
merged 26 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
aff9a8f
skip deserialization of S&R objects that return TypeErrors
MarkBerube Nov 27, 2023
4ef93f7
Update SearchReplacer.php based off PHP CS
MarkBerube Nov 27, 2023
fde70ec
Update SearchReplacer.php with changes from PHPCS
MarkBerube Nov 27, 2023
2d7ce67
adding skip on phpcs incompat as testing shows its safe for PHP5.6 & …
MarkBerube Nov 28, 2023
9c46168
fixing small typo in behat scenario
MarkBerube Nov 28, 2023
afa1d7b
removing unncessary comment
MarkBerube Nov 28, 2023
7c373b4
removing unncessary comments
MarkBerube Nov 28, 2023
8f338d9
Update features/search-replace.feature scenario description
MarkBerube Nov 28, 2023
f6e1a3e
skip over replacements if TypeError is executed.
MarkBerube Nov 28, 2023
57cb6eb
converting obj to array to avoid errors with funky/blank objects on d…
MarkBerube Nov 29, 2023
6ff1d6b
adding safe object to search & replace over in test
MarkBerube Nov 29, 2023
d6437f2
removing array cast & testing serialized, safe object to confirm seri…
MarkBerube Nov 30, 2023
ac1ae3b
catch errors in unsafe php objects as they are iterated on
MarkBerube Dec 1, 2023
8889a18
Fix PHPCS issue
schlessera Dec 18, 2023
9404019
Include reason in error messages
schlessera Dec 18, 2023
251042b
Avoid casting objects to string
schlessera Dec 18, 2023
b3a1734
Split into two separate tests per PHP version
schlessera Dec 18, 2023
42ef6c2
Fully form forwarded exception
schlessera Dec 18, 2023
d6430f9
Be precise about PHPCS ignore
schlessera Dec 18, 2023
586522b
Add clarifying comment about type error
schlessera Dec 18, 2023
4509c7d
Add another clarifying comment
schlessera Dec 18, 2023
9c12684
Adapt warning for PHP < 8.0
schlessera Dec 18, 2023
e915dd8
Fix warning text in test
schlessera Dec 18, 2023
813403e
Fix bad anntotation
schlessera Dec 19, 2023
43abfb5
Add safeguard for partial processing to not be counted as a success
schlessera Dec 19, 2023
da1acc7
Skip broken SQLite testing for now
schlessera Dec 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions features/search-replace-export.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Feature: Search / replace with file export

@require-mysql
Scenario: Search / replace export to STDOUT
Given a WP install
And I run `echo ' '`
Expand Down Expand Up @@ -76,6 +77,7 @@ Feature: Search / replace with file export
https://example.net
"""

@require-mysql
Scenario: Search / replace export to file
Given a WP install
And I run `wp post generate --count=100`
Expand Down Expand Up @@ -129,6 +131,7 @@ Feature: Search / replace with file export
101
"""

@require-mysql
Scenario: Search / replace export to file with verbosity
Given a WP install

Expand All @@ -151,6 +154,7 @@ Feature: Search / replace with file export
Error: You cannot supply --dry-run and --export at the same time.
"""

@require-mysql
Scenario: Search / replace shouldn't affect primary key
Given a WP install
And I run `wp post create --post_title=foo --porcelain`
Expand Down Expand Up @@ -191,6 +195,7 @@ Feature: Search / replace with file export
Error: Unable to open export file "foo/bar.sql" for writing:
"""

@require-mysql
Scenario: Search / replace specific table
Given a WP install

Expand Down Expand Up @@ -225,6 +230,7 @@ Feature: Search / replace with file export
foo
"""

@require-mysql
Scenario: Search / replace export should cater for field/table names that use reserved words or unusual characters
Given a WP install
# Unlike search-replace.features version, don't use `back``tick` column name as WP_CLI\Iterators\Table::build_fields() can't handle it.
Expand Down Expand Up @@ -268,6 +274,7 @@ Feature: Search / replace with file export
"""
And STDERR should be empty

@require-mysql
Scenario: Suppress report or only report changes on export to file
Given a WP install

Expand Down Expand Up @@ -365,6 +372,7 @@ Feature: Search / replace with file export
"""
And STDERR should be empty

@require-mysql
Scenario: Search / replace should remove placeholder escape on export
Given a WP install
And I run `wp post create --post_title=test-remove-placeholder-escape% --porcelain`
Expand All @@ -380,6 +388,7 @@ Feature: Search / replace with file export
'test-remove-placeholder-escape{'
"""

@require-mysql
Scenario: NULLs exported as NULL and not null string
Given a WP install
And I run `wp db query "INSERT INTO wp_postmeta VALUES (9999, 9999, NULL, 'foo')"`
Expand Down
Loading