Skip to content

Commit

Permalink
Merge pull request #1368 from krayin/laravel-pint-updates
Browse files Browse the repository at this point in the history
test: test fixing
  • Loading branch information
devansh-webkul authored Aug 14, 2024
2 parents 48da2b1 + 60f1230 commit 41356b9
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 23 deletions.
8 changes: 5 additions & 3 deletions packages/Webkul/Admin/src/Http/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ function bouncer()
}
}

function admin_vite(): AdminVite
{
return app(AdminVite::class);
if (! function_exists('admin_vite')) {
function admin_vite(): AdminVite
{
return app(AdminVite::class);
}
}
8 changes: 5 additions & 3 deletions packages/Webkul/WebForm/src/Http/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

use Webkul\WebForm\Vite as WebFormVite;

function webform_vite(): WebFormVite
{
return app(WebFormVite::class);
if (! function_exists('webform_vite')) {
function webform_vite(): WebFormVite
{
return app(WebFormVite::class);
}
}
31 changes: 19 additions & 12 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
cacheDirectory=".phpunit.cache"
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>

<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">

<source>
<include>
<directory suffix=".php">./app</directory>
</include>
</coverage>
</source>

<php>
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<!-- <server name="DB_CONNECTION" value="sqlite"/> -->
<!-- <server name="DB_DATABASE" value=":memory:"/> -->
<server name="MAIL_MAILER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="TELESCOPE_ENABLED" value="false"/>
<server name="APP_ENV" value="testing" />
<server name="BCRYPT_ROUNDS" value="4" />
<server name="CACHE_DRIVER" value="array" />
<server name="MAIL_MAILER" value="array" />
<server name="QUEUE_CONNECTION" value="sync" />
<server name="SESSION_DRIVER" value="array" />
<server name="TELESCOPE_ENABLED" value="false" />
</php>
</phpunit>
9 changes: 4 additions & 5 deletions tests/Feature/AuthenticationTest.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<?php

test('check main admin login page', function () {
it('can see the admin login page', function () {
test()->get(route('admin.session.create'))
->assertOK();
});

test('check dashboard page after login', function () {
it('can see the dashboard page after login', function () {
$admin = getDefaultAdmin();

test()->actingAs($admin)
->get(route('admin.dashboard.index'))
->assertSee(__('admin::app.dashboard.title'))
->assertSee(getFirstName($admin->name));
->assertSee(__('admin::app.dashboard.title'));

expect(auth()->guard('user')->user()->name)->toBe($admin->name);
});

test('check for admin logout', function () {
it('can logout from the admin panel', function () {
$admin = getDefaultAdmin();

test()->actingAs($admin)
Expand Down

0 comments on commit 41356b9

Please sign in to comment.