Skip to content

Commit

Permalink
Getting tests to work for the package
Browse files Browse the repository at this point in the history
  • Loading branch information
tnylea committed May 4, 2024
1 parent 5e12d6b commit 6a952a2
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 37 deletions.
14 changes: 12 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,20 @@ To get a local version working of DevDojo Auth.
}
```

Finally, run `composer update` and publish the assets:
Finally, run `composer update`. Next, we need to create two symlinks

### Create Symlinks

1. From the public directory create the following symlink

```
ln -s ../packages/devdojo/auth/public auth
```

2. From the root directory, delete the current `tests` folder and create the following symlink

```
php artisan vendor:publish --tag=auth:assets
ln -s packages/devdojo/auth/tests tests
```

Auth is now included in your project and is ready for development.
Expand Down
62 changes: 30 additions & 32 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
<testsuite name="Smoke">
<directory suffix="Test.php">./tests/Smoke</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_NAME" value="Laravel"/>
<env name="APP_ENV" value="testing"/>
<env name="APP_KEY" value="base64:GJqqemn+XoJxzujsDb+SMGI7rgKkpMjTj4uh8WK4hkk="/>
<env name="APP_DEBUG" value="true"/>
<env name="APP_TIMEZONE" value="UTC"/>
<env name="APP_URL" value="https://wstw4ifdxz.sharedwithexpose.com/"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="DB_CONNECTION" value="mysql"/>
<env name="DB_DATABASE" value="auth_testing"/>
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
</include>
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_STORE" value="array"/>
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
<env name="MAIL_MAILER" value="array"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
6 changes: 6 additions & 0 deletions tests/Feature/ExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@

$response->assertStatus(200);
});

test('that the login route at /auth/login returns a successful response', function () {
$response = $this->get('/auth/login');

$response->assertStatus(200);
});
3 changes: 0 additions & 3 deletions tests/Feature/LoginTest.php

This file was deleted.

0 comments on commit 6a952a2

Please sign in to comment.