ComposerInstallersTestAsgardInstallerTest

The WooCommerce Multilingual Composer Installers Test AsgardInstallerTest class.

Defined (1)

The class is defined in the following location(s).

/vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php  
  1. class AsgardInstallerTest extends \PHPUnit_Framework_TestCase 
  2. /** 
  3. * @var AsgardInstaller 
  4. */ 
  5. private $installer; 
  6.  
  7. public function setUp() 
  8. $this->installer = new AsgardInstaller( 
  9. new Package('NyanCat', '4.2', '4.2'),  
  10. new Composer() 
  11. ); 
  12.  
  13. /** 
  14. * @dataProvider packageNameInflectionProvider 
  15. */ 
  16. public function testInflectPackageVars($type, $name, $expected) 
  17. $this->assertEquals( 
  18. array('name' => $expected, 'type' => $type),  
  19. $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type)) 
  20. ); 
  21.  
  22. public function packageNameInflectionProvider() 
  23. return array( 
  24. // Should keep module name StudlyCase 
  25. array( 
  26. 'asgard-module',  
  27. 'user-profile',  
  28. 'UserProfile' 
  29. ),  
  30. array( 
  31. 'asgard-module',  
  32. 'asgard-module',  
  33. 'Asgard' 
  34. ),  
  35. array( 
  36. 'asgard-module',  
  37. 'blog',  
  38. 'Blog' 
  39. ),  
  40. // tests that exactly one '-module' is cut off 
  41. array( 
  42. 'asgard-module',  
  43. 'some-module-module',  
  44. 'SomeModule',  
  45. ),  
  46. // tests that exactly one '-theme' is cut off 
  47. array( 
  48. 'asgard-theme',  
  49. 'some-theme-theme',  
  50. 'SomeTheme',  
  51. ),  
  52. // tests that names without '-theme' suffix stay valid 
  53. array( 
  54. 'asgard-theme',  
  55. 'someothertheme',  
  56. 'Someothertheme',  
  57. ),  
  58. // Should keep theme name StudlyCase 
  59. array( 
  60. 'asgard-theme',  
  61. 'adminlte-advanced',  
  62. 'AdminlteAdvanced' 
  63. ),  
  64. );