@@ 81-110 (lines=30) @@ | ||
78 | $this->assertNull($information['project']); |
|
79 | } |
|
80 | ||
81 | public function testValidUpdateCapfile() |
|
82 | { |
|
83 | $originalContent = <<<ORIGINAL |
|
84 | set :first_name, 'foo' |
|
85 | set :last_name, 'bar' |
|
86 | ORIGINAL; |
|
87 | ||
88 | $expectedContent = <<<EXPECTED |
|
89 | set :first_name, 'John' |
|
90 | set :last_name, 'Doe' |
|
91 | EXPECTED; |
|
92 | ||
93 | $tempFile = tempnam(sys_get_temp_dir(), 'test'); |
|
94 | file_put_contents($tempFile, $originalContent); |
|
95 | ||
96 | $this->installer->updateCapfile( |
|
97 | $tempFile, |
|
98 | array( |
|
99 | 'first_name' => 'John', |
|
100 | 'last_name' => 'Doe', |
|
101 | ) |
|
102 | ); |
|
103 | ||
104 | $this->assertEquals( |
|
105 | $expectedContent, |
|
106 | file_get_contents($tempFile) |
|
107 | ); |
|
108 | ||
109 | unlink($tempFile); |
|
110 | } |
|
111 | ||
112 | public function testValidUpdateYmlFile() |
|
113 | { |
|
@@ 112-144 (lines=33) @@ | ||
109 | unlink($tempFile); |
|
110 | } |
|
111 | ||
112 | public function testValidUpdateYmlFile() |
|
113 | { |
|
114 | $originalContent = <<<ORIGINAL |
|
115 | parameters: |
|
116 | first_name: foo |
|
117 | last_name: bar |
|
118 | ORIGINAL; |
|
119 | ||
120 | $expectedContent = <<<EXPECTED |
|
121 | parameters: |
|
122 | first_name: John |
|
123 | last_name: Doe |
|
124 | ||
125 | EXPECTED; |
|
126 | ||
127 | $tempFile = tempnam(sys_get_temp_dir(), 'test'); |
|
128 | file_put_contents($tempFile, $originalContent); |
|
129 | ||
130 | $this->installer->updateYmlFile( |
|
131 | $tempFile, |
|
132 | array( |
|
133 | 'first_name' => 'John', |
|
134 | 'last_name' => 'Doe', |
|
135 | ) |
|
136 | ); |
|
137 | ||
138 | $this->assertEquals( |
|
139 | ltrim($expectedContent), |
|
140 | file_get_contents($tempFile) |
|
141 | ); |
|
142 | ||
143 | unlink($tempFile); |
|
144 | } |
|
145 | } |
|
146 |