Ejemplo n.º 1
0
 /**
  * Test clean command
  *
  * @return void
  */
 public function testClean()
 {
     $this->Shell->runCommand(['router']);
     $output = $this->out->output();
     $this->assertTextContains('Router::url(\'/\')', $output);
     $this->assertTextContains('/test', $output);
 }
Ejemplo n.º 2
0
 /**
  * UserShellTest::testUserInteractive()
  *
  * @return void
  */
 public function _testUserInteractive()
 {
     $this->Shell->expects($this->at(0))->method('in')->will($this->returnValue('example'));
     $this->Shell->expects($this->at(1))->method('in')->will($this->returnValue('123'));
     $this->Shell->expects($this->at(3))->method('in')->will($this->returnValue('*****@*****.**'));
     $this->Shell->runCommand(['create']);
 }
Ejemplo n.º 3
0
 /**
  * ResetShellTest::testPwd()
  *
  * @return void
  */
 public function testPwdQuick()
 {
     $this->Shell->runCommand(['pwd', '123']);
     $output = $this->out->output();
     $expected = '1 pwds resetted';
     $this->assertTextContains($expected, (string) $output);
 }
Ejemplo n.º 4
0
 /**
  * @return void
  */
 public function testClear()
 {
     $this->Shell->expects($this->any())->method('in')->will($this->returnValue('y'));
     $this->Shell->runCommand(['clear']);
     $output = $this->out->output();
     $expected = 'Done!';
     $this->assertContains($expected, $output);
 }
Ejemplo n.º 5
0
 /**
  * Test clean command
  *
  * @return void
  */
 public function testFolderAgainWithHalf()
 {
     $this->Shell->expects($this->any())->method('in')->will($this->returnValue('y'));
     $this->Shell->runCommand(['folder', TMP . 'indent' . DS, '-a']);
     $output = $this->out->output();
     $this->assertContains('found: 1', $output);
     $result = file_get_contents(TMP . 'indent' . DS . 'indent.php');
     $expected = file_get_contents($this->testFilePath . 'indent_again.php');
     $this->assertTextEquals($expected, $result);
 }
Ejemplo n.º 6
0
 /**
  * Test clean command
  *
  * @return void
  */
 public function testClearLogs()
 {
     if (!is_dir(LOGS)) {
         mkdir(LOGS, 0775, true);
     }
     $file = LOGS . 'fooo.log';
     file_put_contents($file, 'Bla');
     $this->assertTrue(file_exists($file));
     $this->Shell->runCommand(['logs', '-v']);
     $output = $this->out->output();
     $this->assertContains('logs' . DS . 'fooo.log', $output);
 }
 /**
  * WhitespaceShellTest::testEof()
  *
  * @return void
  */
 public function testEof()
 {
     $this->Shell->expects($this->any())->method('in')->will($this->returnValue('y'));
     $content = PHP_EOL . ' <?php echo $foo;' . PHP_EOL . '?> ' . PHP_EOL . PHP_EOL;
     file_put_contents(TMP . 'whitespace' . DS . 'Foo.php', $content);
     $this->Shell->runCommand(['eof', TMP . 'whitespace' . DS]);
     $output = $this->out->output();
     //debug($output);die();
     $output = file_get_contents(TMP . 'whitespace' . DS . 'Foo.php');
     $expected = '<?php echo $foo;' . PHP_EOL;
     unlink(TMP . 'whitespace' . DS . 'Foo.php');
     $this->assertEquals($expected, $output);
 }
 /**
  * @return void
  */
 public function testTestEntryCustom()
 {
     $this->Logs = TableRegistry::get('DatabaseLog.DatabaseLogs');
     $this->Shell->runCommand(['test_entry', 'warning', 'My warning']);
     $log = $this->Logs->find()->order(['id' => 'DESC'])->first();
     $this->assertSame('warning', $log->type);
     $this->assertSame('My warning', $log->message);
 }
 /**
  * @expectedException \Cake\Console\Exception\StopException
  * @return void
  */
 public function testTablePrefixAdd()
 {
     $config = ConnectionManager::config('test');
     if (strpos($config['driver'], 'Mysql') === false) {
         $this->skipIf(true, 'Only for MySQL (with MyISAM/InnoDB)');
     }
     $this->Shell->expects($this->any())->method('in')->will($this->returnValue('Y'));
     //$this->expectException(StopException::class);
     //$this->expectExceptionMessage('Nothing to do...');
     $this->Shell->runCommand(['table_prefix', 'A', 'foo_', '-d', '-v']);
 }