You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * PhpUnderControl_ModelUser_Test
  4. *
  5. * 针对 ./Demo/Model/User.php Model_User 类的PHPUnit单元测试
  6. *
  7. * @author: dogstar 20150208
  8. */
  9. require_once dirname(__FILE__) . '/../test_env.php';
  10. if (!class_exists('Model_User')) {
  11. require dirname(__FILE__) . '/./Demo/Model/User.php';
  12. }
  13. class PhpUnderControl_ModelUser_Test extends PHPUnit_Framework_TestCase
  14. {
  15. public $modelUser;
  16. protected function setUp()
  17. {
  18. parent::setUp();
  19. $this->modelUser = new Model_User();
  20. }
  21. protected function tearDown()
  22. {
  23. }
  24. /**
  25. * @group testGetByUserId
  26. */
  27. public function testGetByUserId()
  28. {
  29. $userId = '1';
  30. $rs = $this->modelUser->getByUserId($userId);
  31. $this->assertArrayHasKey('id', $rs);
  32. $this->assertArrayHasKey('name', $rs);
  33. $this->assertArrayHasKey('note', $rs);
  34. $this->assertEquals('dogstar', $rs['name']);
  35. }
  36. }