Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update 2 reporting services #14

Merged
merged 3 commits into from
Jan 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Resources/Config/Services/gateways/event_occurrence_staff.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<container xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://symfony.com/schema/dic/services" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="openclassrooms.frontdesk.gateways.event_occurrence_staff" class="OpenClassrooms\FrontDesk\Repository\EventOccurrenceStaffRepository" parent="openclassrooms.front_desk.gateways.base_repository"/>
</services>
</container>
5 changes: 5 additions & 0 deletions Resources/Config/Services/gateways/staff_member.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<container xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://symfony.com/schema/dic/services" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="openclassrooms.frontdesk.gateways.staff_member" class="OpenClassrooms\FrontDesk\Repository\StaffMemberRepository" parent="openclassrooms.front_desk.gateways.base_repository"/>
</services>
</container>
9 changes: 9 additions & 0 deletions Resources/Config/Services/services/event_occurrence_staff.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<container xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://symfony.com/schema/dic/services" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="openclassrooms.frontdesk.service.event_occurrence_staff" class="OpenClassrooms\FrontDesk\Services\Impl\EventOccurrenceStaffServiceImpl">
<call method="setEventOccurrenceStaffGateway">
<argument type="service" id="openclassrooms.frontdesk.gateways.event_occurrence_staff"/>
</call>
</service>
</services>
</container>
9 changes: 9 additions & 0 deletions Resources/Config/Services/services/staff_member.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<container xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://symfony.com/schema/dic/services" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="openclassrooms.frontdesk.service.staff_member" class="OpenClassrooms\FrontDesk\Services\Impl\StaffMemberServiceImpl">
<call method="setStaffMemberGateway">
<argument type="service" id="openclassrooms.frontdesk.gateways.staff_member"/>
</call>
</service>
</services>
</container>
4 changes: 4 additions & 0 deletions Resources/Config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
<import resource="Services/models/plan.xml"/>
<import resource="Services/models/visit.xml"/>
<import resource="Services/gateways/enrollment.xml"/>
<import resource="Services/gateways/event_occurrence_staff.xml"/>
<import resource="Services/gateways/pack.xml"/>
<import resource="Services/gateways/person.xml"/>
<import resource="Services/gateways/plan.xml"/>
<import resource="Services/gateways/staff_member.xml"/>
<import resource="Services/gateways/visit.xml"/>
<import resource="Services/services/enrollment.xml"/>
<import resource="Services/services/event_occurrence_staff.xml"/>
<import resource="Services/services/pack.xml"/>
<import resource="Services/services/person.xml"/>
<import resource="Services/services/plan.xml"/>
<import resource="Services/services/staff_member.xml"/>
<import resource="Services/services/visit.xml"/>
</imports>

Expand Down
52 changes: 40 additions & 12 deletions Tests/DependencyInjection/OpenClassroomsFrontDeskExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
namespace OpenClassrooms\Bundle\FrontDeskBundle\Tests\DependencyInjection;

use OpenClassrooms\Bundle\FrontDeskBundle\OpenClassroomsFrontDeskBundle;
use OpenClassrooms\FrontDesk\Services\EnrollmentService;
use OpenClassrooms\FrontDesk\Services\EventOccurrenceStaffService;
use OpenClassrooms\FrontDesk\Services\PackService;
use OpenClassrooms\FrontDesk\Services\PersonService;
use OpenClassrooms\FrontDesk\Services\PlanService;
use OpenClassrooms\FrontDesk\Services\StaffMemberService;
use OpenClassrooms\FrontDesk\Services\VisitService;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
Expand Down Expand Up @@ -62,58 +69,79 @@ public function WithoutApiKeyConfiguration_ThrowException()
/**
* @test
*/
public function EnrollmentServiceReturnEnrollment()
public function CallEnrollmentService_ReturnEnrollmentServiceInstance()
{
$this->configLoader->load('config.yml');
$this->container->compile();
$enrollmentService = $this->container->get('openclassrooms.frontdesk.service.enrollment');
$this->assertInstanceOf('OpenClassrooms\FrontDesk\Services\Impl\EnrollmentServiceImpl', $enrollmentService);
$this->assertInstanceOf(EnrollmentService::class, $enrollmentService);
}

/**
* @test
*/
public function PersonServiceReturnPerson()
public function CallEventOccurrenceStaffService_ReturnEventOccurrenceStaffServiceInstance()
{
$this->configLoader->load('config.yml');
$this->container->compile();
$personService = $this->container->get('openclassrooms.frontdesk.service.person');
$this->assertInstanceOf('OpenClassrooms\FrontDesk\Services\Impl\PersonServiceImpl', $personService);
$eventOccurrenceStaff = $this->container->get('openclassrooms.frontdesk.service.event_occurrence_staff');
$this->assertInstanceOf(EventOccurrenceStaffService::class, $eventOccurrenceStaff);
}

/**
* @test
*/
public function PackServiceReturnPack()
public function CallPackService_ReturnPackServiceInstance()
{
$this->configLoader->load('config.yml');
$this->container->compile();
$packService = $this->container->get('openclassrooms.frontdesk.service.pack');
$this->assertInstanceOf('OpenClassrooms\FrontDesk\Services\Impl\PackServiceImpl', $packService);
$this->assertInstanceOf(PackService::class, $packService);
}

/**
* @test
*/
public function CallPersonService_ReturnPersonServiceInstance()
{
$this->configLoader->load('config.yml');
$this->container->compile();
$personService = $this->container->get('openclassrooms.frontdesk.service.person');
$this->assertInstanceOf(PersonService::class, $personService);
}

/**
* @test
*/
public function PlanServiceReturnPack()
public function CallPlanService_ReturnPackServiceInstance()
{
$this->configLoader->load('config.yml');
$this->container->compile();
$planService = $this->container->get('openclassrooms.frontdesk.service.plan');
$this->assertInstanceOf('OpenClassrooms\FrontDesk\Services\Impl\PlanServiceImpl', $planService);
$this->assertInstanceOf(PlanService::class, $planService);
}

/**
* @test
*/
public function VisitServiceReturnPack()
public function CallStaffMemberService_ReturnStaffMemberServiceInstance()
{
$this->configLoader->load('config.yml');
$this->container->compile();
$visitService = $this->container->get('openclassrooms.frontdesk.service.visit');
$this->assertInstanceOf('OpenClassrooms\FrontDesk\Services\Impl\VisitServiceImpl', $visitService);
$staffMember = $this->container->get('openclassrooms.frontdesk.service.staff_member');
$this->assertInstanceOf(StaffMemberService::class, $staffMember);
}

/**
* @test
*/
public function CallVisitService_ReturnVisitServiceInstance()
{
$this->configLoader->load('config.yml');
$this->container->compile();
$visitService = $this->container->get('openclassrooms.frontdesk.service.visit');
$this->assertInstanceOf(VisitService::class, $visitService);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name of all your tests doesn't correspond to what your tests does. here the result of your test is more when you call visit service key you should get instance of a visit service class.
I let you find a correct name for this test, don't forget to change the other test names ;)

}

protected function setUp()
{
Expand Down