| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | use kalanis\EmailApi\Basics\Content; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 5 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 6 |  |  | class ContentTest extends CommonTestClass | 
            
                                                                        
                            
            
                                    
            
            
                | 7 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 8 |  |  |     public function testSimple() | 
            
                                                                        
                            
            
                                    
            
            
                | 9 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 10 |  |  |         $data = $this->mockContent(); | 
            
                                                                        
                            
            
                                    
            
            
                | 11 |  |  |         $this->assertEquals('testing content', $data->subject); | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  |         $this->assertEquals('qwertzuiopasdfghjklyxcvbnm', $data->body); | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  |         $this->assertEquals('on_testing_service', $data->tag); | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  |     public function testOutputs() | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |         $data = $this->mockContent(); | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |         $this->assertEquals('testing content', $data->getSubject()); | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |         $this->assertEquals('qwertzuiopasdfghjklyxcvbnm', $data->getHtmlBody()); | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |         $this->assertEquals('on_testing_service', $data->getTag()); | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     public function testClear() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |         $data = new Content(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         $data->setData('testing content 2', 'qwertzuiopasdfghjklyxcvbnm123', 'on_testing_service456'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |         $data->plain = 'qwertzuiopasdfghjklyxcvbnm987'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |         $data->unsubEmail = 'qwertzuiopasdfghjklyxcvbnm654'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         $data->unsubLink = 'qwertzuiopasdfghjklyxcvbnm321'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |         $data->unsubByClick = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         $data->sanitize(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         $this->assertEquals('testing content 2', $data->getSubject()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         $this->assertEquals('qwertzuiopasdfghjklyxcvbnm123', $data->getHtmlBody()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         $this->assertEquals('on_testing_service456', $data->getTag()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         $this->assertEquals('qwertzuiopasdfghjklyxcvbnm987', $data->getPlainBody()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         $this->assertEquals('qwertzuiopasdfghjklyxcvbnm654', $data->getUnsubscribeEmail()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |         $this->assertEquals('qwertzuiopasdfghjklyxcvbnm321', $data->getUnsubscribeLink()); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 39 |  |  |         $this->assertFalse($data->canUnsubscribeOneClick()); | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |     public function testAttachments() | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |         $data = $this->mockContent(); | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |         $this->assertEmpty($data->getAttachments()); | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |         $data->addAttachment($this->mockAttachment()); | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |         $this->assertNotEmpty($data->getAttachments()); | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |         $data->resetAttachments(); | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |         $this->assertEmpty($data->getAttachments()); | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     public function testSanitize() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         $data = $this->mockContent(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         $data->subject = 123456789; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         $data->tag = 'null'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         $data->sanitize(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         $this->assertEquals('null', $data->tag); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 59 |  |  |         $this->assertEquals('123456789', $data->subject); | 
            
                                                                        
                                                                
            
                                    
            
            
                | 60 |  |  |     } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 61 |  |  | } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 62 |  |  |  |