Skip to content

test: Forge::addColumn() and null #7319

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

Merged
merged 1 commit into from
Jun 8, 2023

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Mar 1, 2023

Needs #7301

Description
See #7235

  • add test for Forge::addColumn() and null

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added testing Pull requests that changes tests only 4.4 labels Mar 1, 2023
@kenjis kenjis marked this pull request as draft March 1, 2023 07:06
@kenjis kenjis force-pushed the test-Forge-addColumn-null branch from 8f00d43 to 8633a82 Compare March 4, 2023 00:43
@kenjis kenjis marked this pull request as ready for review March 4, 2023 10:09
$col3 = $this->getMetaData('col3', 'forge_test_table');
$this->assertFalse($col3->nullable);
$col4 = $this->getMetaData('col4', 'forge_test_table');
$this->assertTrue($col4->nullable);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since $col1 is false from a logical point of view, I think $col4 should be false too. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #7235
I thought that, but if we change it, it is a breaking change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, fair point but in this case, I would treat it as a bug.
API should be predictable and having a different behavior for the "same thing" is something we should avoid.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'll be fine with documenting this and leaving it to be fixed in the next major version.

@codeigniter4/database-team any thoughts on this one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is inconsistent to have different behavior when creating and adding, but I am a little doubtful that it is worth changing in v5.

However, if we decide to change it, I would like to include that in the documentation.

@codeigniter4/database-team Opinions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ambivalent.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems nobody has strong opinion.

@kenjis kenjis added the stale Pull requests with conflicts label Apr 30, 2023
@kenjis kenjis force-pushed the test-Forge-addColumn-null branch from 8633a82 to f251ae2 Compare May 3, 2023 00:07
@kenjis kenjis removed the stale Pull requests with conflicts label May 3, 2023
@kenjis
Copy link
Member Author

kenjis commented May 3, 2023

Rebased to resolve conflicts.

@kenjis
Copy link
Member Author

kenjis commented Jun 8, 2023

This PR just adds test for the current implementation.
Merge.

@kenjis kenjis merged commit 02aaea1 into codeigniter4:4.4 Jun 8, 2023
@kenjis kenjis deleted the test-Forge-addColumn-null branch June 8, 2023 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Pull requests that changes tests only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants