Compare commits
2 Commits
7e5524e0dd
...
c6aecc25e5
Author | SHA1 | Date |
---|---|---|
|
c6aecc25e5 | |
|
66b3e005e7 |
|
@ -1,23 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests;
|
|
||||||
|
|
||||||
use Laravel\Lumen\Testing\DatabaseMigrations;
|
|
||||||
use Laravel\Lumen\Testing\DatabaseTransactions;
|
|
||||||
|
|
||||||
class ExampleTest extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic test example.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function test_that_base_endpoint_returns_a_successful_response()
|
|
||||||
{
|
|
||||||
$this->get('/');
|
|
||||||
|
|
||||||
$this->assertEquals(
|
|
||||||
$this->app->version(), $this->response->getContent()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Tests\TestCase;
|
||||||
|
use Laravel\Lumen\Testing\DatabaseMigrations;
|
||||||
|
use Laravel\Lumen\Testing\DatabaseTransactions;
|
||||||
|
|
||||||
|
class PagesTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic test example.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function test_homepage_is_reacheble()
|
||||||
|
{
|
||||||
|
$res = $this->get('/');
|
||||||
|
|
||||||
|
$res->assertResponseOk();
|
||||||
|
$res->assertStringContainsString(
|
||||||
|
'organization', $this->response->getContent()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_backend_is_not_reachable_for_guests_and_redirect_to_login()
|
||||||
|
{
|
||||||
|
$home = $this->get('/');
|
||||||
|
$res = $this->get('/backend');
|
||||||
|
|
||||||
|
$res->assertResponseStatus(302);
|
||||||
|
$res->assertEquals(
|
||||||
|
$home->response->getContent(), $this->response->getContent()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_backend_is_reachable_for_logged_in_users()
|
||||||
|
{
|
||||||
|
$res = $this->post('/backend', array(
|
||||||
|
'organization' => 'GruppoCO',
|
||||||
|
'password' => getenv('APP_PASSWORD')
|
||||||
|
));
|
||||||
|
|
||||||
|
$res->assertResponseOk();
|
||||||
|
$res->assertStringContainsString(
|
||||||
|
__('File exporter'), $this->response->getContent()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue