#42672 closed defect (bug) (worksforme)
Unexpected incorrect usage notice for wpdb::prepare in wordpress test lib
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.9 |
| Component: | Build/Test Tools | Keywords: | |
| Focuses: | Cc: |
Description
When I use phpunit for wordpress with factory like as:
<?php public function testCategory() { // Create category $category = $this->factory()->term->create([ 'name' => 'Test', 'taxonomy' => 'category' ]); $this->assertTrue(is_int($category) ? true : false); }
I got error
Unexpected incorrect usage notice for wpdb::prepare Failed asserting that an array is empty.
I tested it with wordpress test lib 4.8.1, 4.8.2 , 4.8.3 and 4.9. Only 4.8.1 and 4.8.2 is works as expected. After version 4.8.2 I think you are changes something and all tests who used factory create are broken. I am very disappointed with this!
Change History (5)
#3
@
8 years ago
- Severity changed from blocker to normal
Failed asserting that an array is empty.
That doesn't match the assertion $this->assertTrue(is_int($category) ? true : false); (which btw should just be $this->assertTrue(is_int($category)); or $this->assertInternalType( 'int', $category );).
Are you sure the error is caused by this method?
Note: See
TracTickets for help on using
tickets.
Cannot reproduce this on https://develop.svn.wordpress.org/trunk.