From b8daadefb18b750fc2c448f50144f5df063186ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Sat, 27 Jul 2013 14:04:13 +0200 Subject: [PATCH] MDL-39915 cleanup core_csvclass_testcase --- lib/tests/csvclass_test.php | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/tests/csvclass_test.php b/lib/tests/csvclass_test.php index 4ab71c0e5fb..55e84d14e67 100644 --- a/lib/tests/csvclass_test.php +++ b/lib/tests/csvclass_test.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Tests csv import and export functions + * Tests csv import and export functions. * * @package core * @category phpunit @@ -28,17 +28,17 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; require_once($CFG->dirroot . '/lib/csvlib.class.php'); -class csvclass_testcase extends advanced_testcase { +class core_csvclass_testcase extends advanced_testcase { - var $testdata = array(); - var $teststring = ''; - var $teststring2 = ''; - var $teststring3 = ''; - var $teststring4 = ''; + protected $testdata = array(); + protected $teststring = ''; + protected $teststring2 = ''; + protected $teststring3 = ''; + protected $teststring4 = ''; - protected function setUp(){ + protected function setUp() { - $this->resetAfterTest(true); + $this->resetAfterTest(); $csvdata = array(); $csvdata[0][] = 'fullname'; @@ -62,12 +62,12 @@ class csvclass_testcase extends advanced_testcase {

and also contains ""double quotes""

",Yebisu '; - $this->teststring2 = 'fullname,"description of things",beer + $this->teststring2 = 'fullname,"description of things",beer "Fred Flint","

Find the stone inside the box

",Asahi,"A fourth column" "Sarah Smith","

How are the people next door?

,Yebisu,"Forget the next" '; - $this->teststring4 = 'fullname,"description of things",beer + $this->teststring4 = 'fullname,"description of things",beer "Douglas Dirk","

I am fine, thankyou.

",Becks "Addelyn Francis","

Thanks for the cake

",Becks @@ -86,10 +86,10 @@ class csvclass_testcase extends advanced_testcase { $csvexport->add_data($data); } $csvoutput = $csvexport->print_csv_data(true); - $this->assertEquals($csvoutput, $this->teststring); + $this->assertSame($csvoutput, $this->teststring); $test_data = csv_export_writer::print_array($this->testdata, 'comma', '"', true); - $this->assertEquals($test_data, $this->teststring); + $this->assertSame($test_data, $this->teststring); // Testing that the content is imported correctly. $iid = csv_import_reader::get_new_iid('lib'); @@ -103,7 +103,7 @@ class csvclass_testcase extends advanced_testcase { } $csvimport->cleanup(); $csvimport->close(); - $this->assertEquals($dataset, $this->testdata); + $this->assertSame($dataset, $this->testdata); // Testing for the wrong count of columns. $errortext = get_string('csvweirdcolumns', 'error'); @@ -113,9 +113,9 @@ class csvclass_testcase extends advanced_testcase { $importerror = $csvimport->get_error(); $csvimport->cleanup(); $csvimport->close(); - $this->assertEquals($importerror, $errortext); + $this->assertSame($importerror, $errortext); - // Testing for empty content + // Testing for empty content. $errortext = get_string('csvemptyfile', 'error'); $iid = csv_import_reader::get_new_iid('lib'); @@ -124,7 +124,7 @@ class csvclass_testcase extends advanced_testcase { $importerror = $csvimport->get_error(); $csvimport->cleanup(); $csvimport->close(); - $this->assertEquals($importerror, $errortext); + $this->assertSame($importerror, $errortext); // Testing for a tab separated file. // The tab separated file has a trailing tab and extra blank lines at the end of the file.