Ver Fonte

add unit tests on domain models

Olivier Massot há 5 anos atrás
pai
commit
7645b4746d

+ 75 - 0
ot_core/Tests/Unit/Domain/Model/DonorTest.php

@@ -0,0 +1,75 @@
+<?php
+
+namespace Opentalent\OtCore\Tests\Unit\Domain;
+
+use AssertionError;
+use Nimut\TestingFramework\TestCase\UnitTestCase;
+use Opentalent\OtCore\Domain\Model\Donor;
+
+class DonorTest extends UnitTestCase
+{
+    /**
+     * Object should instantiate correctly, and properties
+     * set with setters should be retrieved by getters
+     *
+     * @test
+     */
+    public function instantiation() {
+        $donor = new Donor();
+
+        $donor->setId(1);
+        $donor->setOrganizationId(2);
+        $donor->setName('name');
+        $donor->setEmail('mail@domain.com');
+        $donor->setTelphone('000000');
+        $donor->setWebsite('www.site.org');
+        $donor->setWording('abcd');
+        $donor->setDisplayedOn('efgh');
+        $donor->setLogo('logo.svg');
+
+        $this->assertEquals($donor->getId(), 1);
+        $this->assertEquals($donor->getOrganizationId(), 2);
+        $this->assertEquals($donor->getName(), 'name');
+        $this->assertEquals($donor->getEmail(), 'mail@domain.com');
+        $this->assertEquals($donor->getTelphone(), '000000');
+        $this->assertEquals($donor->getWebsite(), 'www.site.org');
+        $this->assertEquals($donor->getWording(), 'abcd');
+        $this->assertEquals($donor->getDisplayedOn(), 'efgh');
+        $this->assertEquals($donor->getLogo(), 'logo.svg');
+    }
+
+    /**
+     * Nullable fields should be able to be set to null,
+     * while non nullable shall raise an exception if set to null
+     *
+     * @test
+     */
+    public function nullableOrNot() {
+
+        $donor = new Donor();
+
+        // non-nullable properties
+        try {
+            $donor->setId(null);
+            throw new AssertionError('Donor::setId should not accept a null value');
+        } catch (\TypeError $e) {}
+        try {
+            $donor->setOrganizationId(null);
+            throw new AssertionError('Donor::setOrganizationId should not accept a null value');
+        } catch (\TypeError $e) {}
+
+        // nullable properties
+        $donor->setName(null);
+        $donor->setEmail(null);
+        $donor->setTelphone(null);
+        $donor->setWebsite(null);
+        $donor->setWording(null);
+        $donor->setDisplayedOn(null);
+        $donor->setLogo(null);
+
+        // Just to avoid this test to be considered as risky
+        $this->assertEquals(1, 1);
+    }
+
+
+}

+ 430 - 0
ot_core/Tests/Unit/Domain/Model/EventTest.php

@@ -0,0 +1,430 @@
+<?php
+
+namespace Opentalent\OtCore\Tests\Unit\Domain;
+
+use AssertionError;
+use Nimut\TestingFramework\TestCase\UnitTestCase;
+use Opentalent\OtCore\Domain\Model\Event;
+use Opentalent\OtCore\Domain\Model\Organization;
+
+class EventTest extends UnitTestCase
+{
+    /**
+     * Object should instantiate correctly, and properties
+     * set with setters should be retrieved by getters
+     *
+     * @test
+     */
+    public function canInstantiate() {
+        $event = new Event();
+
+        $event->setId(1);
+        $event->setType('PortailEvent');
+        $event->setOrganizationId(2);
+        $event->setSubdomain('subdomain');
+        $event->setName('name');
+        $event->setDescription('description');
+        $event->setCategories(['categorie']);
+        $event->setUrl('www.url.com');
+        $event->setRule('rule');
+        $event->setDatetimeStart(new \DateTime('2021-01-01'));
+        $event->setDatetimeEnd(new \DateTime('2121-01-01'));
+        $event->setDates('dates');
+        $event->setPlacename('placename');
+        $event->setPlaceDescription('place description');
+        $event->setPlaceFloorSize('floor size');
+        $event->setPlaceCapacity('place capacity');
+        $event->setCity('casablanca');
+        $event->setPostalCode('00000');
+        $event->setStreetAddress('adress');
+        $event->setLongitude(1.23456);
+        $event->setLatitude(1.23456);
+        $event->setRoomName('room');
+        $event->setRoomDescription('room description');
+        $event->setRoomLocalisation('room localization');
+        $event->setRoomCapacity('room capacity');
+        $event->setRoomFloorSize('room floorsize');
+        $event->setZupId(3);
+        $event->setDeepLink('deeplink');
+        $event->setImage('logo.svg');
+        $event->setPriceMini(10.50);
+        $event->setMeetingSchedule(['meeting']);
+        $event->setApi(true);
+        $event->setParentName('parent');
+        $event->setParentSubdomain('parent.org');
+
+        $organization = new Organization();
+        $event->setOrganization($organization);
+
+        $this->assertEquals($event->getId(), 1);
+        $this->assertEquals($event->getType(), 'PortailEvent');
+        $this->assertEquals($event->getOrganizationId(), 2);
+        $this->assertEquals($event->getSubdomain(), 'subdomain');
+        $this->assertEquals($event->getName(), 'name');
+        $this->assertEquals($event->getDescription(), 'description');
+        $this->assertEquals($event->getCategories(), ['categorie']);
+        $this->assertEquals($event->getUrl(), 'www.url.com');
+        $this->assertEquals($event->getRule(), 'rule');
+        $this->assertEquals($event->getDatetimeStart(), new \DateTime('2021-01-01'));
+        $this->assertEquals($event->getDatetimeEnd(), new \DateTime('2121-01-01'));
+        $this->assertEquals($event->getDates(), 'dates');
+        $this->assertEquals($event->getPlacename(), 'placename');
+        $this->assertEquals($event->getPlaceDescription(), 'place description');
+        $this->assertEquals($event->getPlaceFloorSize(), 'floor size');
+        $this->assertEquals($event->getPlaceCapacity(), 'place capacity');
+        $this->assertEquals($event->getCity(), 'casablanca');
+        $this->assertEquals($event->getPostalCode(), '00000');
+        $this->assertEquals($event->getStreetAddress(), 'adress');
+        $this->assertEquals($event->getLongitude(), 1.23456);
+        $this->assertEquals($event->getLatitude(), 1.23456);
+        $this->assertEquals($event->getRoomName(), 'room');
+        $this->assertEquals($event->getRoomDescription(), 'room description');
+        $this->assertEquals($event->getRoomLocalisation(), 'room localization');
+        $this->assertEquals($event->getRoomCapacity(), 'room capacity');
+        $this->assertEquals($event->getRoomFloorSize(), 'room floorsize');
+        $this->assertEquals($event->getZupId(), 3);
+        $this->assertEquals($event->getDeepLink(), 'deeplink');
+        $this->assertEquals($event->getImage(), 'logo.svg');
+        $this->assertEquals($event->getPriceMini(), 10.50);
+        $this->assertEquals($event->getMeetingSchedule(), ['meeting']);
+        $this->assertEquals($event->getApi(), true);
+        $this->assertEquals($event->isApi(), true);
+        $this->assertEquals($event->getParentName(), 'parent');
+        $this->assertEquals($event->getParentSubdomain(), 'parent.org');
+        $this->assertEquals($event->getOrganization(), $organization);
+    }
+
+    /**
+     * Nullable fields should be able to be set to null,
+     * while non nullable shall raise an exception if set to null
+     *
+     * @test
+     */
+    public function nullableOrNot() {
+
+        $event = new Event();
+
+        // non-nullable properties
+        try {
+            $event->setId(null);
+            throw new AssertionError('Event::setId should not accept a null value');
+        } catch (\TypeError $e) {}
+        try {
+            $event->setOrganizationId(null);
+            throw new AssertionError('Event::setOrganizationId should not accept a null value');
+        } catch (\TypeError $e) {}
+
+        // nullable properties
+        $event->setType(null);
+        $event->setSubdomain(null);
+        $event->setName(null);
+        $event->setDescription(null);
+        $event->setCategories(null);
+        $event->setUrl(null);
+        $event->setRule(null);
+        $event->setDatetimeStart(null);
+        $event->setDatetimeEnd(null);
+        $event->setDates(null);
+        $event->setPlacename(null);
+        $event->setPlaceDescription(null);
+        $event->setPlaceFloorSize(null);
+        $event->setPlaceCapacity(null);
+        $event->setCity(null);
+        $event->setPostalCode(null);
+        $event->setStreetAddress(null);
+        $event->setLongitude(null);
+        $event->setLatitude(null);
+        $event->setRoomName(null);
+        $event->setRoomDescription(null);
+        $event->setRoomLocalisation(null);
+        $event->setRoomCapacity(null);
+        $event->setRoomFloorSize(null);
+        $event->setZupId(null);
+        $event->setDeepLink(null);
+        $event->setImage(null);
+        $event->setPriceMini(null);
+        $event->setMeetingSchedule(null);
+        $event->setApi(null);
+        $event->setParentName(null);
+        $event->setParentSubdomain(null);
+
+        // Just to avoid this test to be considered as risky
+        $this->assertEquals(1, 1);
+    }
+
+    /**
+     * getFormattedDates() should format a correct sentence when
+     * the start date and the end date are on two different days
+     *
+     * @test
+     */
+    public function getFormattedDatesOnDifferentDays()
+    {
+        $event = new Event();
+        $event->setDatetimeStart(new \DateTime('2021-01-01 09:00'));
+        $event->setDatetimeEnd(new \DateTime('2021-01-31 18:00'));
+        $this->assertEquals("Du 01/01/2021 09h00 au 31/01/2021 18h00", $event->getFormattedDates());
+    }
+
+    /**
+     * getFormattedDates should format a correct sentence when
+     * the start date and the end date are on the same day
+     *
+     * @test
+     */
+    public function getFormattedDatesOnSameDay()
+    {
+        $event = new Event();
+        $event->setDatetimeStart(new \DateTime('2021-01-01 09:00'));
+        $event->setDatetimeEnd(new \DateTime('2021-01-01 18:00'));
+        $this->assertEquals("Le 01/01/2021 de 09h00 à 18h00", $event->getFormattedDates());
+    }
+
+    /**
+     * getFormattedDates should format a correct sentence when
+     * no end date has been provided
+     *
+     * @test
+     */
+    public function getFormattedDatesWithStartDateOnly()
+    {
+        $event = new Event();
+        $event->setDatetimeStart(new \DateTime('2021-01-01 09:00'));
+        $this->assertEquals("A partir du 01/01/2021 09h00", $event->getFormattedDates());
+    }
+
+    /**
+     * getFormattedDates should format a correct sentence when
+     * no start date has been provided
+     *
+     * @test
+     */
+    public function getFormattedDatesWithEndDateOnly()
+    {
+        $event = new Event();
+        $event->setDatetimeEnd(new \DateTime('2021-01-31 18:00'));
+        $this->assertEquals("Jusqu'au 31/01/2021 18h00", $event->getFormattedDates());
+    }
+
+    /**
+     * getFormattedDates should return an empty sentence when
+     * no date has been provided
+     *
+     * @test
+     */
+    public function getFormattedDatesWithNoDates()
+    {
+        $event = new Event();
+        $this->assertEquals("", $event->getFormattedDates());
+    }
+
+    /**
+     * getLocAndDate should return the placename, city and the formatted dates
+     * of the events, regarding which informations are available
+     *
+     * @test
+     */
+    public function getLocAndDateWithFullInformations() {
+        $event = new Event();
+        $event->setPlacename("Place");
+        $event->setCity("City");
+        $event->setDatetimeStart(new \DateTime('2021-01-01 09:00'));
+        $event->setDatetimeEnd(new \DateTime('2021-01-01 18:00'));
+        $this->assertEquals("Place (City), le 01/01/2021 de 09h00 à 18h00", $event->getLocAndDate());
+    }
+
+    /**
+     * getLocAndDate should return the placename, city and the formatted dates
+     * of the events, regarding which informations are available
+     *
+     * @test
+     */
+    public function getLocAndDateWithPlaceAndCity() {
+        $event = new Event();
+        $event->setPlacename("Place");
+        $event->setCity("City");
+        $this->assertEquals("Place (City)", $event->getLocAndDate());
+    }
+
+    /**
+     * getLocAndDate should return the placename, city and the formatted dates
+     * of the events, regarding which informations are available
+     *
+     * @test
+     */
+    public function getLocAndDateWithOnlyPlace() {
+        $event = new Event();
+        $event->setPlacename("Place");
+        $this->assertEquals("Place", $event->getLocAndDate());
+    }
+
+    /**
+     * getLocAndDate should return the placename, city and the formatted dates
+     * of the events, regarding which informations are available
+     *
+     * @test
+     */
+    public function getLocAndDateWithOnlyCity() {
+        $event = new Event();
+        $event->setCity("City");
+        $this->assertEquals("City", $event->getLocAndDate());
+    }
+
+    /**
+     * getFullAdress should return a concateneted address of the event,
+     * regarding which informations are available
+     *
+     * @test
+     */
+    public function getFullAddress() {
+        $event = new Event();
+        $event->setPlacename("Place");
+        $event->setRoomName("room");
+        $event->setRoomLocalisation("loc");
+        $event->setStreetAddress("street");
+        $event->setCity("City");
+        $event->setPostalCode("00000");
+
+        $this->assertEquals(
+            "Place\nroom\nloc\nstreet\n00000 City",
+            $event->getFullAddress()
+        );
+    }
+
+    /**
+     * getInfosTable should return an array holding the informations of the event,
+     * regarding which informations are available
+     *
+     * @test
+     */
+    public function getInfosTable() {
+        $event = new Event();
+        $event->setPlacename("Place");
+        $event->setPlaceDescription("description");
+        $event->setCity("City");
+        $event->setUrl("event.com");
+
+        $this->assertEquals(
+            [
+                'Lieu' => 'Place',
+                'Description du lieu' => 'description',
+                'Adresse' => "Place\nCity",
+                'Lien externe' => 'event.com',
+            ],
+            $event->getInfosTable()
+        );
+    }
+
+    /**
+     * getShortDescription should return an eluded description
+     * if the description is longer than 100 cars
+     *
+     * @test
+     */
+    public function getShortDescriptionWithLongDescription()
+    {
+
+        $long_description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt " .
+        "ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut  " .
+        "aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore " .
+        "eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt " .
+        "mollit anim id est laborum.";
+
+        $event = new Event();
+        $event->setDescription($long_description);
+
+        $this->assertEquals(
+            "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore...",
+            $event->getShortDescription()
+        );
+    }
+
+    /**
+     * getShortDescription should return the actual description
+     * if the description is shorter than 100 cars
+     *
+     * @test
+     */
+    public function getShortDescriptionWithShortDescription() {
+
+        $long_description = "Lorem ipsum dolor sit amet";
+
+        $event = new Event();
+        $event->setDescription($long_description);
+
+        $this->assertEquals(
+            "Lorem ipsum dolor sit amet",
+            $event->getShortDescription()
+        );
+    }
+
+    /**
+     * getShortDescription should return an empty string
+     * if the description is null or empty
+     *
+     * @test
+     */
+    public function getShortDescriptionWithNoDescription() {
+        $event = new Event();
+
+        $this->assertEquals(
+            "",
+            $event->getShortDescription()
+        );
+    }
+
+    /**
+     * getInfosLink should return the url property of the event
+     * if this url is valid
+     *
+     * @test
+     */
+    public function getInfosLinkWithValidUrl() {
+        $event = new Event();
+        $url = 'https://structure.org/event?id=1';
+
+        $event->setUrl($url);
+
+        $this->assertEquals(
+            $url,
+            $event->getInfosLink()
+        );
+    }
+
+    /**
+     * getInfosLink should return the url of the website's organization
+     * if this url is invalid
+     *
+     * @test
+     */
+    public function getInfosLinkWithInvalidUrl() {
+        $event = new Event();
+        $url = 'ma structure';
+
+        $event->setUrl($url);
+        $event->setSubdomain('sub');
+
+        $this->assertEquals(
+            'https://sub.opentalent.fr',
+            $event->getInfosLink()
+        );
+    }
+
+    /**
+     * getInfosLink should return the url of the website's organization
+     * if this url is invalid
+     *
+     * @test
+     */
+    public function getInfosLinkWithNoData() {
+        $event = new Event();
+        $url = 'ma structure';
+        $event->setUrl($url);
+
+        $this->assertEquals(
+            '',
+            $event->getInfosLink()
+        );
+    }
+
+}

