Exemplo n.º 1
0
 public function testNoNode()
 {
     $classMetadata = $this->getMockBuilder(ClassMetaData::class)->disableOriginalConstructor()->getMock();
     $classMetadata->reflClass = $this->getMockBuilder(\ReflectionClass::class)->disableOriginalConstructor()->getMock();
     $classMetadata->reflClass->expects($this->once())->method('implementsInterface');
     $entityManager = $this->getMockBuilder(EntityManager::class)->disableOriginalConstructor()->getMock();
     $filter = new NodePublicationFilter($entityManager);
     $this->assertEquals('', $filter->addFilterConstraint($classMetadata, 'alias'));
 }
 public function testNode()
 {
     $classMetadata = $this->getMockBuilder(ClassMetaData::class)->disableOriginalConstructor()->getMock();
     $classMetadata->reflClass = $this->getMockBuilder(\ReflectionClass::class)->disableOriginalConstructor()->getMock();
     $classMetadata->reflClass->expects($this->once())->method('implementsInterface')->willReturn(true);
     $entityManager = $this->getMockBuilder(EntityManager::class)->disableOriginalConstructor()->getMock();
     $filter = new NodePublicationFilter($entityManager);
     $query = $filter->addFilterConstraint($classMetadata, 'alias');
     $this->assertContains('publishedFrom', $query);
     $this->assertContains('publishedTill', $query);
     $this->assertContains('NodePublication', $query);
     $this->assertContains('alias', $query);
 }