Validate unit testing is working

This commit is contained in:
Deon George 2023-01-27 22:16:25 +11:00
parent daeea9a1f6
commit 210793e814
5 changed files with 21 additions and 23 deletions

View File

@ -1,33 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false" <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupStaticAttributes="false" xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php" bootstrap="vendor/autoload.php"
colors="true" colors="true"
convertErrorsToExceptions="true" >
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites> <testsuites>
<testsuite name="Unit"> <testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory> <directory suffix="Test.php">./tests/Unit</directory>
</testsuite> </testsuite>
<testsuite name="Feature"> <testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory> <directory suffix="Test.php">./tests/Feature</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
<filter> <coverage processUncoveredFiles="true">
<whitelist processUncoveredFilesFromWhitelist="true"> <include>
<directory suffix=".php">./app</directory> <directory suffix=".php">./app</directory>
</whitelist> </include>
</filter> </coverage>
<php> <php>
<env name="APP_ENV" value="testing"/> <env name="APP_ENV" value="testing"/>
<env name="BCRYPT_ROUNDS" value="4"/> <env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_DRIVER" value="array"/> <env name="CACHE_DRIVER" value="array"/>
<env name="MAIL_DRIVER" value="array"/> <!-- <env name="DB_CONNECTION" value="sqlite"/> -->
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/> <env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/> <env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php> </php>
</phpunit> </phpunit>

View File

@ -2,6 +2,7 @@
namespace Tests\Feature; namespace Tests\Feature;
// use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase; use Tests\TestCase;
class ExampleTest extends TestCase class ExampleTest extends TestCase
@ -11,9 +12,9 @@ class ExampleTest extends TestCase
* *
* @return void * @return void
*/ */
public function testBasicTest() public function test_the_application_returns_a_successful_response()
{ {
$response = $this->get('/home'); $response = $this->get('/');
$response->assertStatus(200); $response->assertStatus(200);
} }

View File

@ -2,8 +2,7 @@
namespace Tests\Unit; namespace Tests\Unit;
use Tests\TestCase; use PHPUnit\Framework\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class ExampleTest extends TestCase class ExampleTest extends TestCase
{ {
@ -12,7 +11,7 @@ class ExampleTest extends TestCase
* *
* @return void * @return void
*/ */
public function testBasicTest() public function test_that_true_is_true()
{ {
$this->assertTrue(true); $this->assertTrue(true);
} }

View File

@ -12,15 +12,15 @@ class GetBaseDNTest extends TestCase
* Test that we can get the Base DN of an LDAP server * Test that we can get the Base DN of an LDAP server
* *
* @return void * @return void
* @throws \LdapRecord\Models\ModelNotFoundException * @throws \LdapRecord\Query\ObjectNotFoundException
* @covers \App\Ldap\Entry::baseDN() * @covers \App\Ldap\Entry::baseDN()
*/ */
public function testBaseDNExists() public function testBaseDnExists()
{ {
$o = (new Entry)->baseDN(); $o = (new Entry)->baseDN();
$this->assertIsObject($o); $this->assertIsObject($o);
$this->assertCount(1,$o->toArray()); $this->assertCount(6,$o->toArray());
$this->assertEquals('dc=Test',$o->first()->getDn()); $this->assertEquals('dc=Test',$o->first()->getDn());
} }
} }

View File

@ -13,10 +13,10 @@ class TranslateOidTest extends TestCase
* A basic feature test example. * A basic feature test example.
* *
* @return void * @return void
* @throws \LdapRecord\Models\ModelNotFoundException * @throws \LdapRecord\Query\ObjectNotFoundException
* @covers \App\Classes\LDAP\Server::getOID() * @covers \App\Classes\LDAP\Server::getOID()
*/ */
public function testRootDSE() public function testRootDse()
{ {
$dse = (new Entry)->rootDSE(); $dse = (new Entry)->rootDSE();