+ 155 - 0
ot_core/Tests/Unit/Domain/Model/MemberTest.php

@@ -0,0 +1,155 @@
+<?php
+
+namespace Opentalent\OtCore\Tests\Unit\Domain;
+
+use AssertionError;
+use Nimut\TestingFramework\TestCase\UnitTestCase;
+use Opentalent\OtCore\Domain\Model\Member;
+
+class MemberTest extends UnitTestCase
+{
+    /**
+     * Object should instantiate correctly, and properties
+     * set with setters should be retrieved by getters
+     *
+     * @test
+     */
+    public function instantiation() {
+        $member = new Member();
+
+        $member->setId(1);
+        $member->setOrganizationId(2);
+        $member->setGender('M');
+        $member->setGivenName('given name');
+        $member->setName('name');
+        $member->setStartDate(new \DateTime('2021-01-01'));
+        $member->setEndDate(new \DateTime('2021-01-01'));
+        $member->setInstrumentGroup('instrument group');
+        $member->setInstrument('instrument');
+        $member->setMission('mission');
+        $member->setPersonId(3);
+        $member->setImage('image');
+        $member->setAddressCity('city');
+        $member->setStreetAddress('street');
+        $member->setStreetAddressSecond('address2');
+        $member->setStreetAddressThird('address3');
+        $member->setPostalCode('00000');
+        $member->setTelphone('0101010101');
+        $member->setMobilPhone('0601010101');
+        $member->setEmail('mail@domain.com');
+
+        $this->assertEquals($member->getId(), 1);
+        $this->assertEquals($member->getOrganizationId(), 2);
+        $this->assertEquals($member->getGender(), 'M');
+        $this->assertEquals($member->getGivenName(), 'given name');
+        $this->assertEquals($member->getName(), 'name');
+        $this->assertEquals($member->getStartDate(), new \DateTime('2021-01-01'));
+        $this->assertEquals($member->getEndDate(), new \DateTime('2021-01-01'));
+        $this->assertEquals($member->getInstrumentGroup(), 'instrument group');
+        $this->assertEquals($member->getInstrument(), 'instrument');
+        $this->assertEquals($member->getMission(), 'mission');
+        $this->assertEquals($member->getPersonId(), 3);
+        $this->assertEquals($member->getImage(), 'image');
+        $this->assertEquals($member->getAddressCity(), 'city');
+        $this->assertEquals($member->getStreetAddress(), 'street');
+        $this->assertEquals($member->getStreetAddressSecond(), 'address2');
+        $this->assertEquals($member->getStreetAddressThird(), 'address3');
+        $this->assertEquals($member->getStreetAddressThird(), 'address3');
+        $this->assertEquals($member->getPostalCode(), '00000');
+        $this->assertEquals($member->getTelphone(), '0101010101');
+        $this->assertEquals($member->getMobilPhone(), '0601010101');
+        $this->assertEquals($member->getEmail(), 'mail@domain.com');
+    }
+
+    /**
+     * Nullable fields should be able to be set to null,
+     * while non nullable shall raise an exception if set to null
+     *
+     * @test
+     */
+    public function nullableOrNot() {
+
+        $member = new Member();
+
+        // non-nullable properties
+        try {
+            $member->setId(null);
+            throw new AssertionError('Member::setId should not accept a null value');
+        } catch (\TypeError $e) {}
+        try {
+            $member->setOrganizationId(null);
+            throw new AssertionError('Member::setOrganizationId should not accept a null value');
+        } catch (\TypeError $e) {}
+        try {
+            $member->setPersonId(null);
+            throw new AssertionError('Member::setPersonId should not accept a null value');
+        } catch (\TypeError $e) {}
+
+        // nullable properties
+        $member->setGender(null);
+        $member->setGivenName(null);
+        $member->setName(null);
+        $member->setStartDate(null);
+        $member->setEndDate(null);
+        $member->setInstrumentGroup(null);
+        $member->setInstrument(null);
+        $member->setMission(null);
+        $member->setImage(null);
+        $member->setAddressCity(null);
+        $member->setStreetAddress(null);
+        $member->setStreetAddressSecond(null);
+        $member->setStreetAddressThird(null);
+        $member->setPostalCode(null);
+        $member->setTelphone(null);
+        $member->setMobilPhone(null);
+        $member->setEmail(null);
+
+        // Just to avoid this test to be considered as risky
+        $this->assertEquals(1, 1);
+    }
+
+    /**
+     * getFullName should return the concatenated name of the member,
+     * regarding which informations are available
+     *
+     * @test
+     */
+    public function getFullNameWithNameAndGivenName() {
+        $member = new Member();
+        $member->setGivenName('Benedict');
+        $member->setName('Comcomber');
+        $this->assertEquals(
+            "Benedict Comcomber",
+            $member->getFullName()
+        );
+    }
+
+    /**
+     * getFullName should return the concatenated name of the member,
+     * regarding which informations are available
+     *
+     * @test
+     */
+    public function getFullNameWithNameAndGender() {
+        $member = new Member();
+        $member->setName('Comcomber');
+        $this->assertEquals(
+            "M. Comcomber",
+            $member->getFullName()
+        );
+    }
+
+    /**
+     * getFullName should return the concatenated name of the member,
+     * regarding which informations are available
+     *
+     * @test
+     */
+    public function getFullNameWithNoInformation() {
+        $member = new Member();
+        $this->assertEquals(
+            "",
+            $member->getFullName()
+        );
+    }
+}

