Skip to content

Commit

Permalink
Add testLastInsertId test
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitriBouteille committed Mar 15, 2024
1 parent 42aacb5 commit e2ce75f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/WordPress/Orm/DatabaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Dbout\WpOrm\Tests\WordPress\Orm;

use Dbout\WpOrm\Models\Post;
use Dbout\WpOrm\Orm\Database;
use Dbout\WpOrm\Tests\WordPress\TestCase;

Expand Down Expand Up @@ -87,4 +88,17 @@ protected function providerTestTable(): \Generator
sprintf('select * from "%s" as "opts"', $this->getTable('options')),
];
}

/**
* @return void
* @covers ::lastInsertId
*/
public function testLastInsertId(): void
{
$post = new Post();
$post->setPostType('product');

$post->save();
$this->assertEquals(Database::getInstance()->lastInsertId(), $post->getId());
}
}

0 comments on commit e2ce75f

Please sign in to comment.