コード例 #1
0
 /**
  * Test that the attachment factory can create an instance
  * of the Attachment class.
  *
  * @test
  * @return void
  */
 public function it_should_be_able_to_build_an_attachment_object()
 {
     $attachment = Attachment::create('testAttachment', []);
     $this->assertInstanceOf('Codesleeve\\Stapler\\Attachment', $attachment);
 }
コード例 #2
0
 /**
  * Add a new file attachment type to the list of available attachments.
  * This function acts as a quasi constructor for this trait.
  *
  * @param string $name
  * @param array $options
  */
 public function hasAttachedFile($name, array $options = [])
 {
     $attachment = AttachmentFactory::create($name, $options);
     $attachment->setInstance($this);
     $this->attachedFiles[$name] = $attachment;
 }