- DOI implementation wit unit testing
This commit is contained in:
parent
7f9bd089b1
commit
9b6a6469d7
20 changed files with 2128 additions and 360 deletions
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
namespace Tests;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
|
@ -11,7 +12,6 @@ class ExampleTest extends TestCase
|
|||
public function testBasicExample()
|
||||
{
|
||||
$response = $this->call('GET', '/');
|
||||
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
}
|
||||
}
|
||||
|
|
68
tests/Feature/DoiClientTest.php
Normal file
68
tests/Feature/DoiClientTest.php
Normal file
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Tests\TestCase;
|
||||
use App\Tethys\Utils\DoiClient;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DoiClientTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic feature test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
// public function testExample()
|
||||
// {
|
||||
// $response = $this->get('/');
|
||||
// $response->assertStatus(200);
|
||||
// }
|
||||
|
||||
// public function testCheckDoi()
|
||||
// {
|
||||
// $client = new DoiClient();
|
||||
// // $this->setExpectedException('Opus\Doi\ClientException');
|
||||
// $result = $client->checkDoi(
|
||||
// '10.5072/tethys-999',
|
||||
// 'http://localhost/opus4/frontdoor/index/index/999'
|
||||
// );
|
||||
// $this->assertTrue($result);
|
||||
|
||||
// $result = $client->checkDoi(
|
||||
// '10.5072/tethys-999',
|
||||
// 'http://localhost/opus4/frontdoor/index/index/111'
|
||||
// );
|
||||
// $this->assertFalse($result);
|
||||
// }
|
||||
|
||||
public function testRegisterDoiWithDataCiteTestAccount()
|
||||
{
|
||||
// $this->markTestSkipped(
|
||||
// 'Test kann nur manuell gestartet werden (Zugangsdaten zum MDS-Testservice von DataCite erforderlich)'
|
||||
// );
|
||||
|
||||
$myRequest = new Request();
|
||||
$myRequest->setMethod('POST');
|
||||
|
||||
$myRequest->request->add(
|
||||
[
|
||||
'publish_id' => 1,
|
||||
'path' => 'https://www.demo.laudatio-repository.org/foo'
|
||||
]
|
||||
);
|
||||
|
||||
$doiController = new \App\Http\Controllers\DoiController(new DoiClient());
|
||||
$doiController->store($myRequest);
|
||||
|
||||
|
||||
// $client = new DoiClient();
|
||||
// $client->registerDoi(
|
||||
// '10.5072/tethys-999',
|
||||
// xmlMeta,
|
||||
// 'http://localhost/opus4/frontdoor/index/index/999'
|
||||
// );
|
||||
}
|
||||
}
|
|
@ -1,6 +1,10 @@
|
|||
<?php
|
||||
namespace Tests;
|
||||
|
||||
class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
use Illuminate\Contracts\Console\Kernel;
|
||||
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
||||
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* Creates the application.
|
||||
|
@ -9,10 +13,8 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
|||
*/
|
||||
public function createApplication()
|
||||
{
|
||||
$app = require __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
|
||||
|
||||
$app = require __DIR__ . '/../bootstrap/app.php';
|
||||
$app->make(Kernel::class)->bootstrap();
|
||||
return $app;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue