Skip to content

Commit 81f2f05

Browse files
authored
Merge pull request #99 from FriendsOfCake/deprecations
Fix usage of deprecated method.
2 parents 6d2d29f + fa588f8 commit 81f2f05

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

phpunit.xml.dist

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
<php>
1010
<ini name="memory_limit" value="-1"/>
1111
<ini name="apc.enable_cli" value="1"/>
12-
<!-- E_ALL & ~E_USER_DEPRECATED (16383)-->
13-
<!-- E_ALL (32767) -->
14-
<ini name="error_reporting" value="16383"/>
1512
</php>
1613

1714
<!-- Add any additional test suites you want to run here -->

src/View/CsvView.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,7 @@ public function __construct(
152152

153153
parent::__construct($request, $response, $eventManager, $viewOptions);
154154

155-
if ($response && $response instanceof Response) {
156-
$response->type('csv');
157-
}
155+
$this->response = $this->response->withType('csv');
158156
}
159157

160158
/**

tests/TestCase/View/CsvViewTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function testRenderWithoutView()
3838
$output = $this->view->render(false);
3939

4040
$this->assertSame('user,fake,list,item1,item2' . PHP_EOL, $output);
41-
$this->assertSame('text/csv', $this->response->getType());
41+
$this->assertSame('text/csv', $this->view->response->getType());
4242
}
4343

4444
/**
@@ -80,7 +80,7 @@ public function testRenderWithoutViewMultiple()
8080

8181
$expected = 'a,b,c' . PHP_EOL . '1,2,3' . PHP_EOL . 'you,and,me' . PHP_EOL;
8282
$this->assertSame($expected, $output);
83-
$this->assertSame('text/csv', $this->response->getType());
83+
$this->assertSame('text/csv', $this->view->response->getType());
8484

8585
$this->view->set('_serialize', true);
8686
$output = $this->view->render(false);
@@ -105,7 +105,7 @@ public function testRenderWithCustomEol()
105105
$output = $this->view->render(false);
106106

107107
$this->assertSame('a,b,c~1,2,3~you,and,me~', $output);
108-
$this->assertSame('text/csv', $this->response->getType());
108+
$this->assertSame('text/csv', $this->view->response->getType());
109109
}
110110

111111
/**
@@ -129,7 +129,7 @@ public function testRenderWithCustomEncoding()
129129
$expected = iconv('UTF-8', 'SJIS', 'a,b,c' . PHP_EOL . '1,2,3' . PHP_EOL . 'あなた,と,私' . PHP_EOL);
130130

131131
$this->assertSame($expected, $output);
132-
$this->assertSame('text/csv', $this->response->getType());
132+
$this->assertSame('text/csv', $this->view->response->getType());
133133
}
134134

135135
/**
@@ -159,7 +159,7 @@ public function testRenderWithMbstring()
159159
$expected = mb_convert_encoding('a,b,c' . PHP_EOL . '1,2,3' . PHP_EOL . 'あなた,と,私' . PHP_EOL, 'SJIS', 'UTF-8');
160160

161161
$this->assertSame($expected, $output);
162-
$this->assertSame('text/csv', $this->response->getType());
162+
$this->assertSame('text/csv', $this->view->response->getType());
163163
}
164164

165165
/**
@@ -181,7 +181,7 @@ public function testRenderWithView()
181181
$output = $this->view->render('index');
182182

183183
$this->assertSame('TEST OUTPUT' . PHP_EOL, $output);
184-
$this->assertSame('text/csv', $this->response->getType());
184+
$this->assertSame('text/csv', $this->view->response->getType());
185185
}
186186

187187
/**
@@ -219,7 +219,7 @@ public function testRenderViaExtract()
219219
$output = $this->view->render(false);
220220

221221
$this->assertSame('jose,"2010-01-05 00:00:00",beach' . PHP_EOL . 'drew,,ball' . PHP_EOL, $output);
222-
$this->assertSame('text/csv', $this->response->getType());
222+
$this->assertSame('text/csv', $this->view->response->getType());
223223
}
224224

225225
/**
@@ -258,7 +258,7 @@ public function testRenderViaExtractOptionalField()
258258
$output = $this->view->render(false);
259259

260260
$this->assertSame('1,jose,,beach' . PHP_EOL . '2,drew,ball,fun' . PHP_EOL, $output);
261-
$this->assertSame('text/csv', $this->response->getType());
261+
$this->assertSame('text/csv', $this->view->response->getType());
262262
}
263263

264264
/**
@@ -298,7 +298,7 @@ function ($row) {
298298
$output = $this->view->render(false);
299299

300300
$this->assertSame('jose,"2010-01-05 00:00:00",my-beach' . PHP_EOL . 'drew,,my-ball' . PHP_EOL, $output);
301-
$this->assertSame('text/csv', $this->response->getType());
301+
$this->assertSame('text/csv', $this->view->response->getType());
302302
}
303303

304304
/**
@@ -351,7 +351,7 @@ public function testRenderWithSpecialCharacters()
351351
352352
CSV;
353353
$this->assertTextEquals($expected, $output);
354-
$this->assertSame('text/csv', $this->response->getType());
354+
$this->assertSame('text/csv', $this->view->response->getType());
355355
}
356356

357357
/**
@@ -400,7 +400,7 @@ public function testRenderEnclosure()
400400
$output = $this->view->render(false);
401401

402402
$this->assertSame($expected, $output);
403-
$this->assertSame('text/csv', $this->response->getType());
403+
$this->assertSame('text/csv', $this->view->response->getType());
404404
}
405405
}
406406

@@ -423,7 +423,7 @@ public function testRenderWithCustomNull()
423423
$output = $this->view->render(false);
424424

425425
$this->assertSame('a,b,c~1,2,NULL~you,NULL,me~', $output);
426-
$this->assertSame('text/csv', $this->response->getType());
426+
$this->assertSame('text/csv', $this->view->response->getType());
427427
}
428428

429429
/**

0 commit comments

Comments
 (0)