Clean up test code, prep for merge.

This commit is contained in:
James Cole 2020-07-31 06:53:48 +02:00
parent 0264184442
commit cd19e86141
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D
6 changed files with 13 additions and 145 deletions

View File

@ -1,63 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ phpunit.coverage.specific.xml
~ Copyright (c) 2020 james@firefly-iii.org
~
~ This file is part of Firefly III (https://github.com/firefly-iii).
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as
~ published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="true">
<listeners>
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
</listeners>
<testsuites>
<testsuite name="Api">
<directory suffix="Test.php">./tests/Api</directory>
</testsuite>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
<exclude>
<file>app/Http/breadcrumbs.php</file>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="./storage/build/clover-specific.xml" />
</logging>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
</php>
</phpunit>

View File

@ -1,64 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ phpunit.coverage.xml
~ Copyright (c) 2020 james@firefly-iii.org
~
~ This file is part of Firefly III (https://github.com/firefly-iii).
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as
~ published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="true">
<listeners>
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
</listeners>
<testsuites>
<testsuite name="Api">
<directory suffix="Test.php">./tests/Api</directory>
</testsuite>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
<exclude>
<file>app/Http/breadcrumbs.php</file>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="./storage/build/clover-all.xml" />
</logging>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
</php>
</phpunit>

View File

@ -37,12 +37,14 @@
<testsuite name="Api">
<directory suffix="Test.php">./tests/Api</directory>
</testsuite>
<!--
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
-->
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">

View File

@ -29,7 +29,6 @@ use FireflyIII\Repositories\Category\NoCategoryRepositoryInterface;
use FireflyIII\Repositories\Category\OperationsRepositoryInterface;
use Laravel\Passport\Passport;
use Log;
use Tests\Support\TestDataTrait;
use Tests\TestCase;
/**
@ -40,8 +39,6 @@ use Tests\TestCase;
*/
class CategoryControllerTest extends TestCase
{
use TestDataTrait;
/**
*
*/

View File

@ -24,9 +24,9 @@ declare(strict_types=1);
namespace Tests\Api\V1\Controllers;
use Faker\Factory;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Transformers\UserTransformer;
use FireflyIII\User;
use Laravel\Passport\Passport;
use Log;
use Mockery;
@ -49,7 +49,6 @@ class UserControllerTest extends TestCase
parent::setUp();
Passport::actingAs($this->user());
$this->mockDefaultConfiguration();
Log::info(sprintf('Now in %s.', get_class($this)));
}
@ -61,7 +60,13 @@ class UserControllerTest extends TestCase
*/
public function testStoreBasic(): void
{
$this->assertTrue(true);
}
Log::info(sprintf('Now in test %s.', __METHOD__));
// random user
$faker = Factory::create();
$data = ['email' => $faker->email,];
// test API
$response = $this->post(route('api.v1.users.store'), $data, ['Content-Type' => 'application/x-www-form-urlencoded', 'Accept' => 'application/json']);
$response->assertStatus(200);
}
}

View File

@ -25,6 +25,7 @@ namespace Tests;
use FireflyIII\User;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Tests\Traits\CollectsValues;
use Tests\Traits\MocksDefaultValues;
use Tests\Traits\TestHelpers;
@ -33,7 +34,7 @@ use Tests\Traits\TestHelpers;
*/
abstract class TestCase extends BaseTestCase
{
use CreatesApplication, MocksDefaultValues, TestHelpers;
use CreatesApplication, MocksDefaultValues, TestHelpers, CollectsValues;
/**
* @return array
@ -50,14 +51,4 @@ abstract class TestCase extends BaseTestCase
'custom range' => ['custom'],
];
}
/**
* @return User
*/
public function user(): User
{
return User::find(1);
}
}