Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Tutorials
* [Mockery](https://github.com/etsy/phpunit-extensions/wiki/Mockery)
* [Multiple Database](https://github.com/etsy/phpunit-extensions/wiki/Multiple-Database)
* [Ticket Listener](https://github.com/etsy/phpunit-extensions/wiki/Ticket-Listener)
* [File Export](https://github.com/etsy/phpunit-extensions/wiki/File-Export)
* [PHPUI Command](https://github.com/etsy/phpunit-extensions/wiki/PHPUI-Command) Experimental!!

Installation
Expand Down
37 changes: 37 additions & 0 deletions Tests/FileExport/ExportTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

use PHPUnit\Extensions\FileExport;

class ExportTest extends FileExport\TestCase {

public function testExportObject () {
$aSampleObject1 = new SampleClass('Joan of Arc', 'Domrémy, France', '[email protected]');
$this->assertExportCompare($aSampleObject1);

$aSampleObject2 = new SampleClass('Hank Hill', '84 Rainey Street, Arlen, TX', '[email protected]');
$this->assertExportCompare($aSampleObject2);
}

public function testExportArray () {
$aSampleArray1 = [ 'this', 'is an array', 'of different types', [ 'many dimensions', 1, 2, 3 ] ];
$this->assertExportCompare($aSampleArray1);

$aSampleArray2 = [ [ 'one', 'two' ], 'and three' ];
$this->assertExportCompare($aSampleArray2);
}
}

class SampleClass {

public function __construct (string $sName, string $sAddress, string $sEmail) {
$this->sName = $sName;
$this->sAddress = $sAddress;
$this->sEmail = $sEmail;
}

public $sName;

public $sAddress;

public $sEmail;
}
12 changes: 12 additions & 0 deletions Tests/FileExport/phpunit_exports/ExportTest/testExportArray.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
array (
0 => 'this',
1 => 'is an array',
2 => 'of different types',
3 =>
array (
0 => 'many dimensions',
1 => 1,
2 => 2,
3 => 3,
),
)
8 changes: 8 additions & 0 deletions Tests/FileExport/phpunit_exports/ExportTest/testExportArray.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
array (
0 =>
array (
0 => 'one',
1 => 'two',
),
1 => 'and three',
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SampleClass::__set_state(array(
'sName' => 'Joan of Arc',
'sAddress' => 'Domrémy, France',
'sEmail' => '[email protected]',
))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SampleClass::__set_state(array(
'sName' => 'Hank Hill',
'sAddress' => '84 Rainey Street, Arlen, TX',
'sEmail' => '[email protected]',
))
Loading