public function testSerialization()
 {
     $metadata = new OwnershipMetadata('ORGANIZATION', 'org', 'org_id');
     $data = serialize($metadata);
     $metadata = new OwnershipMetadata();
     $this->assertFalse($metadata->isOrganizationOwned());
     $this->assertEquals('', $metadata->getOwnerFieldName());
     $this->assertEquals('', $metadata->getOwnerColumnName());
     $metadata = unserialize($data);
     $this->assertTrue($metadata->isOrganizationOwned());
     $this->assertEquals('org', $metadata->getOwnerFieldName());
     $this->assertEquals('org_id', $metadata->getOwnerColumnName());
 }
Esempio n. 2
0
 public function testSetState()
 {
     $metadata = new OwnershipMetadata('ORGANIZATION', 'org', 'org_id');
     $restoredMetadata = $metadata->__set_state(['ownerType' => $metadata->getOwnerType(), 'ownerFieldName' => $metadata->getOwnerFieldName(), 'ownerColumnName' => $metadata->getOwnerColumnName(), 'not_exists' => true]);
     $this->assertEquals($metadata, $restoredMetadata);
 }