[wp-trac] [WordPress Trac] #29785: User count not correct

WordPress Trac noreply at wordpress.org
Wed Sep 14 13:58:02 UTC 2016


#29785: User count not correct
-------------------------------------------------+-------------------------
 Reporter:  psoluch                              |       Owner:
     Type:  defect (bug)                         |  boonebgorges
 Priority:  normal                               |      Status:  assigned
Component:  Users                                |   Milestone:  Future
 Severity:  normal                               |  Release
 Keywords:  good-first-bug has-unit-tests has-   |     Version:
  patch                                          |  Resolution:
                                                 |     Focuses:
                                                 |  performance
-------------------------------------------------+-------------------------

Comment (by dots):

 Hi @boonebgorges - Thanks for the updates.

 I have made the changes into the test file as per your 29758.2.diff and
 now I am getting below result in unit testing.


 {{{
 C:\wamp\www\wordpress-core>phpunit tests/phpunit/tests/user/countUsers.php
 Installing...
 Running as single site... To run multisite, use -c
 tests/phpunit/multisite.xml
 Not running ajax tests. To execute these, use --group ajax.
 Not running ms-files tests. To execute these, use --group ms-files.
 Not running external-http tests. To execute these, use --group external-
 http.
 Not running external-oembed tests. To execute these, use --group external-
 oembed
 .
 PHPUnit 4.1.6 by Sebastian Bergmann.

 Configuration read from C:\wamp\www\wordpress-core\phpunit.xml.dist

 ←[41;37mF←[0m←[41;37mF←[0m←[41;37mF←[0m←[36;1mS←[0m←[36;1mS←[0m..

 You should really fix these slow tests (>150ms)...
  1. 405ms to run Tests_User_CountUsers:test_count_users_is_accurate with
 data se
 t #0
  2. 400ms to run Tests_User_CountUsers:test_count_users_is_accurate with
 data se
 t #1


 Time: 6.41 seconds, Memory: 32.25MB

 There were 3 failures:

 1) Tests_User_CountUsers::test_count_users_is_accurate with data set #0
 ('time')

 Failed asserting that 9 matches expected 8.

 C:\wamp\www\wordpress-core\tests\phpunit\tests\user\countUsers.php:48

 2) Tests_User_CountUsers::test_count_users_is_accurate with data set #1
 ('memory
 ')
 Failed asserting that 9 matches expected 8.

 C:\wamp\www\wordpress-core\tests\phpunit\tests\user\countUsers.php:48

 3)
 Tests_User_CountUsers::test_should_not_count_users_who_are_not_in_posts_table

 Failed asserting that two arrays are equal.
 --- Expected
 +++ Actual
 @@ @@
  Array (
 -    0 => 1
 +    0 => 2
      1 => Array (
          'none' => 0
          'administrator' => 1
 +        'editor' => 1
      )
  )

 C:\wamp\www\wordpress-core\tests\phpunit\includes\testcase.php:423
 C:\wamp\www\wordpress-core\tests\phpunit\tests\user\countUsers.php:77
 ←[37;41m                                                 ←[0m
 ←[37;41mFAILURES!                                        ←[0m
 ←[37;41mTests: 7, Assertions: 9, Failures: 3, Skipped: 2.←[0m

 C:\wamp\www\wordpress-core>
 }}}

 But still, I am confused here how exactly do we have to do unit testing on
 this issue.

 [[BR]]

 {{{
 Regarding your proposed fix: Be sure to add a corresponding fix for the
 'time' $strategy.
 }}}

 Can you please explain more about your sentence?

 I appreciate your help on this issue. Thanks in Advance :)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29785#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list