您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

LuBusinessTest.php 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. use Luticate\Utils\Business\LuBusiness;
  3. /**
  4. * Created by PhpStorm.
  5. * User: robin
  6. * Date: 5/29/16
  7. * Time: 2:57 PM
  8. */
  9. class MyEntitiesBusiness extends LuBusiness {
  10. }
  11. class My2EntitiesBusiness extends LuBusiness {
  12. protected static $_resourceNameUnPluralize = false;
  13. }
  14. class My3EntitiesBusiness extends LuBusiness {
  15. protected static $_resourceName = "MyEntity";
  16. }
  17. class MyUsersBusiness extends LuBusiness {
  18. protected static $_resourceNameUnPluralize = false;
  19. }
  20. class MyBusinessDontRespectTheRules extends LuBusiness {
  21. }
  22. class My2BusinessDontRespectTheRules extends LuBusiness {
  23. protected static $_resourceNameUnPluralize = false;
  24. }
  25. class LuBusinessTest extends \PHPUnit_Framework_TestCase
  26. {
  27. public function testResourceNameMyEntities()
  28. {
  29. $this->assertSame("MyEntity", MyEntitiesBusiness::getResourceName());
  30. }
  31. public function testResourceNameMy2Entities()
  32. {
  33. $this->assertSame("My2Entities", My2EntitiesBusiness::getResourceName());
  34. }
  35. public function testResourceNameMy3Entities()
  36. {
  37. $this->assertSame("MyEntity", My3EntitiesBusiness::getResourceName());
  38. }
  39. public function testResourceNameMyUsersBusiness()
  40. {
  41. $this->assertSame("MyUsers", MyUsersBusiness::getResourceName());
  42. }
  43. public function testResourceNameMyBusinessDontRespectTheRules()
  44. {
  45. $this->assertSame("MyBusinessDontRespectTheRule", MyBusinessDontRespectTheRules::getResourceName());
  46. }
  47. public function testResourceNameMy2BusinessDontRespectTheRules()
  48. {
  49. $this->assertSame("My2BusinessDontRespectTheRules", My2BusinessDontRespectTheRules::getResourceName());
  50. }
  51. }