+ 100 - 0
ot_core/Tests/Unit/Domain/Model/OrganizationTest.php

@@ -0,0 +1,100 @@
+<?php
+
+namespace Opentalent\OtCore\Tests\Unit\Domain;
+
+use AssertionError;
+use Nimut\TestingFramework\TestCase\UnitTestCase;
+use Opentalent\OtCore\Domain\Model\Donor;
+use Opentalent\OtCore\Domain\Model\Organization;
+
+class OrganizationTest extends UnitTestCase
+{
+    /**
+     * Object should instantiate correctly, and properties
+     * set with setters should be retrieved by getters
+     *
+     * @test
+     */
+    public function instantiation() {
+        $organization = new Organization();
+
+        $organization->setId(1);
+        $organization->setType("PortailOrganization");
+        $organization->setSubDomain('subdomain');
+        $organization->setName('name');
+        $organization->setSlug('slug');
+        $organization->setPrincipalType('type');
+        $organization->setDescription('description');
+        $organization->setCategories(['category']);
+        $organization->setAddressCity('city');
+        $organization->setPostalCode('00000');
+        $organization->setStreetAddress('street');
+        $organization->setLatitude(1.2345);
+        $organization->setLongitude(1.2345);
+        $organization->setCountry('country');
+        $organization->setLogo('logo.svg');
+        $organization->setParentId(2);
+        $organization->setParentName('parent');
+        $organization->setParentSubdomain('parent subdomain');
+
+        $this->assertEquals($organization->getId(), 1);
+        $this->assertEquals($organization->getType(), "PortailOrganization");
+        $this->assertEquals($organization->getSubDomain(), 'subdomain');
+        $this->assertEquals($organization->getName(), 'name');
+        $this->assertEquals($organization->getSlug(), 'slug');
+        $this->assertEquals($organization->getPrincipalType(), 'type');
+        $this->assertEquals($organization->getDescription(), 'description');
+        $this->assertEquals($organization->getCategories(), ['category']);
+        $this->assertEquals($organization->getAddressCity(), 'city');
+        $this->assertEquals($organization->getPostalCode(), '00000');
+        $this->assertEquals($organization->getStreetAddress(), 'street');
+        $this->assertEquals($organization->getLatitude(), 1.2345);
+        $this->assertEquals($organization->getLongitude(), 1.2345);
+        $this->assertEquals($organization->getCountry(), 'country');
+        $this->assertEquals($organization->getLogo(), 'logo.svg');
+        $this->assertEquals($organization->getParentId(), 2);
+        $this->assertEquals($organization->getParentName(), 'parent');
+        $this->assertEquals($organization->getParentSubdomain(), 'parent subdomain');
+    }
+
+    /**
+     * Nullable fields should be able to be set to null,
+     * while non nullable shall raise an exception if set to null
+     *
+     * @test
+     */
+    public function nullableOrNot() {
+
+        $organization = new Organization();
+
+        // non-nullable properties
+        try {
+            $organization->setId(null);
+            throw new AssertionError('Organization::setId should not accept a null value');
+        } catch (\TypeError $e) {}
+
+        // nullable properties
+        $organization->setType(null);
+        $organization->setSubDomain(null);
+        $organization->setName(null);
+        $organization->setSlug(null);
+        $organization->setPrincipalType(null);
+        $organization->setDescription(null);
+        $organization->setCategories(null);
+        $organization->setAddressCity(null);
+        $organization->setPostalCode(null);
+        $organization->setStreetAddress(null);
+        $organization->setLatitude(null);
+        $organization->setLongitude(null);
+        $organization->setCountry(null);
+        $organization->setLogo(null);
+        $organization->setParentId(null);
+        $organization->setParentName(null);
+        $organization->setParentSubdomain(null);
+
+        // Just to avoid this test to be considered as risky
+        $this->assertEquals(1, 1);
+    }
+
+
+}