diff --git a/migrations/Version20241114132304.php b/migrations/Version20241114132304.php new file mode 100644 index 0000000..e87512c --- /dev/null +++ b/migrations/Version20241114132304.php @@ -0,0 +1,110 @@ +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'); + } +} diff --git a/migrations/Version20241121135116.php b/migrations/Version20241121135116.php new file mode 100644 index 0000000..c932e51 --- /dev/null +++ b/migrations/Version20241121135116.php @@ -0,0 +1,32 @@ +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'); + } +} diff --git a/migrations/Version20241121140219.php b/migrations/Version20241121140219.php new file mode 100644 index 0000000..28107a4 --- /dev/null +++ b/migrations/Version20241121140219.php @@ -0,0 +1,38 @@ +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)'); + } +} diff --git a/templates/announcement/add.html.twig b/templates/announcement/add.html.twig index 6171d29..73233c7 100644 --- a/templates/announcement/add.html.twig +++ b/templates/announcement/add.html.twig @@ -1,14 +1,4 @@ {% extends 'base.html.twig' %} - -{% block title %}Hello AnnouncementController!{% endblock %} - {% block body %} - - - {{ form(announcementForm) }} - - + {{ form(announcementForm) }} {% endblock %} \ No newline at end of file diff --git a/templates/announcement/list.html.twig b/templates/announcement/list.html.twig index d1d3c02..50912d2 100644 --- a/templates/announcement/list.html.twig +++ b/templates/announcement/list.html.twig @@ -13,8 +13,9 @@

{{ ann.title }}

{{ ann.company.name }}

{{ ann.description }}

+ ------------------------------ -

{{ ann.creationDate }}

+

{{ ann.creationDate|format("d-m-y") }}

{% endfor %} diff --git a/templates/base.html.twig b/templates/base.html.twig index ff7d2bf..80c70db 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -3,7 +3,7 @@ - {% block title %}Job Portal{% endblock %} + {% block title %}Hegreshere{% endblock %} {# Tailwind CSS CDN #} @@ -41,7 +41,8 @@ {# Block for the specific page content #}
- {% block content %}{% endblock %} + {% block body %} + {% endblock %}
diff --git a/templates/index/index.html.twig b/templates/index/index.html.twig index 9862b31..a5a2a55 100644 --- a/templates/index/index.html.twig +++ b/templates/index/index.html.twig @@ -2,7 +2,7 @@ {% block title %}Accueil - Job Portal{% endblock %} -{% block content %} +{% block body %}

Trouvez votre stage de rêve !

diff --git a/templates/security/login.html.twig b/templates/security/login.html.twig index f711f6f..fb7733c 100644 --- a/templates/security/login.html.twig +++ b/templates/security/login.html.twig @@ -3,39 +3,59 @@ {% block title %}Connexion{% endblock %} {% block body %} -
- {% if error %} -
{{ error.messageKey|trans(error.messageData, 'security') }}
- {% endif %} +
+
+

Connexion

+

+ Pas encore inscrit ? Inscrivez vous !!
+ En tant que Stagiaire +
+ En tant qu'Entreprise +

- {% if app.user %} -
- You are logged in as {{ app.user.userIdentifier }}, Logout -
- {% endif %} + + {# Affiche une erreur si la connexion échoue #} + {% if error %} +
+ {{ error.messageKey|trans(error.messageData, 'security') }} +
+ {% endif %} -

Connexion à votre compte

- - - - + {# Affiche un message si l'utilisateur est déjà connecté #} + {% if app.user %} +
+ Vous êtes connecté en tant que {{ app.user.userIdentifier }}. + Déconnexion +
+ {% endif %} - + {# Champ pour le nom d'utilisateur #} +
+ + +
- {# - 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 + {# Champ pour le mot de passe #} +
+ + +
-
- - -
- #} + {# Jeton CSRF pour protéger le formulaire #} + - - + {# Bouton de soumission #} +
+ +
+ +
+
{% endblock %} diff --git a/tests/Controller/EmployeeControllerTest.php b/tests/Controller/EmployeeControllerTest.php new file mode 100644 index 0000000..226d00d --- /dev/null +++ b/tests/Controller/EmployeeControllerTest.php @@ -0,0 +1,161 @@ +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([])); + } +} diff --git a/tests/Controller/FAQControllerTest.php b/tests/Controller/FAQControllerTest.php new file mode 100644 index 0000000..9b2f631 --- /dev/null +++ b/tests/Controller/FAQControllerTest.php @@ -0,0 +1,125 @@ +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([])); + } +} diff --git a/tests/Controller/InternControllerTest.php b/tests/Controller/InternControllerTest.php new file mode 100644 index 0000000..c0d89ea --- /dev/null +++ b/tests/Controller/InternControllerTest.php @@ -0,0 +1,167 @@ +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([])); + } +} diff --git a/tests/Controller/MessageControllerTest.php b/tests/Controller/MessageControllerTest.php new file mode 100644 index 0000000..2b69ae3 --- /dev/null +++ b/tests/Controller/MessageControllerTest.php @@ -0,0 +1,131 @@ +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([])); + } +} diff --git a/tests/Controller/SkillControllerTest.php b/tests/Controller/SkillControllerTest.php new file mode 100644 index 0000000..5e92576 --- /dev/null +++ b/tests/Controller/SkillControllerTest.php @@ -0,0 +1,113 @@ +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([])); + } +} diff --git a/tests/Controller/UserAppControllerTest.php b/tests/Controller/UserAppControllerTest.php new file mode 100644 index 0000000..768115f --- /dev/null +++ b/tests/Controller/UserAppControllerTest.php @@ -0,0 +1,155 @@ +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([])); + } +}