<?php /** * */ use Box\TestScribe\_fixture\Directory; require_once __DIR__ . '/../../vendor/autoload.php'; // Instruct the test generator which methods to use to // generate the mock object registration/injection statement. \Box\TestScribe\App::setInjectMockedObjectMethodName('\\Box\\TestScribe\\_fixture\\ServiceLocator::overwrite'); \Box\TestScribe\App::setInjectMockedClassMethodName('\\Box\\TestScribe\\_fixture\\StaticServiceLocator::overwrite'); Directory::init();
<?php use Box\TestScribe\_fixture\_input\TestMethodsProvider; use Box\TestScribe\_fixture\Directory; use Box\TestScribe\_fixture\TestCreator; include_once __DIR__ . '/../bootstrapForTest.php'; // Update the expected generated test files $expectedTestsDir = Directory::getExpectedTestsDir(); $methodsDataArray = TestMethodsProvider::getTestMethods(); foreach ($methodsDataArray as $testMethodData) { list($className, $methodName, $answerFileName) = $testMethodData; TestCreator::createTest($className, $methodName, $expectedTestsDir, $answerFileName); }
/** * Functional test of test generator. * * @param string $className * @param string $methodName * @param string $answerFileName * * @return void */ private function verifyCorrectTestFileIsGenerated($className, $methodName, $answerFileName) { $tempDir = $this->tempDir; $outputFilePath = "{$tempDir}/{$className}" . self::GENERATED_TEST_FILE_SUFFIX; TestCreator::createTest($className, $methodName, $tempDir, $answerFileName); $expectedFilePath = Directory::getExpectedTestsDir() . '/_input/' . $className . self::GENERATED_TEST_FILE_SUFFIX; $this->assertFileEquals($expectedFilePath, $outputFilePath); }