Skip to content

Commit

Permalink
Invert condition
Browse files Browse the repository at this point in the history
It contradicts the message.
  • Loading branch information
greg0ire committed May 31, 2023
1 parent 9ccd199 commit b94a87f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Schema/TableDiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function __construct(
$this->changedForeignKeys = $changedForeignKeys;
$this->removedForeignKeys = $removedForeignKeys;

if ($fromTable !== null) {
if ($fromTable === null) {
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5678',
Expand Down
24 changes: 24 additions & 0 deletions tests/Schema/TableDiffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\Deprecations\PHPUnit\VerifyDeprecations;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class TableDiffTest extends TestCase
{
use VerifyDeprecations;

/** @var AbstractPlatform&MockObject */
private AbstractPlatform $platform;

Expand Down Expand Up @@ -53,4 +56,25 @@ public function testReturnsNewName(): void

self::assertEquals(new Identifier('bar'), $tableDiff->getNewName());
}

public function testOmittingFromTableInConstructorIsDeprecated(): void
{
$this->expectDeprecationWithIdentifier('https://github.com/doctrine/dbal/pull/5678');
$tableDiff = new TableDiff('foo');
}

public function testPassingFromTableToConstructorIsDeprecated(): void
{
$this->expectNoDeprecationWithIdentifier('https://github.com/doctrine/dbal/pull/5678');
$tableDiff = new TableDiff(
'foo',
[],
[],
[],
[],
[],
[],
new Table('foo'),
);
}
}

0 comments on commit b94a87f

Please sign in to comment.