@@ -32,6 +32,9 @@ class FuzzyfyrCommandTest extends AbstractTest
3232 public function runSuccessfully ()
3333 {
3434 $ state = $ this ->getState ();
35+ $ state ->expects ($ this ->any ())
36+ ->method ('getMode ' )
37+ ->willReturn (\Magento \Framework \App \State::MODE_DEFAULT );
3538
3639 $ configuration = $ this ->getMockBuilder (Configuration::class)->getMock ();
3740 $ configurationFactory = $ this ->getConfigurationFactory ();
@@ -58,6 +61,100 @@ public function runSuccessfully()
5861 $ this ->assertEquals (FuzzyfyrCommand::SUCCESS , $ command ->run ($ input , $ output ));
5962 }
6063
64+ /**
65+ * @test
66+ */
67+ public function runSuccessfullyInProductionModeWithForceOption ()
68+ {
69+ $ state = $ this ->getState ();
70+ $ state ->expects ($ this ->any ())
71+ ->method ('getMode ' )
72+ ->willReturn (\Magento \Framework \App \State::MODE_PRODUCTION );
73+
74+ $ configuration = $ this ->getMockBuilder (Configuration::class)->getMock ();
75+ $ configurationFactory = $ this ->getConfigurationFactory ();
76+ $ configurationFactory ->expects ($ this ->once ())
77+ ->method ('create ' )
78+ ->willReturn ($ configuration );
79+
80+ $ eventManager = $ this ->getEventManager ();
81+ $ eventManager ->expects ($ this ->once ())
82+ ->method ('dispatch ' )
83+ ->with (FuzzyfyrCommand::EVENT_NAME , [
84+ 'configuration ' => $ configuration
85+ ]);
86+
87+ $ command = new FuzzyfyrCommand (
88+ $ state ,
89+ $ eventManager ,
90+ $ configurationFactory
91+ );
92+
93+ $ input = $ this ->getInput ();
94+ $ i = 4 ;
95+ $ input ->expects ($ this ->at ($ i ++))
96+ ->method ('getOption ' )
97+ ->with (FuzzyfyrCommand::FLAG_FORCE )
98+ ->willReturn (true );
99+ $ input ->expects ($ this ->at ($ i ++))
100+ ->method ('getOption ' )
101+ ->with (FuzzyfyrCommand::FLAG_ONLY_EMPTY )
102+ ->willReturn (true );
103+ $ input ->expects ($ this ->at ($ i ++))
104+ ->method ('getOption ' )
105+ ->with (FuzzyfyrCommand::FLAG_CATEGORIES )
106+ ->willReturn (false );
107+ $ input ->expects ($ this ->at ($ i ++))
108+ ->method ('getOption ' )
109+ ->with (FuzzyfyrCommand::FLAG_CMS_BLOCKS )
110+ ->willReturn (false );
111+ $ input ->expects ($ this ->at ($ i ++))
112+ ->method ('getOption ' )
113+ ->with (FuzzyfyrCommand::FLAG_CMS_PAGES )
114+ ->willReturn (false );
115+ $ input ->expects ($ this ->at ($ i ++))
116+ ->method ('getOption ' )
117+ ->with (FuzzyfyrCommand::FLAG_CUSTOMERS )
118+ ->willReturn (false );
119+ $ input ->expects ($ this ->at ($ i ++))
120+ ->method ('getOption ' )
121+ ->with (FuzzyfyrCommand::FLAG_PRODUCTS )
122+ ->willReturn (false );
123+ $ input ->expects ($ this ->at ($ i ++))
124+ ->method ('getOption ' )
125+ ->with (FuzzyfyrCommand::FLAG_USERS )
126+ ->willReturn (false );
127+
128+ $ input ->expects ($ this ->at ($ i ++))
129+ ->method ('getOption ' )
130+ ->with (FuzzyfyrCommand::OPTION_DUMMY_CONTENT_TEXT )
131+ ->willReturn (FuzzyfyrCommand::DEFAULT_DUMMY_CONTENT_TEXT );
132+ $ input ->expects ($ this ->at ($ i ++))
133+ ->method ('getOption ' )
134+ ->with (FuzzyfyrCommand::OPTION_DUMMY_CONTENT_PASSWORD )
135+ ->willReturn (FuzzyfyrCommand::DEFAULT_DUMMY_CONTENT_PASSWORD );
136+ $ input ->expects ($ this ->at ($ i ++))
137+ ->method ('getOption ' )
138+ ->with (FuzzyfyrCommand::OPTION_DUMMY_CONTENT_EMAIL )
139+ ->willReturn (FuzzyfyrCommand::DEFAULT_DUMMY_CONTENT_EMAIL );
140+ $ input ->expects ($ this ->at ($ i ++))
141+ ->method ('getOption ' )
142+ ->with (FuzzyfyrCommand::OPTION_DUMMY_CONTENT_URL )
143+ ->willReturn (FuzzyfyrCommand::DEFAULT_DUMMY_CONTENT_URL );
144+ $ input ->expects ($ this ->at ($ i ++))
145+ ->method ('getOption ' )
146+ ->with (FuzzyfyrCommand::OPTION_DUMMY_CONTENT_PHONE )
147+ ->willReturn (FuzzyfyrCommand::DEFAULT_DUMMY_CONTENT_PHONE );
148+ $ input ->expects ($ this ->at ($ i ++))
149+ ->method ('getOption ' )
150+ ->with (FuzzyfyrCommand::OPTION_DUMMY_CONTENT_IMAGE_PATH )
151+ ->willReturn (FuzzyfyrCommand::DEFAULT_DUMMY_CONTENT_IMAGE_PATH );
152+
153+ $ output = $ this ->getOutput ();
154+
155+ $ this ->assertEquals (FuzzyfyrCommand::SUCCESS , $ command ->run ($ input , $ output ));
156+ }
157+
61158 /**
62159 * @test
63160 */
0 commit comments