Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Test for all helpers and features added #17

Merged
merged 8 commits into from
Feb 5, 2024
Merged
Prev Previous commit
Next Next commit
test: BaseTestCase extended in test
  • Loading branch information
achyutkneupane committed Feb 5, 2024
commit 326be989daf6488c3bdd3e24b90ee52df966b9ad
39 changes: 39 additions & 0 deletions tests/BaseTestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace AchyutN\LaravelHelpers\Tests;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Orchestra\Testbench\TestCase as Orchestra;

abstract class BaseTestCase extends Orchestra
{
use RefreshDatabase;
public function setUp(): void
{
parent::setUp();

// test migrations
$this->loadMigrationsFrom(__DIR__ . '/migrations');
$this->artisan('migrate', ['--database' => ':memory:'])->run();
}

protected function getEnvironmentSetUp($app): void
{
// sqlite test database
$app['config']->set('database.connections.the_test', [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
]);
// set config
$app['config']->set('database.default', 'the_test');
$app['config']->set('test', 'test');
}

public function getPackageProviders($app): array
{
return [
\AchyutN\LaravelHelpers\LaravelHelperProvider::class,
];
}
}
6 changes: 2 additions & 4 deletions tests/NepaliHelpersTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<?php

namespace Tests;
namespace AchyutN\LaravelHelpers\Tests;

use PHPUnit\Framework\TestCase;

class NepaliHelpersTest extends TestCase
class NepaliHelpersTest extends BaseTestCase
{
public function test_english_nepali_number()
{
Expand Down