1
+ <?php
2
+
3
+ namespace Composer \Installers \Test ;
4
+
5
+ use Composer \Installers \BitrixInstaller ;
6
+ use Composer \Package \PackageInterface ;
7
+ use Composer \Package \Package ;
8
+ use Composer \Composer ;
9
+
10
+ /**
11
+ * Tests for the BitrixInstaller Class
12
+ *
13
+ * @coversDefaultClass Composer\Installers\BitrixInstaller
14
+ */
15
+ class BitrixInstallerTest extends TestCase
16
+ {
17
+ /** @var BitrixInstaller */
18
+ private $ installer ;
19
+
20
+ /** @var Composer */
21
+ private $ composer ;
22
+
23
+
24
+ /**
25
+ * Sets up the fixture, for example, instantiate the class-under-test.
26
+ *
27
+ * This method is called before a test is executed.
28
+ */
29
+ final function setUp ()
30
+ {
31
+ $ this ->composer = new Composer ();
32
+ }
33
+
34
+ /**
35
+ * @param string $vars
36
+ * @param string $expectedVars
37
+ *
38
+ * @covers ::inflectPackageVars
39
+ *
40
+ * @dataProvider provideExpectedInflectionResults
41
+ */
42
+ final public function testInflectPackageVars ($ vars , $ expectedVars )
43
+ {
44
+
45
+ $ this ->installer = new BitrixInstaller (
46
+ new Package ($ vars ['name ' ], '4.2 ' , '4.2 ' ),
47
+ $ this ->composer
48
+ );
49
+ $ actual = $ this ->installer ->inflectPackageVars ($ vars );
50
+ $ this ->assertEquals ($ actual , $ expectedVars );
51
+ }
52
+
53
+ /**
54
+ * Provides various parameters for packages and the expected result after inflection
55
+ *
56
+ * @return array
57
+ */
58
+ final public function provideExpectedInflectionResults ()
59
+ {
60
+ return array (
61
+ //check bitrix-dir is correct
62
+ array (
63
+ array ('name ' => 'Nyan/Cat ' ),
64
+ array ('name ' => 'Nyan/Cat ' , 'bitrix_dir ' => 'bitrix ' )
65
+ ),
66
+ array (
67
+ array ('name ' => 'Nyan/Cat ' , 'bitrix_dir ' => 'bitrix ' ),
68
+ array ('name ' => 'Nyan/Cat ' , 'bitrix_dir ' => 'bitrix ' )
69
+ ),
70
+ array (
71
+ array ('name ' => 'Nyan/Cat ' , 'bitrix_dir ' => 'local ' ),
72
+ array ('name ' => 'Nyan/Cat ' , 'bitrix_dir ' => 'local ' )
73
+ ),
74
+ );
75
+ }
76
+ }
0 commit comments