getExtensionById('taoDeliveryRdf'); } /** * tests initialization */ public function setUp(): void { TaoPhpUnitTestRunner::initTest(); $this->service = new GroupAssignment(); } /** * * @author Lionel Lecaque, lionel@taotesting.com * @param string $uri * @return MockObject */ private function getResourceMock($uri) { $resourceMock = $this->getMockBuilder('core_kernel_classes_Resource') ->setMockClassName('FakeResource') ->setConstructorArgs([$uri]) ->getMock(); return $resourceMock; } /** * @dataProvider hasDeliveryGuestAccessProvider * @param array $properties * @param bool $expected */ public function testHasDeliveryGuestAccess(array $properties, $expected) { $delivery = $this->getResourceMock('fakerDeliveryAssembly'); $delivery->method('getPropertiesValues')->willReturn($properties); $result = $this->invokeProtectedMethod($this->service, 'hasDeliveryGuestAccess', [$delivery]); $this->assertEquals($expected, $result); } public function hasDeliveryGuestAccessProvider() { return [ 'positive' => [ [ DeliveryContainerService::PROPERTY_ACCESS_SETTINGS => [ new \core_kernel_classes_Resource(DeliveryAssemblyService::PROPERTY_DELIVERY_GUEST_ACCESS) ] ], true ], 'negative' => [ [ DeliveryContainerService::PROPERTY_ACCESS_SETTINGS => [] ], false ] ]; } }