Skip to content

Commit

Permalink
Wiring up unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher committed May 3, 2024
1 parent b25f7e6 commit 2630a45
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

use Mantle\Framework\Bootloader;

return Bootloader::instance()
return Bootloader::create()
->with_kernels(
console: App\Console\Kernel::class,
http: App\Http\Kernel::class,
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"require-dev": {
"alleyinteractive/alley-coding-standards": "^2.0",
"phpstan/phpstan": "1.10.67",
"phpunit/phpunit": "^10.0.7",
"szepeviktor/phpstan-wordpress": "^1.3"
},
"minimum-stability": "dev",
Expand Down
1 change: 1 addition & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<properties>
<property name="prefixes" type="array">
<element value="App"/>
<element value="bootloader"/>
</property>
</properties>
<exclude-pattern>views/</exclude-pattern>
Expand Down
12 changes: 3 additions & 9 deletions tests/CreateApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,10 @@ trait CreateApplication {
* @return \Mantle\Application\Application
*/
public function create_application(): \Mantle\Contracts\Application {
// Allow non-mantle-site usage.
if ( ! file_exists( __DIR__ . '/../bootstrap/app.php' ) ) {
echo "Application bootstrap not found: creating new instance...";
return new Application( __DIR__ . '/../', home_url( '/' ) );
}
$bootloader = require __DIR__ . '/../bootstrap/app.php';

$app = require __DIR__ . '/../bootstrap/app.php';
$bootloader->make( Kernel::class )->bootstrap();

$app->make( Kernel::class )->bootstrap();

return $app;
return $bootloader->get_application();
}
}

0 comments on commit 2630a45

Please sign in to comment.