public function testCount()
 {
     $gerador = new Gerador();
     $vector = $gerador->gerar(500);
     $shell = new Shell();
     $array = Asort($vector);
     $this->assertEquals($array, $shell->run($vector));
 }
Example #2
0
 public function testRunShowModeHelp()
 {
     $mode = $this->getMock('\\Migration\\Mode\\Data', [], [], '', false);
     $mode->expects($this->any())->method('getUsageHelp')->willReturn('mode help');
     $this->modeFactory->expects($this->once())->method('create')->with('data')->willReturn($mode);
     $this->shell->setRawArgs(['data', 'help']);
     ob_start();
     $result = $this->shell->run();
     $output = ob_get_contents();
     ob_end_clean();
     $this->assertSame($this->shell, $result);
     $this->assertContains('Usage:', $output);
     $this->assertContains('mode help', $output);
 }
Example #3
0
    /** @var int $maxTries Max number of attempts */
    $maxTries = 8;
    /** @var string $parentDir */
    $parentDir = DIRECTORY_SEPARATOR . '..';
    /** @var string $abstract Assumed location of abstract.php */
    $abstract = $parentDir . (strlen($htdocsDir) > 0 ? DIRECTORY_SEPARATOR . $htdocsDir : '') . DIRECTORY_SEPARATOR . 'shell' . DIRECTORY_SEPARATOR . 'abstract.php';
    // Try one level up each time file is not found
    while (!file_exists(dirname(__FILE__) . $abstract) && $tries++ < 8) {
        $abstract = $parentDir . $abstract;
    }
    // Try to require file
    require_once dirname(__FILE__) . $abstract;
}
class Shell extends Mage_Shell_Abstract
{
    public function run()
    {
        /** @var Mage_CatalogSearch_Model_Fulltext $fulltextModel */
        $fulltextModel = Mage::getModel('catalogsearch/fulltext');
        /** @var string $queryText */
        $queryText = 'shirt';
        /** @var Mage_CatalogSearch_Model_Query $queryObject */
        $queryObject = Mage::getModel('catalogsearch/query')->load(61);
        /** @var St_SphinxSearch_Model_Resource_Fulltext $fulltextResource */
        $fulltextResource = Mage::getResourceModel('st_sphinxsearch/fulltext');
        $fulltextResource->prepareResult($fulltextModel, $queryText, $queryObject);
    }
}
$shell = new Shell();
$shell->run();