11<?php
22use Mockery as m ;
3- use SimpleSoftwareIO \QrCode \QrCodeGenerator ;
3+ use SimpleSoftwareIO \QrCode \BaconQrCodeGenerator ;
44
5- class QrCodeGeneratorTest extends \PHPUnit_Framework_TestCase {
5+ class BaconQrCodeGeneratorTest extends \PHPUnit_Framework_TestCase {
66
77 public function tearDown ()
88 {
@@ -13,6 +13,7 @@ public function setUp()
1313 {
1414 $ this ->writer = m::mock ('\BaconQrCode\Writer ' );
1515 $ this ->format = m::mock ('\BaconQrCode\Renderer\Image\RendererInterface ' );
16+ $ this ->qrCode = new BaconQrCodeGenerator ($ this ->writer , $ this ->format );
1617 }
1718
1819 public function testSetMargin ()
@@ -25,7 +26,7 @@ public function testSetMargin()
2526 ->once ()
2627 ->andReturn ($ this ->format );
2728
28- $ qrCode = new QrCodeGenerator ($ this ->writer , $ this ->format );
29+ $ qrCode = new BaconQrCodeGenerator ($ this ->writer , $ this ->format );
2930 $ qrCode ->margin (50 );
3031 }
3132
@@ -38,8 +39,7 @@ public function testSetBackgroundColor()
3839 ->once ()
3940 ->andReturn ($ this ->format );
4041
41- $ qrCode = new QrCodeGenerator ($ this ->writer , $ this ->format );
42- $ qrCode ->backgroundColor (255 ,255 ,255 );
42+ $ this ->qrCode ->backgroundColor (255 ,255 ,255 );
4343 }
4444
4545 public function testSetColor ()
@@ -51,8 +51,7 @@ public function testSetColor()
5151 ->once ()
5252 ->andReturn ($ this ->format );
5353
54- $ qrCode = new QrCodeGenerator ($ this ->writer , $ this ->format );
55- $ qrCode ->color (255 ,255 ,255 );
54+ $ this ->qrCode ->color (255 ,255 ,255 );
5655 }
5756
5857 public function testSetSize ()
@@ -68,8 +67,7 @@ public function testSetSize()
6867 ->twice ()
6968 ->andReturn ($ this ->format );
7069
71- $ qrCode = new QrCodeGenerator ($ this ->writer , $ this ->format );
72- $ qrCode ->size (50 );
70+ $ this ->qrCode ->size (50 );
7371 }
7472
7573 public function testSetFormatPng ()
@@ -78,8 +76,7 @@ public function testSetFormatPng()
7876 ->with ('BaconQrCode\Renderer\Image\Png ' )
7977 ->once ();
8078
81- $ qrCode = new QrCodeGenerator ($ this ->writer , $ this ->format );
82- $ qrCode ->format ('png ' );
79+ $ this ->qrCode ->format ('png ' );
8380 }
8481
8582 public function testSetFormatEps ()
@@ -88,8 +85,7 @@ public function testSetFormatEps()
8885 ->with ('BaconQrCode\Renderer\Image\Eps ' )
8986 ->once ();
9087
91- $ qrCode = new QrCodeGenerator ($ this ->writer , $ this ->format );
92- $ qrCode ->format ('eps ' );
88+ $ this ->qrCode ->format ('eps ' );
9389 }
9490
9591 public function testSetFormatSvg ()
@@ -98,8 +94,7 @@ public function testSetFormatSvg()
9894 ->with ('BaconQrCode\Renderer\Image\Svg ' )
9995 ->once ();
10096
101- $ qrCode = new QrCodeGenerator ($ this ->writer , $ this ->format );
102- $ qrCode ->format ('svg ' );
97+ $ this ->qrCode ->format ('svg ' );
10398 }
10499
105100 public function testSetFormatUnknown ()
@@ -108,8 +103,7 @@ public function testSetFormatUnknown()
108103 ->with ('BaconQrCode\Renderer\Image\Svg ' )
109104 ->once ();
110105
111- $ qrCode = new QrCodeGenerator ($ this ->writer , $ this ->format );
112- $ qrCode ->format ('random ' );
106+ $ this ->qrCode ->format ('random ' );
113107 }
114108
115109 public function testGenerate ()
@@ -118,8 +112,7 @@ public function testGenerate()
118112 ->with ('qrCode ' , m::type ('string ' ), m::type ('int ' ))
119113 ->once ();
120114
121- $ qrCode = new QrCodeGenerator ($ this ->writer , $ this ->format );
122- $ qrCode ->generate ('qrCode ' );
115+ $ this ->qrCode ->generate ('qrCode ' );
123116 }
124117
125118 public function testGenerateFile ()
@@ -128,8 +121,7 @@ public function testGenerateFile()
128121 ->with ('qrCode ' , 'foo.txt ' , m::type ('string ' ), m::type ('int ' ))
129122 ->once ();
130123
131- $ qrCode = new QrCodeGenerator ($ this ->writer , $ this ->format );
132- $ qrCode ->generate ('qrCode ' , 'foo.txt ' );
124+ $ this ->qrCode ->generate ('qrCode ' , 'foo.txt ' );
133125 }
134126}
135127
0 commit comments