| @@ 28-41 (lines=14) @@ | ||
| 25 | $this->generator = new BasicSeoGenerator(new TagBuilder(new TagFactory())); |
|
| 26 | } |
|
| 27 | ||
| 28 | public function testTitle() |
|
| 29 | { |
|
| 30 | $config = [ |
|
| 31 | 'title' => 'Awesome | Site' |
|
| 32 | ]; |
|
| 33 | ||
| 34 | $configurator = new BasicSeoConfigurator($config); |
|
| 35 | $configurator->configure($this->generator); |
|
| 36 | ||
| 37 | $this->assertEquals( |
|
| 38 | '<title>Awesome | Site</title>', |
|
| 39 | $this->generator->render() |
|
| 40 | ); |
|
| 41 | } |
|
| 42 | ||
| 43 | public function testDescription() |
|
| 44 | { |
|
| @@ 43-56 (lines=14) @@ | ||
| 40 | ); |
|
| 41 | } |
|
| 42 | ||
| 43 | public function testDescription() |
|
| 44 | { |
|
| 45 | $config = [ |
|
| 46 | 'description' => 'My awesome site is so cool!', |
|
| 47 | ]; |
|
| 48 | ||
| 49 | $configurator = new BasicSeoConfigurator($config); |
|
| 50 | $configurator->configure($this->generator); |
|
| 51 | ||
| 52 | $this->assertEquals( |
|
| 53 | '<meta name="description" content="My awesome site is so cool!" />', |
|
| 54 | $this->generator->render() |
|
| 55 | ); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function testKeywords() |
|
| 59 | { |
|
| @@ 58-71 (lines=14) @@ | ||
| 55 | ); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function testKeywords() |
|
| 59 | { |
|
| 60 | $config = [ |
|
| 61 | 'keywords' => 'awesome, cool', |
|
| 62 | ]; |
|
| 63 | ||
| 64 | $configurator = new BasicSeoConfigurator($config); |
|
| 65 | $configurator->configure($this->generator); |
|
| 66 | ||
| 67 | $this->assertEquals( |
|
| 68 | '<meta name="keywords" content="awesome, cool" />', |
|
| 69 | $this->generator->render() |
|
| 70 | ); |
|
| 71 | } |
|
| 72 | ||
| 73 | public function testCanonical() |
|
| 74 | { |
|
| @@ 73-86 (lines=14) @@ | ||
| 70 | ); |
|
| 71 | } |
|
| 72 | ||
| 73 | public function testCanonical() |
|
| 74 | { |
|
| 75 | $config = [ |
|
| 76 | 'canonical' => 'http://127.0.0.1:8000', |
|
| 77 | ]; |
|
| 78 | ||
| 79 | $configurator = new BasicSeoConfigurator($config); |
|
| 80 | $configurator->configure($this->generator); |
|
| 81 | ||
| 82 | $this->assertEquals( |
|
| 83 | '<link href="http://127.0.0.1:8000" rel="canonical" />', |
|
| 84 | $this->generator->render() |
|
| 85 | ); |
|
| 86 | } |
|
| 87 | ||
| 88 | public function testRobots() |
|
| 89 | { |
|
| @@ 106-117 (lines=12) @@ | ||
| 103 | ); |
|
| 104 | } |
|
| 105 | ||
| 106 | public function testNoConfig() |
|
| 107 | { |
|
| 108 | $config = []; |
|
| 109 | ||
| 110 | $configurator = new BasicSeoConfigurator($config); |
|
| 111 | $configurator->configure($this->generator); |
|
| 112 | ||
| 113 | $this->assertEquals( |
|
| 114 | '', |
|
| 115 | $this->generator->render() |
|
| 116 | ); |
|
| 117 | } |
|
| 118 | } |
|
| 119 | ||
| @@ 28-41 (lines=14) @@ | ||
| 25 | $this->generator = new OgSeoGenerator(new TagBuilder(new TagFactory())); |
|
| 26 | } |
|
| 27 | ||
| 28 | public function testTitle() |
|
| 29 | { |
|
| 30 | $config = [ |
|
| 31 | 'title' => 'Awesome | Site' |
|
| 32 | ]; |
|
| 33 | ||
| 34 | $configurator = new OgSeoConfigurator($config); |
|
| 35 | $configurator->configure($this->generator); |
|
| 36 | ||
| 37 | $this->assertEquals( |
|
| 38 | '<meta name="og:title" content="Awesome | Site" />', |
|
| 39 | $this->generator->render() |
|
| 40 | ); |
|
| 41 | } |
|
| 42 | ||
| 43 | public function testDescription() |
|
| 44 | { |
|
| @@ 43-56 (lines=14) @@ | ||
| 40 | ); |
|
| 41 | } |
|
| 42 | ||
| 43 | public function testDescription() |
|
| 44 | { |
|
| 45 | $config = [ |
|
| 46 | 'description' => 'My awesome site is so cool!', |
|
| 47 | ]; |
|
| 48 | ||
| 49 | $configurator = new OgSeoConfigurator($config); |
|
| 50 | $configurator->configure($this->generator); |
|
| 51 | ||
| 52 | $this->assertEquals( |
|
| 53 | '<meta name="og:description" content="My awesome site is so cool!" />', |
|
| 54 | $this->generator->render() |
|
| 55 | ); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function testImage() |
|
| 59 | { |
|
| @@ 58-71 (lines=14) @@ | ||
| 55 | ); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function testImage() |
|
| 59 | { |
|
| 60 | $config = [ |
|
| 61 | 'image' => 'http://images.com/poney/12', |
|
| 62 | ]; |
|
| 63 | ||
| 64 | $configurator = new OgSeoConfigurator($config); |
|
| 65 | $configurator->configure($this->generator); |
|
| 66 | ||
| 67 | $this->assertEquals( |
|
| 68 | '<meta name="og:image" content="http://images.com/poney/12" />', |
|
| 69 | $this->generator->render() |
|
| 70 | ); |
|
| 71 | } |
|
| 72 | ||
| 73 | public function testType() |
|
| 74 | { |
|
| @@ 73-86 (lines=14) @@ | ||
| 70 | ); |
|
| 71 | } |
|
| 72 | ||
| 73 | public function testType() |
|
| 74 | { |
|
| 75 | $config = [ |
|
| 76 | 'type' => 'website', |
|
| 77 | ]; |
|
| 78 | ||
| 79 | $configurator = new OgSeoConfigurator($config); |
|
| 80 | $configurator->configure($this->generator); |
|
| 81 | ||
| 82 | $this->assertEquals( |
|
| 83 | '<meta name="og:type" content="website" />', |
|
| 84 | $this->generator->render() |
|
| 85 | ); |
|
| 86 | } |
|
| 87 | ||
| 88 | public function testNoConfig() |
|
| 89 | { |
|
| @@ 88-99 (lines=12) @@ | ||
| 85 | ); |
|
| 86 | } |
|
| 87 | ||
| 88 | public function testNoConfig() |
|
| 89 | { |
|
| 90 | $config = []; |
|
| 91 | ||
| 92 | $configurator = new OgSeoConfigurator($config); |
|
| 93 | $configurator->configure($this->generator); |
|
| 94 | ||
| 95 | $this->assertEquals( |
|
| 96 | '', |
|
| 97 | $this->generator->render() |
|
| 98 | ); |
|
| 99 | } |
|
| 100 | } |
|
| 101 | ||
| @@ 28-41 (lines=14) @@ | ||
| 25 | $this->generator = new TwitterSeoGenerator(new TagBuilder(new TagFactory())); |
|
| 26 | } |
|
| 27 | ||
| 28 | public function testTitle() |
|
| 29 | { |
|
| 30 | $config = [ |
|
| 31 | 'title' => 'Awesome | Site' |
|
| 32 | ]; |
|
| 33 | ||
| 34 | $configurator = new TwitterSeoConfigurator($config); |
|
| 35 | $configurator->configure($this->generator); |
|
| 36 | ||
| 37 | $this->assertEquals( |
|
| 38 | '<meta name="twitter:title" content="Awesome | Site" />', |
|
| 39 | $this->generator->render() |
|
| 40 | ); |
|
| 41 | } |
|
| 42 | ||
| 43 | public function testDescription() |
|
| 44 | { |
|
| @@ 43-56 (lines=14) @@ | ||
| 40 | ); |
|
| 41 | } |
|
| 42 | ||
| 43 | public function testDescription() |
|
| 44 | { |
|
| 45 | $config = [ |
|
| 46 | 'description' => 'My awesome site is so cool!', |
|
| 47 | ]; |
|
| 48 | ||
| 49 | $configurator = new TwitterSeoConfigurator($config); |
|
| 50 | $configurator->configure($this->generator); |
|
| 51 | ||
| 52 | $this->assertEquals( |
|
| 53 | '<meta name="twitter:description" content="My awesome site is so cool!" />', |
|
| 54 | $this->generator->render() |
|
| 55 | ); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function testImage() |
|
| 59 | { |
|
| @@ 58-71 (lines=14) @@ | ||
| 55 | ); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function testImage() |
|
| 59 | { |
|
| 60 | $config = [ |
|
| 61 | 'image' => 'http://images.com/poney/12', |
|
| 62 | ]; |
|
| 63 | ||
| 64 | $configurator = new TwitterSeoConfigurator($config); |
|
| 65 | $configurator->configure($this->generator); |
|
| 66 | ||
| 67 | $this->assertEquals( |
|
| 68 | '<meta name="twitter:image" content="http://images.com/poney/12" />', |
|
| 69 | $this->generator->render() |
|
| 70 | ); |
|
| 71 | } |
|
| 72 | ||
| 73 | public function testCard() |
|
| 74 | { |
|
| @@ 73-86 (lines=14) @@ | ||
| 70 | ); |
|
| 71 | } |
|
| 72 | ||
| 73 | public function testCard() |
|
| 74 | { |
|
| 75 | $config = [ |
|
| 76 | 'card' => 'summary', |
|
| 77 | ]; |
|
| 78 | ||
| 79 | $configurator = new TwitterSeoConfigurator($config); |
|
| 80 | $configurator->configure($this->generator); |
|
| 81 | ||
| 82 | $this->assertEquals( |
|
| 83 | '<meta name="twitter:card" content="summary" />', |
|
| 84 | $this->generator->render() |
|
| 85 | ); |
|
| 86 | } |
|
| 87 | ||
| 88 | public function testSite() |
|
| 89 | { |
|
| @@ 88-101 (lines=14) @@ | ||
| 85 | ); |
|
| 86 | } |
|
| 87 | ||
| 88 | public function testSite() |
|
| 89 | { |
|
| 90 | $config = [ |
|
| 91 | 'site' => '@leogoutt', |
|
| 92 | ]; |
|
| 93 | ||
| 94 | $configurator = new TwitterSeoConfigurator($config); |
|
| 95 | $configurator->configure($this->generator); |
|
| 96 | ||
| 97 | $this->assertEquals( |
|
| 98 | '<meta name="twitter:site" content="@leogoutt" />', |
|
| 99 | $this->generator->render() |
|
| 100 | ); |
|
| 101 | } |
|
| 102 | ||
| 103 | public function testNoConfig() |
|
| 104 | { |
|
| @@ 103-114 (lines=12) @@ | ||
| 100 | ); |
|
| 101 | } |
|
| 102 | ||
| 103 | public function testNoConfig() |
|
| 104 | { |
|
| 105 | $config = []; |
|
| 106 | ||
| 107 | $configurator = new TwitterSeoConfigurator($config); |
|
| 108 | $configurator->configure($this->generator); |
|
| 109 | ||
| 110 | $this->assertEquals( |
|
| 111 | '', |
|
| 112 | $this->generator->render() |
|
| 113 | ); |
|
| 114 | } |
|
| 115 | } |
|
| 116 | ||