/** * @depends test_addAttachment * @depends test_InlineAttachment * @depends test_setHTML * @depends test_setText * @depends test_setSubject * @covers ::__get */ public function test_get() { $this->generateMessage(); # Make property readable / writable $Status = new ReflectionProperty($this->Message, '_Status'); $Status->setAccessible(true); # Status $this->assertSame($this->Message->Status, $Status->getValue($this->Message), 'IMessage::$Status should equal IMessage::_Status'); # Serializer $this->assertSame($this->Message->Serializer, $this->Message->getSerializer(), 'IMessage::$Serializer should equal IMessage::getSerializer()'); # Parent $this->assertInstanceOf('\\BLW\\Type\\IObject', $this->Message->Parent, 'IMessage::$Parent should be an instance of IObject'); # ID $this->assertSame($this->Message->ID, $this->Message->getID(), 'IMessage::$ID should equal IMessage::getID()'); # Mediator $this->assertInstanceOf('\\BLW\\Type\\IMediator', $this->Message->Mediator, 'IMessage::$Mediator should be an instance of IMediator'); # MediatorID $this->assertNotEmpty($this->Message->MediatorID, 'IMessage::$MediatorID should not be empty'); # To $this->assertInstanceOf('\\BLW\\Type\\IContainer', $this->Message->To, 'IMessage::$To should return an instance of IContainer'); $this->assertCount(1, $this->Message->To, 'IMessage::$To should return an instance of IContainer with 1 item'); # From $this->assertInstanceOf('\\BLW\\Type\\IContainer', $this->Message->From, 'IMessage::$From should return an instance of IContainer'); $this->assertCount(1, $this->Message->From, 'IMessage::$From should return an instance of IContainer with 1 item'); # ReplyTo $this->assertInstanceOf('\\BLW\\Type\\IContainer', $this->Message->ReplyTo, 'IMessage::$ReplyTo should return an instance of IContainer'); $this->assertCount(1, $this->Message->ReplyTo, 'IMessage::$ReplyTo should return an instance of IContainer with 1 item'); # CC $this->assertInstanceOf('\\BLW\\Type\\IContainer', $this->Message->CC, 'IMessage::$CC should return an instance of IContainer'); $this->assertCount(1, $this->Message->CC, 'IMessage::$CC should return an instance of IContainer with 1 item'); # BCC $this->assertInstanceOf('\\BLW\\Type\\IContainer', $this->Message->BCC, 'IMessage::$BCC should return an instance of IContainer'); $this->assertCount(1, $this->Message->BCC, 'IMessage::$BCC should return an instance of IContainer with 1 item'); # HTML $this->assertInstanceOf('DOMDocument', $this->Message->HTML, 'IMessage::$HTML should be an instance of DOMDocument'); # Text $this->assertEquals('Text Body', $this->Message->Text, 'IMessage::$Text should equal `Text Body`'); # Subject $this->assertEquals('Test Subject', $this->Message->Subject, 'IMessage::$Subject should equal `Test Subject`'); # Test undefined property try { $this->Message->undefined; $this->fail('Failed to generate notice on undefined property'); } catch (\PHPUnit_Framework_Error_Notice $e) { $this->assertContains('Undefined property', $e->getMessage(), 'Message::$undefined is undefined and should raise a notice'); } @$this->Message->undefined; }