Skip to content

Commit

Permalink
update to allow laravel 7 (#18)
Browse files Browse the repository at this point in the history
* Update composer.json

* Update .gitignore

* require laravel 7 for new version

* update test to match parent

* remove php 7.1

* allow phpunit 8 or 9

* assertRegExp() -> assertMatchesRegularExpression()

* more phpunit changes

* replace assertNotContains with assertStringNotContainsString

* travis config updates

* require phpunit ^9.1

* revert assertRegExp change
  • Loading branch information
Tom Schlick authored Apr 16, 2020
1 parent a72262a commit a5f3cb4
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ vendor
coverage
.idea
.vscode
.phpunit.result.cache
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
language: php

php:
- 7.1
- 7.2
- 7.3
- 7.4

env:
matrix:
#- COMPOSER_FLAGS="--prefer-lowest" # Disabled until works w/7.4 (2019-12-04)
- COMPOSER_FLAGS="--prefer-lowest"
- COMPOSER_FLAGS=""

services:
Expand All @@ -25,7 +24,7 @@ before_script:
- psql -c 'CREATE ROLE root SUPERUSER LOGIN;' -U postgres

script:
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover --configuration phpunit.xml.travis
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover --configuration phpunit.xml.travis --testdox

after_script:
- php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
}
],
"require": {
"php": "^7.1",
"laravel/framework": "^5.8 | ^6.0"
"php": "^7.2.5",
"laravel/framework": "^7.0"
},
"require-dev": {
"mockery/mockery": "~1.0",
"orchestra/testbench": "^3.7",
"phpunit/phpunit": "^7.0"
"orchestra/testbench": "^5.0",
"phpunit/phpunit": "^8.4|^9.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion tests/MigrateDumpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ public function test_dump_callsAfterDumpClosure()
$schema_sql = file_get_contents(
database_path() . MigrateDumpCommand::SCHEMA_SQL_PATH_SUFFIX
);
$this->assertNotContains('/*', $schema_sql);
$this->assertStringNotContainsString('/*', $schema_sql);
}
}
8 changes: 4 additions & 4 deletions tests/MigrateHookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public function test_handle()
$this->assertEquals(0, $result);

$output_string = $output->fetch();
$this->assertContains('Loaded schema', $output_string);
$this->assertContains('Dumped schema', $output_string);
$this->assertStringContainsString('Loaded schema', $output_string);
$this->assertStringContainsString('Dumped schema', $output_string);
}

public function test_handle_dumpsOnRollback()
Expand All @@ -44,7 +44,7 @@ public function test_handle_dumpsOnRollback()
$this->assertEquals(0, $result);

$output_string = $output->fetch();
$this->assertContains('Dumped schema', $output_string);
$this->assertStringContainsString('Dumped schema', $output_string);
}

public function test_handle_doesNotLoadWhenDbHasMigrated()
Expand All @@ -61,7 +61,7 @@ public function test_handle_doesNotLoadWhenDbHasMigrated()
$this->assertEquals(0, $result);

$output_string = $output->fetch();
$this->assertNotContains('Loaded schema', $output_string);
$this->assertStringNotContainsString('Loaded schema', $output_string);

$this->assertEquals(1, \DB::table('test_ms')->count());
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Mysql/MigrateDumpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public function test_handle()
$this->assertDirectoryExists($this->schemaSqlDirectory);
$this->assertFileExists($this->schemaSqlPath);
$result_sql = file_get_contents($this->schemaSqlPath);
$this->assertContains('CREATE TABLE `test_ms`', $result_sql);
$this->assertContains('INSERT INTO `migrations`', $result_sql);
$this->assertNotContains(' AUTO_INCREMENT=', $result_sql);
$this->assertStringContainsString('CREATE TABLE `test_ms`', $result_sql);
$this->assertStringContainsString('INSERT INTO `migrations`', $result_sql);
$this->assertStringNotContainsString(' AUTO_INCREMENT=', $result_sql);
$last_character = mb_substr($result_sql, -1);
$this->assertRegExp("/[\r\n]\z/mu", $last_character);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Sqlite/SqliteTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ abstract class SqliteTestCase extends TestCase
{
protected $dbDefault = 'sqlite';

public static function setUpBeforeClass()
public static function setUpBeforeClass() : void
{
// File must exist before connection will initialize, even if empty.
touch(__DIR__ . '/../../vendor/orchestra/testbench-core/laravel/database/database.sqlite');
}
}
}

0 comments on commit a5f3cb4

Please sign in to comment.