You are here

protected function CSVUnitBase::setUp in Migrate Source CSV 8.2

Overrides UnitTestCase::setUp

3 calls to CSVUnitBase::setUp()
CSVFileObjectTest::setUp in tests/src/Unit/CSVFileObjectTest.php
CSVSourceYieldTest::setUp in tests/src/Unit/Plugin/migrate/source/CSVSourceYieldTest.php
CSVUnitTest::setUp in tests/src/Unit/Plugin/migrate/source/CSVUnitTest.php
3 methods override CSVUnitBase::setUp()
CSVFileObjectTest::setUp in tests/src/Unit/CSVFileObjectTest.php
CSVSourceYieldTest::setUp in tests/src/Unit/Plugin/migrate/source/CSVSourceYieldTest.php
CSVUnitTest::setUp in tests/src/Unit/Plugin/migrate/source/CSVUnitTest.php

File

tests/src/Unit/CSVUnitBase.php, line 39

Class

CSVUnitBase
Base class for CSV unit tests.

Namespace

Drupal\Tests\migrate_source_csv\Unit

Code

protected function setUp() {
  parent::setUp();
  $root_dir = vfsStream::setup('root');
  $happy = <<<'EOD'
id,first_name,last_name,email,country,ip_address
1,Justin,Dean,jdean0@example.com,Indonesia,60.242.130.40
2,Joan,Jordan,jjordan1@example.com,Thailand,137.230.209.171
3,William,Ray,wray2@example.com,Germany,4.75.251.71
4,Jack,Collins,jcollins3@example.com,Indonesia,118.241.243.64
5,Jean,Moreno,jmoreno4@example.com,Portugal,12.24.215.20
6,Dennis,Mitchell,dmitchell5@example.com,Mexico,185.24.131.116
7,Harry,West,hwest6@example.com,Uzbekistan,101.74.110.171
8,Rebecca,Hunt,rhunt7@example.com,France,253.107.6.23
9,Rose,Rogers,rrogers8@example.com,China,21.2.126.228
10,Juan,Walker,jwalker9@example.com,Angola,192.118.77.225
11,Lois,Price,lpricea@example.com,Greece,231.185.100.19
12,Patricia,Bell,pbellb@example.com,Sweden,226.2.254.94
13,Gerald,Kelly,gkellyc@example.com,China,31.204.2.163
14,Kimberly,Jackson,kjacksond@example.com,Thailand,19.187.65.116
15,Jason,Mason,jmasone@example.com,Greece,225.129.68.203
EOD;
  $sad = <<<'EOD'
1|%Justin%|Dean|jdean0@example.com|Indonesia|60.242.130.40
2|Joan|Jordan|jjordan1@example.com|Thailand|137.230.209.171
3|William|Ray|wray2@example.com|Germany|4.75.251.71
4|Jack|Collins|jcollins3@example.com|Indonesia|118.241.243.64
5|Jean|Moreno|jmoreno4@example.com|Portugal|12.24.215.20
6|Dennis|Mitchell|dmitchell5@example.com|Mexico|185.24.131.116
7|Harry|West|hwest6@example.com|Uzbekistan|101.74.110.171
8|Rebecca|Hunt|rhunt7@example.com|France|253.107.6.23
9|Rose|Rogers|rrogers8@example.com|China|21.2.126.228
10|Juan|Walker|jwalker9@example.com|Angola|192.118.77.225
11|Lois|Price|lpricea@example.com|Greece|231.185.100.19
12|Patricia|Bell|pbellb@example.com|Sweden|226.2.254.94
13|Gerald|Kelly|gkellyc@example.com|China|31.204.2.163
14|Kimberly|Jackson|kjacksond@example.com|Thailand|19.187.65.116
15|Jason|Mason|jmasone@example.com|Greece|225.129.68.203

EOD;
  $multiLineContent = <<<'EOD'
id,title,description
1,"Title 1","Description 1 Line 1
Description 1 Line 2
Description 1 Line 3"
2,"Title 2","Description 2 Line 1
Description 2 Line 2
Description 2 Line 3"
3,"Title 3","Description 3 Line 1
Description 3 Line 2
Description 3 Line 3"
EOD;
  $this->happyPath = vfsStream::newFile('data.csv')
    ->at($root_dir)
    ->withContent($happy)
    ->url();
  $this->sad = vfsStream::newFile('data_edge_case.csv')
    ->at($root_dir)
    ->withContent($sad)
    ->url();
  $this->multiLine = vfsStream::newFile('multi-line.csv')
    ->at($root_dir)
    ->withContent($multiLineContent)
    ->url();
}