ComposerInstallersTestBitrixInstallerTest

Tests for the BitrixInstaller Class.

Defined (1)

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

/vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php  
  1. class BitrixInstallerTest extends TestCase 
  2. /** @var BitrixInstaller */ 
  3. private $installer; 
  4.  
  5. /** @var Composer */ 
  6. private $composer; 
  7.  
  8.  
  9. /** 
  10. * Sets up the fixture, for example, instantiate the class-under-test. 
  11. * This method is called before a test is executed. 
  12. */ 
  13. final function setUp() 
  14. $this->composer = new Composer(); 
  15.  
  16. /** 
  17. * @param string $vars 
  18. * @param string $expectedVars 
  19. * @covers ::inflectPackageVars 
  20. * @dataProvider provideExpectedInflectionResults 
  21. */ 
  22. final public function testInflectPackageVars($vars, $expectedVars) 
  23.  
  24. $this->installer = new BitrixInstaller( 
  25. new Package($vars['name'], '4.2', '4.2'),  
  26. $this->composer 
  27. ); 
  28. $actual = $this->installer->inflectPackageVars($vars); 
  29. $this->assertEquals($actual, $expectedVars); 
  30.  
  31. /** 
  32. * Provides various parameters for packages and the expected result after inflection 
  33. * @return array 
  34. */ 
  35. final public function provideExpectedInflectionResults() 
  36. return array( 
  37. //check bitrix-dir is correct 
  38. array( 
  39. array('name' => 'Nyan/Cat'),  
  40. array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix') 
  41. ),  
  42. array( 
  43. array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix'),  
  44. array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix') 
  45. ),  
  46. array( 
  47. array('name' => 'Nyan/Cat', 'bitrix_dir' => 'local'),  
  48. array('name' => 'Nyan/Cat', 'bitrix_dir' => 'local') 
  49. ),  
  50. );