public function testSanityCommandTest() { $projectFolder = ProjectUtil::createNewProject("CommandTest", true); $app = new Application($projectFolder, 'CommandTest'); $app->add(new TestCommand()); $result = ProjectUtil::runCommand($projectFolder, 'test:testcommand', [], $app); }
public function testSanity() { $projectFolder = ProjectUtil::createNewProject('sanity', true, false); $this->assertTrue(file_exists("{$projectFolder}/bin/sanity.php")); $this->assertTrue(file_exists("{$projectFolder}/web/css/sanity.css")); $commandTester = ProjectUtil::runCommand($projectFolder, 'list', ['-V --no-ansi'], 'Sanity\\Console\\SanityApplication'); $display = preg_replace('/\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/', '', $commandTester->getDisplay()); $this->assertTrue(stripos($display, "Sanity Command Utility version 1.0") !== false); }
public function testFactoryViewGeneration() { $app = $this->createApplication(); ProjectUtil::runCommand(self::$projectFolder, 'datamodel:generate', ['--configclass' => 'Blend\\Tests\\DataModelBuilder\\Command\\CustomizedModelConfig'], $app); $loader = new ClassLoader(); $loader->addPsr4("DALTest\\", self::$projectFolder . '/src/'); $loader->register(); try { $classRef = new \ReflectionClass('DALTest\\Database\\Common\\Factory\\SysSampleViewFactory'); $this->assertTrue($classRef->hasMethod('getBySecretKey')); $this->assertTrue($classRef->hasMethod('getManyByField1AndGenerateSeries')); $this->assertEquals(1, $classRef->getMethod('getBySecretKey')->getNumberOfParameters()); $this->assertEquals(2, $classRef->getMethod('getManyByField1AndGenerateSeries')->getNumberOfParameters()); } catch (\Exception $ex) { $this->fail($ex->getMessage()); } }