harmonisation style
This commit is contained in:
parent
b67abad361
commit
206e217024
110
migrations/Version20241114132304.php
Normal file
110
migrations/Version20241114132304.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20241114132304 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SEQUENCE degree_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE faq_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE intern_application_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE intern_degree_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE intern_favorite_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE intern_skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE message_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE degree (id INT NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE TABLE faq (id INT NOT NULL, question TEXT NOT NULL, answer TEXT DEFAULT NULL, update_date DATE NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE TABLE intern_application (id INT NOT NULL, application_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, application_date DATE NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_4EDBBCC83E030ACD ON intern_application (application_id)');
|
||||
$this->addSql('CREATE INDEX IDX_4EDBBCC8525DD4B4 ON intern_application (intern_id)');
|
||||
$this->addSql('CREATE TABLE intern_degree (id INT NOT NULL, degree_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, graduation_date DATE NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_E68CCB23B35C5756 ON intern_degree (degree_id)');
|
||||
$this->addSql('CREATE INDEX IDX_E68CCB23525DD4B4 ON intern_degree (intern_id)');
|
||||
$this->addSql('CREATE TABLE intern_favorite (id INT NOT NULL, announcement_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_A709862E913AEA17 ON intern_favorite (announcement_id)');
|
||||
$this->addSql('CREATE INDEX IDX_A709862E525DD4B4 ON intern_favorite (intern_id)');
|
||||
$this->addSql('CREATE TABLE intern_skill (id INT NOT NULL, skill_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_75E1C4DC5585C142 ON intern_skill (skill_id)');
|
||||
$this->addSql('CREATE INDEX IDX_75E1C4DC525DD4B4 ON intern_skill (intern_id)');
|
||||
$this->addSql('CREATE TABLE message (id INT NOT NULL, sender_id INT DEFAULT NULL, receiver_id INT DEFAULT NULL, content TEXT NOT NULL, sending_date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_B6BD307FF624B39D ON message (sender_id)');
|
||||
$this->addSql('CREATE INDEX IDX_B6BD307FCD53EDB6 ON message (receiver_id)');
|
||||
$this->addSql('CREATE TABLE skill (id INT NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('ALTER TABLE intern_application ADD CONSTRAINT FK_4EDBBCC83E030ACD FOREIGN KEY (application_id) REFERENCES announcement (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE intern_application ADD CONSTRAINT FK_4EDBBCC8525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE intern_degree ADD CONSTRAINT FK_E68CCB23B35C5756 FOREIGN KEY (degree_id) REFERENCES degree (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE intern_degree ADD CONSTRAINT FK_E68CCB23525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE intern_favorite ADD CONSTRAINT FK_A709862E913AEA17 FOREIGN KEY (announcement_id) REFERENCES announcement (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE intern_favorite ADD CONSTRAINT FK_A709862E525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE intern_skill ADD CONSTRAINT FK_75E1C4DC5585C142 FOREIGN KEY (skill_id) REFERENCES skill (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE intern_skill ADD CONSTRAINT FK_75E1C4DC525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FF624B39D FOREIGN KEY (sender_id) REFERENCES userApp (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FCD53EDB6 FOREIGN KEY (receiver_id) REFERENCES userApp (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE favorites DROP CONSTRAINT fk_e46960f5525dd4b4');
|
||||
$this->addSql('ALTER TABLE favorites DROP CONSTRAINT fk_e46960f5913aea17');
|
||||
$this->addSql('ALTER TABLE applications DROP CONSTRAINT fk_f7c966f0525dd4b4');
|
||||
$this->addSql('ALTER TABLE applications DROP CONSTRAINT fk_f7c966f0913aea17');
|
||||
$this->addSql('DROP TABLE favorites');
|
||||
$this->addSql('DROP TABLE applications');
|
||||
$this->addSql('ALTER TABLE announcement ADD creation_date DATE NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('DROP SEQUENCE degree_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE faq_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE intern_application_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE intern_degree_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE intern_favorite_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE intern_skill_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE message_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE skill_id_seq CASCADE');
|
||||
$this->addSql('CREATE TABLE favorites (intern_id INT NOT NULL, announcement_id INT NOT NULL, PRIMARY KEY(intern_id, announcement_id))');
|
||||
$this->addSql('CREATE INDEX idx_e46960f5913aea17 ON favorites (announcement_id)');
|
||||
$this->addSql('CREATE INDEX idx_e46960f5525dd4b4 ON favorites (intern_id)');
|
||||
$this->addSql('CREATE TABLE applications (intern_id INT NOT NULL, announcement_id INT NOT NULL, PRIMARY KEY(intern_id, announcement_id))');
|
||||
$this->addSql('CREATE INDEX idx_f7c966f0913aea17 ON applications (announcement_id)');
|
||||
$this->addSql('CREATE INDEX idx_f7c966f0525dd4b4 ON applications (intern_id)');
|
||||
$this->addSql('ALTER TABLE favorites ADD CONSTRAINT fk_e46960f5525dd4b4 FOREIGN KEY (intern_id) REFERENCES intern (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE favorites ADD CONSTRAINT fk_e46960f5913aea17 FOREIGN KEY (announcement_id) REFERENCES announcement (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE applications ADD CONSTRAINT fk_f7c966f0525dd4b4 FOREIGN KEY (intern_id) REFERENCES intern (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE applications ADD CONSTRAINT fk_f7c966f0913aea17 FOREIGN KEY (announcement_id) REFERENCES announcement (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE intern_application DROP CONSTRAINT FK_4EDBBCC83E030ACD');
|
||||
$this->addSql('ALTER TABLE intern_application DROP CONSTRAINT FK_4EDBBCC8525DD4B4');
|
||||
$this->addSql('ALTER TABLE intern_degree DROP CONSTRAINT FK_E68CCB23B35C5756');
|
||||
$this->addSql('ALTER TABLE intern_degree DROP CONSTRAINT FK_E68CCB23525DD4B4');
|
||||
$this->addSql('ALTER TABLE intern_favorite DROP CONSTRAINT FK_A709862E913AEA17');
|
||||
$this->addSql('ALTER TABLE intern_favorite DROP CONSTRAINT FK_A709862E525DD4B4');
|
||||
$this->addSql('ALTER TABLE intern_skill DROP CONSTRAINT FK_75E1C4DC5585C142');
|
||||
$this->addSql('ALTER TABLE intern_skill DROP CONSTRAINT FK_75E1C4DC525DD4B4');
|
||||
$this->addSql('ALTER TABLE message DROP CONSTRAINT FK_B6BD307FF624B39D');
|
||||
$this->addSql('ALTER TABLE message DROP CONSTRAINT FK_B6BD307FCD53EDB6');
|
||||
$this->addSql('DROP TABLE degree');
|
||||
$this->addSql('DROP TABLE faq');
|
||||
$this->addSql('DROP TABLE intern_application');
|
||||
$this->addSql('DROP TABLE intern_degree');
|
||||
$this->addSql('DROP TABLE intern_favorite');
|
||||
$this->addSql('DROP TABLE intern_skill');
|
||||
$this->addSql('DROP TABLE message');
|
||||
$this->addSql('DROP TABLE skill');
|
||||
$this->addSql('ALTER TABLE announcement DROP creation_date');
|
||||
}
|
||||
}
|
32
migrations/Version20241121135116.php
Normal file
32
migrations/Version20241121135116.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20241121135116 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE userapp ALTER roles DROP NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE userApp ALTER roles SET NOT NULL');
|
||||
}
|
||||
}
|
38
migrations/Version20241121140219.php
Normal file
38
migrations/Version20241121140219.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20241121140219 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE announcement DROP CONSTRAINT fk_4db9d91c6bf700bd');
|
||||
$this->addSql('DROP INDEX idx_4db9d91c6bf700bd');
|
||||
$this->addSql('ALTER TABLE announcement ADD status VARCHAR(255) NOT NULL');
|
||||
$this->addSql('ALTER TABLE announcement DROP status_id');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE announcement ADD status_id INT NOT NULL');
|
||||
$this->addSql('ALTER TABLE announcement DROP status');
|
||||
$this->addSql('ALTER TABLE announcement ADD CONSTRAINT fk_4db9d91c6bf700bd FOREIGN KEY (status_id) REFERENCES status (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX idx_4db9d91c6bf700bd ON announcement (status_id)');
|
||||
}
|
||||
}
|
@ -1,14 +1,4 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Hello AnnouncementController!{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<style>
|
||||
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
|
||||
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
|
||||
</style>
|
||||
|
||||
{{ form(announcementForm) }}
|
||||
|
||||
|
||||
{% endblock %}
|
@ -15,7 +15,7 @@
|
||||
<p> {{ ann.description }} </p>
|
||||
------------------------------
|
||||
|
||||
<p> {{ ann.creationDate|format("") }} </p>
|
||||
<p> {{ ann.creationDate|format("d-m-y") }} </p>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||
<title>{% block title %}Job Portal{% endblock %}</title>
|
||||
<title>{% block title %}Hegreshere{% endblock %}</title>
|
||||
|
||||
{# Tailwind CSS CDN #}
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
@ -41,7 +41,8 @@
|
||||
|
||||
{# Block for the specific page content #}
|
||||
<main>
|
||||
{% block content %}{% endblock %}
|
||||
{% block body %}
|
||||
{% endblock %}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
{% block title %}Accueil - Job Portal{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% block body %}
|
||||
<section class="bg-cover bg-center py-20" style="background-image: url('{{ asset('images/fond_site.png') }}');">
|
||||
<div class="container mx-auto text-center text-white">
|
||||
<h1 class="text-4xl md:text-5xl font-bold mb-4">Trouvez votre stage de rêve !</h1>
|
||||
|
@ -3,39 +3,59 @@
|
||||
{% block title %}Connexion{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="bg-gray-100 flex items-center justify-center min-h-screen">
|
||||
<div class="bg-white p-8 rounded-lg shadow-md w-full max-w-md">
|
||||
<h2 class="text-2xl font-bold text-center mb-2">Connexion</h2>
|
||||
<p class="text-center text-gray-600 mb-6">
|
||||
Pas encore inscrit ? Inscrivez vous !! <br>
|
||||
<a href="{{ path('app_register_intern') }}" class="text-teal-600 hover:underline">En tant que Stagiaire</a>
|
||||
<br>
|
||||
<a href="{{ path('app_register_employee') }}" class="text-teal-600 hover:underline">En tant qu'Entreprise</a>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
{# Affiche une erreur si la connexion échoue #}
|
||||
{% if error %}
|
||||
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
||||
<div class="bg-red-100 text-red-800 px-4 py-2 rounded mb-4">
|
||||
{{ error.messageKey|trans(error.messageData, 'security') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# Affiche un message si l'utilisateur est déjà connecté #}
|
||||
{% if app.user %}
|
||||
<div class="mb-3">
|
||||
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ path('app_logout') }}">Logout</a>
|
||||
<div class="bg-blue-100 text-blue-800 px-4 py-2 rounded mb-4">
|
||||
Vous êtes connecté en tant que {{ app.user.userIdentifier }}.
|
||||
<a href="{{ path('app_logout') }}" class="text-teal-600 hover:underline">Déconnexion</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<h1 class="h3 mb-3 font-weight-normal">Connexion à votre compte</h1>
|
||||
<label for="username">Nom d'utilisateur</label>
|
||||
<input type="text" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="username" required autofocus>
|
||||
<label for="password">Mot de passe</label>
|
||||
<input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
|
||||
|
||||
<input type="hidden" name="_csrf_token"
|
||||
value="{{ csrf_token('authenticate') }}"
|
||||
>
|
||||
|
||||
{#
|
||||
Uncomment this section and add a remember_me option below your firewall to activate remember me functionality.
|
||||
See https://symfony.com/doc/current/security/remember_me.html
|
||||
|
||||
<div class="checkbox mb-3">
|
||||
<input type="checkbox" name="_remember_me" id="_remember_me">
|
||||
<label for="_remember_me">Remember me</label>
|
||||
{# Champ pour le nom d'utilisateur #}
|
||||
<div class="mb-4">
|
||||
<label for="username" class="block text-gray-700 mb-2">Nom d'utilisateur</label>
|
||||
<input type="text" name="_username" id="username"
|
||||
class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-teal-500"
|
||||
value="{{ last_username }}" autocomplete="username" required autofocus>
|
||||
</div>
|
||||
#}
|
||||
|
||||
<button class="btn btn-lg btn-primary" type="submit">
|
||||
{# Champ pour le mot de passe #}
|
||||
<div class="mb-6">
|
||||
<label for="password" class="block text-gray-700 mb-2">Mot de passe</label>
|
||||
<input type="password" name="_password" id="password"
|
||||
class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-teal-500"
|
||||
autocomplete="current-password" required>
|
||||
</div>
|
||||
|
||||
{# Jeton CSRF pour protéger le formulaire #}
|
||||
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
|
||||
|
||||
{# Bouton de soumission #}
|
||||
<div class="text-center">
|
||||
<button type="submit"
|
||||
class="bg-teal-600 text-white px-6 py-2 rounded-lg w-full hover:bg-teal-700 focus:outline-none focus:ring-2 focus:ring-teal-500">
|
||||
Connexion
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
161
tests/Controller/EmployeeControllerTest.php
Normal file
161
tests/Controller/EmployeeControllerTest.php
Normal file
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Controller;
|
||||
|
||||
use App\Entity\Employee;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
final class EmployeeControllerTest extends WebTestCase
|
||||
{
|
||||
private KernelBrowser $client;
|
||||
private EntityManagerInterface $manager;
|
||||
private EntityRepository $repository;
|
||||
private string $path = '/employee/';
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->client = static::createClient();
|
||||
$this->manager = static::getContainer()->get('doctrine')->getManager();
|
||||
$this->repository = $this->manager->getRepository(Employee::class);
|
||||
|
||||
foreach ($this->repository->findAll() as $object) {
|
||||
$this->manager->remove($object);
|
||||
}
|
||||
|
||||
$this->manager->flush();
|
||||
}
|
||||
|
||||
public function testIndex(): void
|
||||
{
|
||||
$this->client->followRedirects();
|
||||
$crawler = $this->client->request('GET', $this->path);
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('Employee index');
|
||||
|
||||
// Use the $crawler to perform additional assertions e.g.
|
||||
// self::assertSame('Some text on the page', $crawler->filter('.p')->first());
|
||||
}
|
||||
|
||||
public function testNew(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$this->client->request('GET', sprintf('%snew', $this->path));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
|
||||
$this->client->submitForm('Save', [
|
||||
'employee[nickname]' => 'Testing',
|
||||
'employee[roles]' => 'Testing',
|
||||
'employee[password]' => 'Testing',
|
||||
'employee[firstName]' => 'Testing',
|
||||
'employee[lastName]' => 'Testing',
|
||||
'employee[tel]' => 'Testing',
|
||||
'employee[address]' => 'Testing',
|
||||
'employee[mail]' => 'Testing',
|
||||
'employee[company]' => 'Testing',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects($this->path);
|
||||
|
||||
self::assertSame(1, $this->repository->count([]));
|
||||
}
|
||||
|
||||
public function testShow(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new Employee();
|
||||
$fixture->setNickname('My Title');
|
||||
$fixture->setRoles('My Title');
|
||||
$fixture->setPassword('My Title');
|
||||
$fixture->setFirstName('My Title');
|
||||
$fixture->setLastName('My Title');
|
||||
$fixture->setTel('My Title');
|
||||
$fixture->setAddress('My Title');
|
||||
$fixture->setMail('My Title');
|
||||
$fixture->setCompany('My Title');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('Employee');
|
||||
|
||||
// Use assertions to check that the properties are properly displayed.
|
||||
}
|
||||
|
||||
public function testEdit(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new Employee();
|
||||
$fixture->setNickname('Value');
|
||||
$fixture->setRoles('Value');
|
||||
$fixture->setPassword('Value');
|
||||
$fixture->setFirstName('Value');
|
||||
$fixture->setLastName('Value');
|
||||
$fixture->setTel('Value');
|
||||
$fixture->setAddress('Value');
|
||||
$fixture->setMail('Value');
|
||||
$fixture->setCompany('Value');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s/edit', $this->path, $fixture->getId()));
|
||||
|
||||
$this->client->submitForm('Update', [
|
||||
'employee[nickname]' => 'Something New',
|
||||
'employee[roles]' => 'Something New',
|
||||
'employee[password]' => 'Something New',
|
||||
'employee[firstName]' => 'Something New',
|
||||
'employee[lastName]' => 'Something New',
|
||||
'employee[tel]' => 'Something New',
|
||||
'employee[address]' => 'Something New',
|
||||
'employee[mail]' => 'Something New',
|
||||
'employee[company]' => 'Something New',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects('/employee/');
|
||||
|
||||
$fixture = $this->repository->findAll();
|
||||
|
||||
self::assertSame('Something New', $fixture[0]->getNickname());
|
||||
self::assertSame('Something New', $fixture[0]->getRoles());
|
||||
self::assertSame('Something New', $fixture[0]->getPassword());
|
||||
self::assertSame('Something New', $fixture[0]->getFirstName());
|
||||
self::assertSame('Something New', $fixture[0]->getLastName());
|
||||
self::assertSame('Something New', $fixture[0]->getTel());
|
||||
self::assertSame('Something New', $fixture[0]->getAddress());
|
||||
self::assertSame('Something New', $fixture[0]->getMail());
|
||||
self::assertSame('Something New', $fixture[0]->getCompany());
|
||||
}
|
||||
|
||||
public function testRemove(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new Employee();
|
||||
$fixture->setNickname('Value');
|
||||
$fixture->setRoles('Value');
|
||||
$fixture->setPassword('Value');
|
||||
$fixture->setFirstName('Value');
|
||||
$fixture->setLastName('Value');
|
||||
$fixture->setTel('Value');
|
||||
$fixture->setAddress('Value');
|
||||
$fixture->setMail('Value');
|
||||
$fixture->setCompany('Value');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
$this->client->submitForm('Delete');
|
||||
|
||||
self::assertResponseRedirects('/employee/');
|
||||
self::assertSame(0, $this->repository->count([]));
|
||||
}
|
||||
}
|
125
tests/Controller/FAQControllerTest.php
Normal file
125
tests/Controller/FAQControllerTest.php
Normal file
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Controller;
|
||||
|
||||
use App\Entity\FAQ;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
final class FAQControllerTest extends WebTestCase
|
||||
{
|
||||
private KernelBrowser $client;
|
||||
private EntityManagerInterface $manager;
|
||||
private EntityRepository $repository;
|
||||
private string $path = '/faq/';
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->client = static::createClient();
|
||||
$this->manager = static::getContainer()->get('doctrine')->getManager();
|
||||
$this->repository = $this->manager->getRepository(FAQ::class);
|
||||
|
||||
foreach ($this->repository->findAll() as $object) {
|
||||
$this->manager->remove($object);
|
||||
}
|
||||
|
||||
$this->manager->flush();
|
||||
}
|
||||
|
||||
public function testIndex(): void
|
||||
{
|
||||
$this->client->followRedirects();
|
||||
$crawler = $this->client->request('GET', $this->path);
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('FAQ index');
|
||||
|
||||
// Use the $crawler to perform additional assertions e.g.
|
||||
// self::assertSame('Some text on the page', $crawler->filter('.p')->first());
|
||||
}
|
||||
|
||||
public function testNew(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$this->client->request('GET', sprintf('%snew', $this->path));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
|
||||
$this->client->submitForm('Save', [
|
||||
'faq[question]' => 'Testing',
|
||||
'faq[answer]' => 'Testing',
|
||||
'faq[updateDate]' => 'Testing',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects($this->path);
|
||||
|
||||
self::assertSame(1, $this->repository->count([]));
|
||||
}
|
||||
|
||||
public function testShow(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new FAQ();
|
||||
$fixture->setQuestion('My Title');
|
||||
$fixture->setAnswer('My Title');
|
||||
$fixture->setUpdateDate('My Title');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('FAQ');
|
||||
|
||||
// Use assertions to check that the properties are properly displayed.
|
||||
}
|
||||
|
||||
public function testEdit(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new FAQ();
|
||||
$fixture->setQuestion('Value');
|
||||
$fixture->setAnswer('Value');
|
||||
$fixture->setUpdateDate('Value');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s/edit', $this->path, $fixture->getId()));
|
||||
|
||||
$this->client->submitForm('Update', [
|
||||
'faq[question]' => 'Something New',
|
||||
'faq[answer]' => 'Something New',
|
||||
'faq[updateDate]' => 'Something New',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects('/faq/');
|
||||
|
||||
$fixture = $this->repository->findAll();
|
||||
|
||||
self::assertSame('Something New', $fixture[0]->getQuestion());
|
||||
self::assertSame('Something New', $fixture[0]->getAnswer());
|
||||
self::assertSame('Something New', $fixture[0]->getUpdateDate());
|
||||
}
|
||||
|
||||
public function testRemove(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new FAQ();
|
||||
$fixture->setQuestion('Value');
|
||||
$fixture->setAnswer('Value');
|
||||
$fixture->setUpdateDate('Value');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
$this->client->submitForm('Delete');
|
||||
|
||||
self::assertResponseRedirects('/faq/');
|
||||
self::assertSame(0, $this->repository->count([]));
|
||||
}
|
||||
}
|
167
tests/Controller/InternControllerTest.php
Normal file
167
tests/Controller/InternControllerTest.php
Normal file
@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Controller;
|
||||
|
||||
use App\Entity\Intern;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
final class InternControllerTest extends WebTestCase
|
||||
{
|
||||
private KernelBrowser $client;
|
||||
private EntityManagerInterface $manager;
|
||||
private EntityRepository $repository;
|
||||
private string $path = '/intern/';
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->client = static::createClient();
|
||||
$this->manager = static::getContainer()->get('doctrine')->getManager();
|
||||
$this->repository = $this->manager->getRepository(Intern::class);
|
||||
|
||||
foreach ($this->repository->findAll() as $object) {
|
||||
$this->manager->remove($object);
|
||||
}
|
||||
|
||||
$this->manager->flush();
|
||||
}
|
||||
|
||||
public function testIndex(): void
|
||||
{
|
||||
$this->client->followRedirects();
|
||||
$crawler = $this->client->request('GET', $this->path);
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('Intern index');
|
||||
|
||||
// Use the $crawler to perform additional assertions e.g.
|
||||
// self::assertSame('Some text on the page', $crawler->filter('.p')->first());
|
||||
}
|
||||
|
||||
public function testNew(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$this->client->request('GET', sprintf('%snew', $this->path));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
|
||||
$this->client->submitForm('Save', [
|
||||
'intern[nickname]' => 'Testing',
|
||||
'intern[roles]' => 'Testing',
|
||||
'intern[password]' => 'Testing',
|
||||
'intern[firstName]' => 'Testing',
|
||||
'intern[lastName]' => 'Testing',
|
||||
'intern[tel]' => 'Testing',
|
||||
'intern[address]' => 'Testing',
|
||||
'intern[mail]' => 'Testing',
|
||||
'intern[coverLetter]' => 'Testing',
|
||||
'intern[resume]' => 'Testing',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects($this->path);
|
||||
|
||||
self::assertSame(1, $this->repository->count([]));
|
||||
}
|
||||
|
||||
public function testShow(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new Intern();
|
||||
$fixture->setNickname('My Title');
|
||||
$fixture->setRoles('My Title');
|
||||
$fixture->setPassword('My Title');
|
||||
$fixture->setFirstName('My Title');
|
||||
$fixture->setLastName('My Title');
|
||||
$fixture->setTel('My Title');
|
||||
$fixture->setAddress('My Title');
|
||||
$fixture->setMail('My Title');
|
||||
$fixture->setCoverLetter('My Title');
|
||||
$fixture->setResume('My Title');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('Intern');
|
||||
|
||||
// Use assertions to check that the properties are properly displayed.
|
||||
}
|
||||
|
||||
public function testEdit(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new Intern();
|
||||
$fixture->setNickname('Value');
|
||||
$fixture->setRoles('Value');
|
||||
$fixture->setPassword('Value');
|
||||
$fixture->setFirstName('Value');
|
||||
$fixture->setLastName('Value');
|
||||
$fixture->setTel('Value');
|
||||
$fixture->setAddress('Value');
|
||||
$fixture->setMail('Value');
|
||||
$fixture->setCoverLetter('Value');
|
||||
$fixture->setResume('Value');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s/edit', $this->path, $fixture->getId()));
|
||||
|
||||
$this->client->submitForm('Update', [
|
||||
'intern[nickname]' => 'Something New',
|
||||
'intern[roles]' => 'Something New',
|
||||
'intern[password]' => 'Something New',
|
||||
'intern[firstName]' => 'Something New',
|
||||
'intern[lastName]' => 'Something New',
|
||||
'intern[tel]' => 'Something New',
|
||||
'intern[address]' => 'Something New',
|
||||
'intern[mail]' => 'Something New',
|
||||
'intern[coverLetter]' => 'Something New',
|
||||
'intern[resume]' => 'Something New',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects('/intern/');
|
||||
|
||||
$fixture = $this->repository->findAll();
|
||||
|
||||
self::assertSame('Something New', $fixture[0]->getNickname());
|
||||
self::assertSame('Something New', $fixture[0]->getRoles());
|
||||
self::assertSame('Something New', $fixture[0]->getPassword());
|
||||
self::assertSame('Something New', $fixture[0]->getFirstName());
|
||||
self::assertSame('Something New', $fixture[0]->getLastName());
|
||||
self::assertSame('Something New', $fixture[0]->getTel());
|
||||
self::assertSame('Something New', $fixture[0]->getAddress());
|
||||
self::assertSame('Something New', $fixture[0]->getMail());
|
||||
self::assertSame('Something New', $fixture[0]->getCoverLetter());
|
||||
self::assertSame('Something New', $fixture[0]->getResume());
|
||||
}
|
||||
|
||||
public function testRemove(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new Intern();
|
||||
$fixture->setNickname('Value');
|
||||
$fixture->setRoles('Value');
|
||||
$fixture->setPassword('Value');
|
||||
$fixture->setFirstName('Value');
|
||||
$fixture->setLastName('Value');
|
||||
$fixture->setTel('Value');
|
||||
$fixture->setAddress('Value');
|
||||
$fixture->setMail('Value');
|
||||
$fixture->setCoverLetter('Value');
|
||||
$fixture->setResume('Value');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
$this->client->submitForm('Delete');
|
||||
|
||||
self::assertResponseRedirects('/intern/');
|
||||
self::assertSame(0, $this->repository->count([]));
|
||||
}
|
||||
}
|
131
tests/Controller/MessageControllerTest.php
Normal file
131
tests/Controller/MessageControllerTest.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Controller;
|
||||
|
||||
use App\Entity\Message;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
final class MessageControllerTest extends WebTestCase
|
||||
{
|
||||
private KernelBrowser $client;
|
||||
private EntityManagerInterface $manager;
|
||||
private EntityRepository $repository;
|
||||
private string $path = '/message/';
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->client = static::createClient();
|
||||
$this->manager = static::getContainer()->get('doctrine')->getManager();
|
||||
$this->repository = $this->manager->getRepository(Message::class);
|
||||
|
||||
foreach ($this->repository->findAll() as $object) {
|
||||
$this->manager->remove($object);
|
||||
}
|
||||
|
||||
$this->manager->flush();
|
||||
}
|
||||
|
||||
public function testIndex(): void
|
||||
{
|
||||
$this->client->followRedirects();
|
||||
$crawler = $this->client->request('GET', $this->path);
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('Message index');
|
||||
|
||||
// Use the $crawler to perform additional assertions e.g.
|
||||
// self::assertSame('Some text on the page', $crawler->filter('.p')->first());
|
||||
}
|
||||
|
||||
public function testNew(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$this->client->request('GET', sprintf('%snew', $this->path));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
|
||||
$this->client->submitForm('Save', [
|
||||
'message[content]' => 'Testing',
|
||||
'message[sendingDate]' => 'Testing',
|
||||
'message[sender]' => 'Testing',
|
||||
'message[receiver]' => 'Testing',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects($this->path);
|
||||
|
||||
self::assertSame(1, $this->repository->count([]));
|
||||
}
|
||||
|
||||
public function testShow(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new Message();
|
||||
$fixture->setContent('My Title');
|
||||
$fixture->setSendingDate('My Title');
|
||||
$fixture->setSender('My Title');
|
||||
$fixture->setReceiver('My Title');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('Message');
|
||||
|
||||
// Use assertions to check that the properties are properly displayed.
|
||||
}
|
||||
|
||||
public function testEdit(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new Message();
|
||||
$fixture->setContent('Value');
|
||||
$fixture->setSendingDate('Value');
|
||||
$fixture->setSender('Value');
|
||||
$fixture->setReceiver('Value');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s/edit', $this->path, $fixture->getId()));
|
||||
|
||||
$this->client->submitForm('Update', [
|
||||
'message[content]' => 'Something New',
|
||||
'message[sendingDate]' => 'Something New',
|
||||
'message[sender]' => 'Something New',
|
||||
'message[receiver]' => 'Something New',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects('/message/');
|
||||
|
||||
$fixture = $this->repository->findAll();
|
||||
|
||||
self::assertSame('Something New', $fixture[0]->getContent());
|
||||
self::assertSame('Something New', $fixture[0]->getSendingDate());
|
||||
self::assertSame('Something New', $fixture[0]->getSender());
|
||||
self::assertSame('Something New', $fixture[0]->getReceiver());
|
||||
}
|
||||
|
||||
public function testRemove(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new Message();
|
||||
$fixture->setContent('Value');
|
||||
$fixture->setSendingDate('Value');
|
||||
$fixture->setSender('Value');
|
||||
$fixture->setReceiver('Value');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
$this->client->submitForm('Delete');
|
||||
|
||||
self::assertResponseRedirects('/message/');
|
||||
self::assertSame(0, $this->repository->count([]));
|
||||
}
|
||||
}
|
113
tests/Controller/SkillControllerTest.php
Normal file
113
tests/Controller/SkillControllerTest.php
Normal file
@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Controller;
|
||||
|
||||
use App\Entity\Skill;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
final class SkillControllerTest extends WebTestCase
|
||||
{
|
||||
private KernelBrowser $client;
|
||||
private EntityManagerInterface $manager;
|
||||
private EntityRepository $repository;
|
||||
private string $path = '/skill/';
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->client = static::createClient();
|
||||
$this->manager = static::getContainer()->get('doctrine')->getManager();
|
||||
$this->repository = $this->manager->getRepository(Skill::class);
|
||||
|
||||
foreach ($this->repository->findAll() as $object) {
|
||||
$this->manager->remove($object);
|
||||
}
|
||||
|
||||
$this->manager->flush();
|
||||
}
|
||||
|
||||
public function testIndex(): void
|
||||
{
|
||||
$this->client->followRedirects();
|
||||
$crawler = $this->client->request('GET', $this->path);
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('Skill index');
|
||||
|
||||
// Use the $crawler to perform additional assertions e.g.
|
||||
// self::assertSame('Some text on the page', $crawler->filter('.p')->first());
|
||||
}
|
||||
|
||||
public function testNew(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$this->client->request('GET', sprintf('%snew', $this->path));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
|
||||
$this->client->submitForm('Save', [
|
||||
'skill[label]' => 'Testing',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects($this->path);
|
||||
|
||||
self::assertSame(1, $this->repository->count([]));
|
||||
}
|
||||
|
||||
public function testShow(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new Skill();
|
||||
$fixture->setLabel('My Title');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('Skill');
|
||||
|
||||
// Use assertions to check that the properties are properly displayed.
|
||||
}
|
||||
|
||||
public function testEdit(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new Skill();
|
||||
$fixture->setLabel('Value');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s/edit', $this->path, $fixture->getId()));
|
||||
|
||||
$this->client->submitForm('Update', [
|
||||
'skill[label]' => 'Something New',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects('/skill/');
|
||||
|
||||
$fixture = $this->repository->findAll();
|
||||
|
||||
self::assertSame('Something New', $fixture[0]->getLabel());
|
||||
}
|
||||
|
||||
public function testRemove(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new Skill();
|
||||
$fixture->setLabel('Value');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
$this->client->submitForm('Delete');
|
||||
|
||||
self::assertResponseRedirects('/skill/');
|
||||
self::assertSame(0, $this->repository->count([]));
|
||||
}
|
||||
}
|
155
tests/Controller/UserAppControllerTest.php
Normal file
155
tests/Controller/UserAppControllerTest.php
Normal file
@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Controller;
|
||||
|
||||
use App\Entity\UserApp;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
final class UserAppControllerTest extends WebTestCase
|
||||
{
|
||||
private KernelBrowser $client;
|
||||
private EntityManagerInterface $manager;
|
||||
private EntityRepository $repository;
|
||||
private string $path = '/user/app/';
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->client = static::createClient();
|
||||
$this->manager = static::getContainer()->get('doctrine')->getManager();
|
||||
$this->repository = $this->manager->getRepository(UserApp::class);
|
||||
|
||||
foreach ($this->repository->findAll() as $object) {
|
||||
$this->manager->remove($object);
|
||||
}
|
||||
|
||||
$this->manager->flush();
|
||||
}
|
||||
|
||||
public function testIndex(): void
|
||||
{
|
||||
$this->client->followRedirects();
|
||||
$crawler = $this->client->request('GET', $this->path);
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('UserApp index');
|
||||
|
||||
// Use the $crawler to perform additional assertions e.g.
|
||||
// self::assertSame('Some text on the page', $crawler->filter('.p')->first());
|
||||
}
|
||||
|
||||
public function testNew(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$this->client->request('GET', sprintf('%snew', $this->path));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
|
||||
$this->client->submitForm('Save', [
|
||||
'user_app[nickname]' => 'Testing',
|
||||
'user_app[roles]' => 'Testing',
|
||||
'user_app[password]' => 'Testing',
|
||||
'user_app[firstName]' => 'Testing',
|
||||
'user_app[lastName]' => 'Testing',
|
||||
'user_app[tel]' => 'Testing',
|
||||
'user_app[address]' => 'Testing',
|
||||
'user_app[mail]' => 'Testing',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects($this->path);
|
||||
|
||||
self::assertSame(1, $this->repository->count([]));
|
||||
}
|
||||
|
||||
public function testShow(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new UserApp();
|
||||
$fixture->setNickname('My Title');
|
||||
$fixture->setRoles('My Title');
|
||||
$fixture->setPassword('My Title');
|
||||
$fixture->setFirstName('My Title');
|
||||
$fixture->setLastName('My Title');
|
||||
$fixture->setTel('My Title');
|
||||
$fixture->setAddress('My Title');
|
||||
$fixture->setMail('My Title');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('UserApp');
|
||||
|
||||
// Use assertions to check that the properties are properly displayed.
|
||||
}
|
||||
|
||||
public function testEdit(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new UserApp();
|
||||
$fixture->setNickname('Value');
|
||||
$fixture->setRoles('Value');
|
||||
$fixture->setPassword('Value');
|
||||
$fixture->setFirstName('Value');
|
||||
$fixture->setLastName('Value');
|
||||
$fixture->setTel('Value');
|
||||
$fixture->setAddress('Value');
|
||||
$fixture->setMail('Value');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s/edit', $this->path, $fixture->getId()));
|
||||
|
||||
$this->client->submitForm('Update', [
|
||||
'user_app[nickname]' => 'Something New',
|
||||
'user_app[roles]' => 'Something New',
|
||||
'user_app[password]' => 'Something New',
|
||||
'user_app[firstName]' => 'Something New',
|
||||
'user_app[lastName]' => 'Something New',
|
||||
'user_app[tel]' => 'Something New',
|
||||
'user_app[address]' => 'Something New',
|
||||
'user_app[mail]' => 'Something New',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects('/user/app/');
|
||||
|
||||
$fixture = $this->repository->findAll();
|
||||
|
||||
self::assertSame('Something New', $fixture[0]->getNickname());
|
||||
self::assertSame('Something New', $fixture[0]->getRoles());
|
||||
self::assertSame('Something New', $fixture[0]->getPassword());
|
||||
self::assertSame('Something New', $fixture[0]->getFirstName());
|
||||
self::assertSame('Something New', $fixture[0]->getLastName());
|
||||
self::assertSame('Something New', $fixture[0]->getTel());
|
||||
self::assertSame('Something New', $fixture[0]->getAddress());
|
||||
self::assertSame('Something New', $fixture[0]->getMail());
|
||||
}
|
||||
|
||||
public function testRemove(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new UserApp();
|
||||
$fixture->setNickname('Value');
|
||||
$fixture->setRoles('Value');
|
||||
$fixture->setPassword('Value');
|
||||
$fixture->setFirstName('Value');
|
||||
$fixture->setLastName('Value');
|
||||
$fixture->setTel('Value');
|
||||
$fixture->setAddress('Value');
|
||||
$fixture->setMail('Value');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
$this->client->submitForm('Delete');
|
||||
|
||||
self::assertResponseRedirects('/user/app/');
|
||||
self::assertSame(0, $this->repository->count([]));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user