This tests the correct creation of references used for ensuring link
integrity.  Any archetype-based content object which refers to other (local)
objects by `<img>` or `<a>` tags should create references between those
objects on save.  First we check neither the document nor the image have any
references yet:

  >>> doc = portal.doc1
  >>> self.assertEqual(doc.getReferences(), [])
  >>> self.assertEqual(doc.getBackReferences(), [])
  >>> img = portal.image1
  >>> self.assertEqual(img.getReferences(), [])
  >>> self.assertEqual(img.getBackReferences(), [])

Then we edit the document and insert a link to the image, which should
trigger the creation of the references.  We need to use ``processForm()`` here,
because using the mutator won't call ``notify`` and therefore not trigger
the `IObjectModifiedEvent` event either:

  >>> self.setRoles(('Manager',))
  >>> tag = img.tag()
  >>> str(tag)
  '<img src="http://nohost/plone/image1/image" ... title="Test Image 1" ... />'
  >>> self.setText(doc, tag)
  >>> doc.getReferences()
  [<ATImage at /plone/image1>]
  >>> doc.getBackReferences()
  []
  >>> img.getReferences()
  []
  >>> img.getBackReferences()
  [<ATDocument at /plone/doc1>]

Next we change the document again and insert a link to another page:

  >>> self.setText(doc, '<a href="news">news</a>')
  >>> doc.getReferences()
  [<AT... at /plone/news>]
  >>> portal.news.getBackReferences()
  [<ATDocument at /plone/doc1>]

Linking image scales should also work:

  >>> self.setText(doc, '<a href="image1/image_thumb">an image</a>')
  >>> doc.getReferences()
  [<ATImage at /plone/image1>]
  >>> img.getBackReferences()
  [<ATDocument at /plone/doc1>]

Linking via the "resolveuid/UID" method should also work:

  >>> self.setText(doc, '<a href="resolveuid/%s">an image</a>' % (
  ...     img.UID(),))
  >>> doc.getReferences()
  [<ATImage at /plone/image1>]
  >>> img.getBackReferences()
  [<ATDocument at /plone/doc1>]
