Skip to content
This repository was archived by the owner on Mar 20, 2025. It is now read-only.

Commit 20dd6fd

Browse files
committed
Test for alternative line endings
1 parent 451ca14 commit 20dd6fd

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
box.json export-ignore
99
phpunit.xml.dist export-ignore
1010
pint.json export-ignore
11+
12+
13+
tests/fixtures/down-migration/line-endings*.php eol=crlf

tests/Feature/Tasks/DownMigrationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function it_replaces_string_references_to_classes()
4343
$this->fakeProject([
4444
'database/migrations/basic_migration.php' => 'tests/fixtures/down-migration/simple.php',
4545
'database/migrations/complex_migration.php' => 'tests/fixtures/down-migration/complex.php',
46+
'database/migrations/windows_migration.php' => 'tests/fixtures/down-migration/line-endings.php',
4647
]);
4748

4849
$result = $this->subject->perform();
@@ -51,5 +52,6 @@ public function it_replaces_string_references_to_classes()
5152

5253
$this->assertFileChanges('tests/fixtures/down-migration/simple.after.php', 'database/migrations/basic_migration.php');
5354
$this->assertFileChanges('tests/fixtures/down-migration/complex.after.php', 'database/migrations/complex_migration.php');
55+
$this->assertFileChanges('tests/fixtures/down-migration/line-endings.after.php', 'database/migrations/windows_migration.php');
5456
}
5557
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class SimpleMigration extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('videos', function (Blueprint $table) {
17+
$table->integer('runtime')->nullable();
18+
});
19+
}
20+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class SimpleMigration extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('videos', function (Blueprint $table) {
17+
$table->integer('runtime')->nullable();
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
Schema::table('videos', function (Blueprint $table) {
29+
$table->dropColumn('runtime');
30+
});
31+
}
32+
}

0 commit comments

Comments
 (0)