diff --git a/codeception/acceptance/EA07BasicinfoCest.php b/codeception/acceptance/EA07BasicinfoCest.php index 13029500861..8481c26bd7f 100644 --- a/codeception/acceptance/EA07BasicinfoCest.php +++ b/codeception/acceptance/EA07BasicinfoCest.php @@ -81,7 +81,7 @@ public function basicinfo_支払方法入れ替え(AcceptanceTester $I) public function basicinfo_支払方法登録(AcceptanceTester $I) { - $I->getScenario()->skip('EA0705-UC01-T01 支払方法 登録'); + $I->getScenario()->incomplete('EA0705-UC01-T01 支払方法 登録'); $I->wantTo('EA0705-UC01-T01 支払方法 登録'); // 表示 @@ -105,7 +105,7 @@ public function basicinfo_支払方法登録(AcceptanceTester $I) public function basicinfo_支払方法編集(AcceptanceTester $I) { - $I->getScenario()->skip('EA0705-UC01-T01 支払方法 登録'); + $I->getScenario()->incomplete('EA0705-UC01-T01 支払方法 登録'); $I->wantTo('EA0705-UC02-T01 支払方法 編集'); // 表示 diff --git a/codeception/acceptance/EA08SysteminfoCest.php b/codeception/acceptance/EA08SysteminfoCest.php index 8c4aa8997a3..22645f6176e 100644 --- a/codeception/acceptance/EA08SysteminfoCest.php +++ b/codeception/acceptance/EA08SysteminfoCest.php @@ -287,7 +287,7 @@ public function systeminfo_セキュリティ管理SSL(AcceptanceTester $I) { $I->wantTo('EA0804-UC01-T04 セキュリティ管理 - SSL強制'); - $I->getScenario()->skip('このテストを通すと以降のテストが通らなくなってしまっているので一時的にスキップ'); + $I->getScenario()->incomplete('このテストを通すと以降のテストが通らなくなってしまっているので一時的にスキップ'); $httpBaseUrl = $I->getBaseUrl(); $I->amOnUrl($httpBaseUrl); diff --git a/codeception/acceptance/EF02ProductCest.php b/codeception/acceptance/EF02ProductCest.php index e21f756a269..845f34336d9 100644 --- a/codeception/acceptance/EF02ProductCest.php +++ b/codeception/acceptance/EF02ProductCest.php @@ -40,6 +40,7 @@ public function product_商品一覧初期表示(AcceptanceTester $I) public function product_商品一覧ヘッダ以外のカテゴリリンク(AcceptanceTester $I) { + $I->getScenario()->incomplete('テスト項目を要確認'); $I->wantTo('EF0201-UC01-T02 商品一覧ページ ヘッダ以外のカテゴリリンク'); $I->amOnPage('/'); diff --git a/tests/Eccube/Tests/Command/PluginDevelopEntityFromDbTest.php b/tests/Eccube/Tests/Command/PluginDevelopEntityFromDbTest.php deleted file mode 100644 index d806cd2060c..00000000000 --- a/tests/Eccube/Tests/Command/PluginDevelopEntityFromDbTest.php +++ /dev/null @@ -1,385 +0,0 @@ -markTestIncomplete(get_class($this).' は未実装です'); - parent::setUp(); - - $this->markTestIncomplete(); - - $this->initCommand(new PluginCommand()); - } - - public function testFirst() - { - // TODO question helperのunit testの実装方法を変更 - // http://symfony.com/doc/current/components/console/helpers/questionhelper.html - $this->markTestSkipped(); - - $code = 'PluginUnittestSample'; - - $codePath = $this->app['config']['root_dir'].'/app/Plugin/'.$code; - $this->removePluginDir($codePath); - $this->createPluginDir($codePath); - - $this->dropTable($code); - $this->createTable($code); - $tableName = 'plg_'.strtolower($code); - - $testCase = [ - //プラグイン名 - 'entity' => [ - [ - 'input' => 'd', - ], - ], - //プラグインコード - 1 => [ - [ - 'input' => '', - 'output' => 'Value cannot be empty', - ], - [ - 'input' => 'テストプラグイン名', - 'output' => 'Please enter Plugin Code (First letter is uppercase alphabet only. alphabet and numbers are allowed.)', - ], - [ - 'input' => strtolower($code), - 'output' => 'Please enter Plugin Code (First letter is uppercase alphabet only. alphabet and numbers are allowed.)', - ], - [ - 'input' => $code, - 'output' => 'Table name:', - ], - ], - //Table name: - 2 => [ - [ - 'input' => 'plg_', - 'output' => [ - 'No results have been found', - $tableName, - ], - ], - [ - 'input' => $tableName, - 'output' => [ - 'your entry list', - $tableName, - ], - ], - [ - 'input' => '', - ], - ], - //supportFlag - 3 => [ - [ - 'input' => '', - 'output' => 'Value cannot be empty', - ], - [ - 'input' => 'a', - 'output' => 'No results have been found', - ], - [ - 'input' => 'y', - ], - ], - //確認 - 'confirm' => [ - [ - 'output' => [ - $tableName, - ], - ], - [ - 'input' => 'y', - ], - ], - ]; - $this->setTestCase($testCase); - - $commandArg = [ - 'command' => 'plugin:develop', - 'mode' => 'entity', - '--no-ansi' => true, - ]; - - $this->executeTester([$this, 'checkQuestion'], $commandArg); - - //ファイルとフォルダー作成確認 - $ff = [ - $codePath, - $codePath.'/Entity', - $codePath.'/Entity/'.ucfirst(strtolower($code)).'.php', - $codePath.'/Repository', - $codePath.'/Repository/'.ucfirst(strtolower($code)).'Repository.php', - $codePath.'/Resource', - $codePath.'/Resource/doctrine', - $codePath.'/Resource/doctrine/Plugin.'.$code.'.Entity.'.ucfirst(strtolower($code)).'.dcm.yml', - $codePath.'/Resource/doctrine/migration', - ]; - - $this->checkFileAndFolder($ff); - $this->removePluginDir($codePath); - $this->removePluginDb($code); - } - - public function checkQuestion($text, Question $question) - { - $output = $this->getLastContent(); - foreach ($this->testCase as $no => $row) { - if (is_numeric($no)) { - $searchStr = $this->getQuestionMark($no); - } else { - $searchStr = $no; - } - if (strpos($text, $searchStr) !== false) { - foreach ($row as $subNo => $case) { - $ret = null; - if (isset($case['input'])) { - $ret = $case['input']; - unset($this->testCase[$no][$subNo]['input']); - } elseif (isset($case['output'])) { - if (is_array($case['output'])) { - $checkOutput = $case['output']; - } else { - $checkOutput = [$case['output']]; - } - foreach ($checkOutput as $node) { - $this->assertInOutput($output, $node); - } - unset($this->testCase[$no][$subNo]['output']); - } - if ($ret !== null) { - return $ret; - } - continue; - } - } - } - - throw new \Exception('Test case not set.'.PHP_EOL.' output='.$output); - } - - protected function assertInOutput($output, $msg) - { - if (strpos($output, $msg) !== false) { - $this->assertTrue(true); - - return true; - } - $error = 'Input string not found in output.'.PHP_EOL.' search='.$msg.PHP_EOL.' output='.$output.''.PHP_EOL; - $this->assertTrue(false, $error); - - return false; - } - - protected function setTestCase($testCase) - { - $this->testCase = $testCase; - } - - protected function removePluginDir($pluginPath) - { - if (!empty($pluginPath) && file_exists($pluginPath)) { - $fs = new Filesystem(); - $fs->remove($pluginPath); - } - } - - protected function createPluginDir($codePath) - { - if (!is_dir($codePath)) { - mkdir($codePath); - } - } - - protected function removePluginDb($code) - { - /* @var $entityManager \Doctrine\ORM\EntityManager */ - $entityManager = $this->app['orm.em']; - - $entityManager->clear(); - $pluginList = $entityManager->getRepository('\Eccube\\Entity\Plugin')->findBy(['code' => $code]); - if ($pluginList) { - foreach ($pluginList as $plugin) { - $entityManager->remove($plugin); - } - $entityManager->flush(); - } - } - - protected function checkFileAndFolder($ff) - { - foreach ($ff as $path) { - $msg = 'fail assert that a file/path exists.('.$path.')'; - $this->assertTrue(file_exists($path), $msg); - } - } - - private function dropTable($code) - { - $tableName = 'plg_'.strtolower($code); - - /* @var $entityManager \Doctrine\ORM\EntityManager */ - $entityManager = $this->app['orm.em']; - /* @var $schema \Doctrine\DBAL\Schema\Schema */ - $schema = $entityManager->getConnection()->getSchemaManager()->createSchema(); - $dbName = $schema->getName(); - $tableNames = array_flip($schema->getTableNames()); - - if (!isset($tableNames[$dbName.'.'.$tableName])) { - return; - } - - $toSchema = clone $schema; - - $toSchema->dropTable($tableName); - $platform = $entityManager->getConnection()->getDatabasePlatform(); - $queries = $schema->getMigrateToSql($toSchema, $platform); - - if (is_array($queries)) { - foreach ($queries as $query) { - $entityManager->getConnection()->executeQuery($query); - } - } - } - - private function createTable($code) - { - $schema = new \Doctrine\DBAL\Schema\Schema(); - $table = $schema->createTable('plg_'.strtolower($code)); - $table->addColumn('id', 'integer', [ - 'notnull' => true, - 'unsigned' => true, - 'autoincrement' => true, - 'comment' => '問合せID', - ]); - $table->addColumn('contact_type', 'integer', [ - 'notnull' => true, - 'comment' => '問合せ種別', - ]); - $table->addColumn('contents', 'string', [ - 'notnull' => true, - 'comment' => '問合せ内容', - 'length' => '4096', - ]); - $table->addColumn('customer_id', 'integer', [ - 'notnull' => false, - 'unsigned' => true, - 'comment' => 'M顧客ID', - ]); - $table->addColumn('name_sei', 'string', [ - 'notnull' => true, - 'comment' => '名前(姓)', - 'length' => '64', - ]); - $table->addColumn('name_mei', 'string', [ - 'notnull' => true, - 'comment' => '名前(名)', - 'length' => '64', - ]); - $table->addColumn('kana_sei', 'string', [ - 'notnull' => true, - 'comment' => 'カナ(姓)', - 'length' => '64', - ]); - $table->addColumn('kana_mei', 'string', [ - 'notnull' => true, - 'comment' => 'カナ(名)', - 'length' => '64', - ]); - $table->addColumn('email', 'string', [ - 'notnull' => true, - 'comment' => 'メールアドレス', - 'length' => '256', - ]); - $table->addColumn('phone', 'string', [ - 'notnull' => true, - 'comment' => '電話番号', - 'length' => '16', - ]); - $table->addColumn('postal_code', 'string', [ - 'notnull' => false, - 'comment' => '郵便番号', - 'length' => '8', - ]); - $table->addColumn('pref_id', 'integer', [ - 'notnull' => false, - 'comment' => '都道府県ID', - ]); - $table->addColumn('addr01', 'string', [ - 'notnull' => false, - 'comment' => '住所01', - 'length' => '128', - ]); - $table->addColumn('addr02', 'string', [ - 'notnull' => false, - 'comment' => '住所02', - 'length' => '128', - ]); - $table->addColumn('note', 'string', [ - 'notnull' => false, - 'comment' => '備考', - 'length' => '1024', - ]); - $table->addColumn('process_status', 'integer', [ - 'notnull' => true, - 'comment' => '対応状況(ステータス)', - ]); - $table->addColumn('create_datetime', 'datetime', [ - 'notnull' => true, - 'default' => '2000-01-01 00:00:00', - 'comment' => '作成日付', - ]); - $table->addColumn('update_datetime', 'datetime', [ - 'notnull' => false, - 'comment' => '更新日付', - ]); - - $table->setPrimaryKey(['id']); - /* @var $entityManager \Doctrine\ORM\EntityManager */ - $entityManager = $this->app['orm.em']; - $platform = $entityManager->getConnection()->getDatabasePlatform(); - $queries = $schema->toSql($platform); - - if (is_array($queries)) { - foreach ($queries as $query) { - $entityManager->getConnection()->executeQuery($query); - } - } - } - - public function tearDown() - { - $this->app->initDoctrine(); - } -} diff --git a/tests/Eccube/Tests/Command/PluginDevelopEntityFromYamlTest.php b/tests/Eccube/Tests/Command/PluginDevelopEntityFromYamlTest.php deleted file mode 100644 index 1103bb98949..00000000000 --- a/tests/Eccube/Tests/Command/PluginDevelopEntityFromYamlTest.php +++ /dev/null @@ -1,319 +0,0 @@ -markTestIncomplete(get_class($this).' は未実装です'); - parent::setUp(); - - $this->markTestIncomplete(); - - if ($this->app['config']['database']['driver'] == 'pdo_sqlite') { - $this->markTestSkipped('Can not support for sqlite3'); - } - - $this->initCommand(new PluginCommand()); - } - - public function testFirst() - { - // TODO question helperのunit testの実装方法を変更 - // http://symfony.com/doc/current/components/console/helpers/questionhelper.html - $this->markTestSkipped(); - - $code = 'PluginUnittestSample'; - - $codePath = $this->app['config']['root_dir'].'/app/Plugin/'.$code; - $this->removePluginDir($codePath); - $this->createPluginDir($codePath, $code); - - $yamlName = 'Plugin.'.$code.'.Entity.'.ucfirst(strtolower($code)).'.dcm.yml'; - - $testCase = [ - //プラグイン名 - 'entity' => [ - [ - 'input' => 'y', - ], - ], - //プラグインコード - 1 => [ - [ - 'input' => '', - 'output' => 'Value cannot be empty', - ], - [ - 'input' => 'テストプラグイン名', - 'output' => 'Please enter Plugin Code (First letter is uppercase alphabet only. alphabet and numbers are allowed.)', - ], - [ - 'input' => strtolower($code), - 'output' => 'Please enter Plugin Code (First letter is uppercase alphabet only. alphabet and numbers are allowed.)', - ], - [ - 'input' => $code, - 'output' => 'Table name:', - ], - ], - //Table name: - 2 => [ - [ - 'input' => $code, - 'output' => [ - 'No results have been found', - $yamlName, - ], - ], - [ - 'input' => $yamlName, - 'output' => [ - 'your entry list', - $yamlName, - ], - ], - [ - 'input' => '', - ], - ], - //supportFlag - 3 => [ - [ - 'input' => '', - 'output' => 'Value cannot be empty', - ], - [ - 'input' => 'a', - 'output' => 'No results have been found', - ], - [ - 'input' => 'y', - ], - ], - //確認 - 'confirm' => [ - [ - 'output' => [ - $yamlName, - ], - ], - [ - 'input' => 'y', - ], - ], - ]; - $this->setTestCase($testCase); - - $commandArg = [ - 'command' => 'plugin:develop', - 'mode' => 'entity', - '--no-ansi' => true, - ]; - - $this->executeTester([$this, 'checkQuestion'], $commandArg); - - //ファイルとフォルダー作成確認 - $ff = [ - $codePath, - $codePath.'/Entity', - $codePath.'/Entity/'.ucfirst(strtolower($code)).'.php', - $codePath.'/Repository', - $codePath.'/Repository/'.ucfirst(strtolower($code)).'Repository.php', - $codePath.'/Resource', - $codePath.'/Resource/doctrine', - $codePath.'/Resource/doctrine/Plugin.'.$code.'.Entity.'.ucfirst(strtolower($code)).'.dcm.yml', - $codePath.'/Resource/doctrine/migration', - ]; - $this->checkFileAndFolder($ff); - $this->removePluginDir($codePath); - } - - public function checkQuestion($text, Question $question) - { - $output = $this->getLastContent(); - foreach ($this->testCase as $no => $row) { - if (is_numeric($no)) { - $searchStr = $this->getQuestionMark($no); - } else { - $searchStr = $no; - } - if (strpos($text, $searchStr) !== false) { - foreach ($row as $subNo => $case) { - $ret = null; - if (isset($case['input'])) { - $ret = $case['input']; - unset($this->testCase[$no][$subNo]['input']); - } elseif (isset($case['output'])) { - if (is_array($case['output'])) { - $checkOutput = $case['output']; - } else { - $checkOutput = [$case['output']]; - } - foreach ($checkOutput as $node) { - $this->assertInOutput($output, $node); - } - unset($this->testCase[$no][$subNo]['output']); - } - if ($ret !== null) { - return $ret; - } - continue; - } - } - } - - throw new \Exception('Test case not set.'.PHP_EOL.' output='.$output); - } - - protected function assertInOutput($output, $msg) - { - if (strpos($output, $msg) !== false) { - $this->assertTrue(true); - - return true; - } - $error = 'Input string not found in output.'.PHP_EOL.' search='.$msg.PHP_EOL.' output='.$output.''.PHP_EOL; - $this->assertTrue(false, $error); - - return false; - } - - protected function setTestCase($testCase) - { - $this->testCase = $testCase; - } - - protected function removePluginDir($pluginPath) - { - if (!empty($pluginPath) && file_exists($pluginPath)) { - $fs = new Filesystem(); - $fs->remove($pluginPath); - } - } - - protected function createPluginDir($codePath, $code) - { - if (!is_dir($codePath)) { - mkdir($codePath); - } - - $codePath .= '/Resource'; - if (!is_dir($codePath)) { - mkdir($codePath); - } - $codePath .= '/doctrine'; - if (!is_dir($codePath)) { - mkdir($codePath); - } - $yamlPath = $codePath.'/Plugin.'.$code.'.Entity.'.ucfirst(strtolower($code)).'.dcm.yml'; - if (!is_file($yamlPath)) { - } - if (!is_file($yamlPath)) { - $body = $this->createYamlBody($code); - file_put_contents($yamlPath, $body); - } - } - - protected function checkFileAndFolder($ff) - { - foreach ($ff as $path) { - $msg = 'fail assert that a file/path exists.('.$path.')'; - $this->assertTrue(file_exists($path), $msg); - } - } - - private function createYamlBody($code) - { - $body = 'Plugin\\'.$code."\Entity\\".ucfirst(strtolower($code)).': - type: entity - table: plg_'.strtolower($code).' - repositoryClass: Plugin\\'.$code."\Repository\\".ucfirst(strtolower($code))."Repository - id: - id: - type: integer - nullable: false - unsigned: true - id: true - column: id - generator: - strategy: AUTO - fields: - contact_type: - type: integer - nullable: false - contents: - type: string - nullable: false - customer_id: - type: integer - nullable: true - unsigned: true - name_sei: - type: string - nullable: false - name_mei: - type: string - nullable: false - kana_sei: - type: string - nullable: false - kana_mei: - type: string - nullable: false - email: - type: string - nullable: false - phone: - type: string - nullable: false - postal_code: - type: string - nullable: true - pref_id: - type: integer - nullable: true - addr01: - type: string - nullable: true - addr02: - type: string - nullable: true - note: - type: string - nullable: true - process_status: - type: integer - nullable: false - create_datetime: - type: datetime - nullable: false - options: - default: '2000-01-01 00:00:00' - update_datetime: - type: datetime - nullable: true - lifecycleCallbacks: { } - "; - - return $body; - } -} diff --git a/tests/Eccube/Tests/Command/PluginDevelopGenerateTest.php b/tests/Eccube/Tests/Command/PluginDevelopGenerateTest.php deleted file mode 100644 index 65992ac8b93..00000000000 --- a/tests/Eccube/Tests/Command/PluginDevelopGenerateTest.php +++ /dev/null @@ -1,352 +0,0 @@ -markTestIncomplete(get_class($this).' は未実装です'); - parent::setUp(); - - $this->markTestIncomplete(); - - if ($this->app['config']['database']['driver'] == 'pdo_sqlite') { - $this->markTestSkipped('Can not support for sqlite3'); - } - - $this->initCommand(new PluginCommand()); - } - - public function testFirst() - { - // TODO question helperのunit testの実装方法を変更 - // http://symfony.com/doc/current/components/console/helpers/questionhelper.html - $this->markTestSkipped(); - - $code = 'PluginUnittestSample'; - - $codePath = $this->app['config']['root_dir'].'/app/Plugin/'.$code; - $this->removePluginDir($codePath); - $this->removePluginDb($code); - - $testCase = [ - //プラグイン名 - 1 => [ - [ - 'input' => '', - 'output' => 'Value cannot be empty', - ], - [ - 'input' => 'Plugin Name', - 'output' => 'Plugin Code:', - ], - ], - //プラグインコード - 2 => [ - [ - 'input' => '', - 'output' => 'Value cannot be empty', - ], - [ - 'input' => 'Plugin Code', - 'output' => 'Please enter Plugin Code (First letter is uppercase alphabet only. alphabet and numbers are allowed.)', - ], - [ - 'input' => strtolower($code), - 'output' => 'Please enter Plugin Code (First letter is uppercase alphabet only. alphabet and numbers are allowed.', - ], - [ - 'input' => $code, - 'output' => 'Version:', - ], - ], - //バージョン - 3 => [ - [ - 'input' => '', - 'output' => 'Value cannot be empty', - ], - [ - 'input' => 'ひらがな', - 'output' => 'correct format is x.y.z', - ], - [ - 'input' => 'alphabet', - 'output' => 'correct format is x.y.z', - ], - [ - 'input' => '1.0.0', - 'output' => 'Author:', - ], - ], - //バージョン - 4 => [ - [ - 'input' => '', - 'output' => 'Value cannot be empty', - ], - [ - 'input' => 'Author Name', - 'output' => 'Old version support:', - ], - ], - //サーポットバージョン - 5 => [ - [ - 'input' => '', - 'output' => 'Value cannot be empty', - ], - [ - 'input' => 'a', - 'output' => 'No results have been found', - ], - [ - 'input' => 'y', - 'output' => 'Site events:', - ], - ], - //サイト共通イベント - 6 => [ - [ - 'input' => 'entry', - 'output' => [ - 'there are more then one search result', - 'eccube.event.render.entry.before', - ], - ], - [ - 'input' => 'eccube.event.render.entry.before', - 'output' => [ - 'your entry list', - 'eccube.event.render.entry.before', - ], - ], - [ - 'input' => 'product_list', - 'output' => [ - 'there are more then one search result', - 'eccube.event.render.product_list.before', - ], - ], - [ - 'input' => 'eccube.event.render.product_list.before', - 'output' => [ - 'your entry list', - 'eccube.event.render.product_list.before', - ], - ], - [ - 'input' => '', - ], - ], - //フックポイント - 7 => [ - [ - 'input' => 'entry', - 'output' => [ - 'No results have been found', - 'front.entry.index.initialize', - ], - ], - [ - 'input' => 'front.entry.index.initialize', - 'output' => [ - 'your entry list', - 'front.entry.index.initialize', - ], - ], - [ - 'input' => 'change_password', - 'output' => [ - 'No results have been found', - 'admin.admin.change_password.complete', - ], - ], - [ - 'input' => 'admin.admin.change_password.complete', - 'output' => [ - 'your entry list', - 'admin.admin.change_password.complete', - ], - ], - [ - 'input' => '', - ], - ], - //orm.path - 8 => [ - [ - 'input' => '', - 'output' => 'Value cannot be empty', - ], - [ - 'input' => 'a', - 'output' => 'No results have been found', - ], - [ - 'input' => 'y', - 'output' => 'Use orm.path:', - ], - ], - //確認 - 'confirm' => [ - [ - 'output' => [ - 'Plugin Name', - $code, - '1.0.0', - 'Author Name', - 'Yes', - 'eccube.event.render.entry.before', - 'eccube.event.render.product_list.before', - 'front.entry.index.initialize', - 'admin.admin.change_password.complete', - 'Yes', - ], - ], - [ - 'input' => 'y', - 'output' => '', - ], - ], - ]; - $this->setTestCase($testCase); - - $commandArg = [ - 'command' => 'plugin:develop', - 'mode' => 'generate', - '--no-ansi' => true, - ]; - - $this->executeTester([$this, 'checkQuestion'], $commandArg); - - //ファイルとフォルダー作成確認 - $ff = [ - $codePath, - $codePath.'/ServiceProvider', - $codePath.'/ServiceProvider/'.$code.'ServiceProvider.php', - $codePath.'/Controller', - $codePath.'/Form/Type', - $codePath.'/Resource/template/admin', - $codePath.'/config.yml', - $codePath.'/PluginManager.php', - $codePath.'/Controller/ConfigController.php', - $codePath.'/Controller/'.$code.'Controller.php', - $codePath.'/Form/Type/'.$code.'ConfigType.php', - $codePath.'/Resource/template/admin/config.twig', - $codePath.'/Resource/template/index.twig', - $codePath.'/event.yml', - $codePath.'/'.$code.'Event.php', - $codePath.'/LICENSE', - ]; - - $this->checkFileAndFolder($ff); - - $this->removePluginDir($codePath); - $this->removePluginDb($code); - } - - public function checkQuestion($text, Question $question) - { - $output = $this->getLastContent(); - foreach ($this->testCase as $no => $row) { - if (is_numeric($no)) { - $searchStr = $this->getQuestionMark($no); - } else { - $searchStr = $no; - } - if (strpos($text, $searchStr) !== false) { - foreach ($row as $subNo => $case) { - $ret = null; - if (isset($case['input'])) { - $ret = $case['input']; - unset($this->testCase[$no][$subNo]['input']); - } elseif (isset($case['output'])) { - if (is_array($case['output'])) { - $checkOutput = $case['output']; - } else { - $checkOutput = [$case['output']]; - } - foreach ($checkOutput as $node) { - $this->assertInOutput($output, $node); - } - unset($this->testCase[$no][$subNo]['output']); - } - if ($ret !== null) { - return $ret; - } - continue; - } - } - } - - throw new \Exception('Test case not set.'.PHP_EOL.' output='.$output); - } - - protected function assertInOutput($output, $msg) - { - if (strpos($output, $msg) !== false) { - $this->assertTrue(true); - - return true; - } - $error = 'Input string not found in output.'.PHP_EOL.' search='.$msg.PHP_EOL.' output='.$output.''.PHP_EOL; - $this->assertTrue(false, $error); - - return false; - } - - protected function setTestCase($testCase) - { - $this->testCase = $testCase; - } - - protected function removePluginDir($pluginPath) - { - if (!empty($pluginPath) && file_exists($pluginPath)) { - $fs = new Filesystem(); - $fs->remove($pluginPath); - } - } - - protected function removePluginDb($code) - { - /* @var $entityManager \Doctrine\ORM\EntityManager */ - $entityManager = $this->app['orm.em']; - - $entityManager->clear(); - $pluginList = $entityManager->getRepository('\Eccube\\Entity\Plugin')->findBy(['code' => $code]); - if ($pluginList) { - foreach ($pluginList as $plugin) { - $entityManager->remove($plugin); - } - $entityManager->flush(); - } - } - - protected function checkFileAndFolder($ff) - { - foreach ($ff as $path) { - $msg = 'fail assert that a file/path exists.('.$path.')'; - $this->assertTrue(file_exists($path), $msg); - } - } -} diff --git a/tests/Eccube/Tests/Command/QuestionHelperMock.php b/tests/Eccube/Tests/Command/QuestionHelperMock.php deleted file mode 100644 index 12e57ba0049..00000000000 --- a/tests/Eccube/Tests/Command/QuestionHelperMock.php +++ /dev/null @@ -1,64 +0,0 @@ -markTestIncomplete(get_class($this).' は未実装です'); - parent::setUp(); - } - - /** - * @var callable - */ - private $mockHandler; - - /** - * @param callable - */ - public function setMockHandler($mockHandler) - { - $this->mockHandler = $mockHandler; - } - - /** - * @param OutputInterface - * @param Question - */ - public function doAsk(OutputInterface $output, Question $question) - { - $this->writePrompt($output, $question); - $output->write(' => '); - - $response = call_user_func($this->mockHandler, $question->getQuestion(), $question); - - if (strlen($response) <= 0) { - $response = $question->getDefault(); - } - - if ($normalizer = $question->getNormalizer()) { - $response = $normalizer($response); - } - - $output->writeln(print_r($response, true)); - - return $response; - } -} diff --git a/tests/Eccube/Tests/EventListener/ForwardOnlyListenerTest.php b/tests/Eccube/Tests/EventListener/ForwardOnlyListenerTest.php deleted file mode 100644 index 41c98217f6f..00000000000 --- a/tests/Eccube/Tests/EventListener/ForwardOnlyListenerTest.php +++ /dev/null @@ -1,31 +0,0 @@ -markTestIncomplete('function shopping is not implement'); - try { - $this->client->request('GET', $this->generateUrl('shopping_check_to_cart')); - self::fail(); - } catch (AccessDeniedHttpException$e) { - self::assertEquals('Eccube\Controller\ShoppingController:checkToCart is Forward Only', $e->getMessage()); - } - } -} diff --git a/tests/Eccube/Tests/Form/Type/Admin/LogTypeTest.php b/tests/Eccube/Tests/Form/Type/Admin/LogTypeTest.php index 9122df64005..9df68d81aab 100644 --- a/tests/Eccube/Tests/Form/Type/Admin/LogTypeTest.php +++ b/tests/Eccube/Tests/Form/Type/Admin/LogTypeTest.php @@ -63,9 +63,6 @@ public function tearDown() public function testValidData() { - if (!file_exists($this->logTest)) { - $this->markTestSkipped('テスト時には'.$this->fileName.'は存在しないのでテストできない'); - } $this->form->submit($this->formData); $this->assertTrue($this->form->isValid()); } diff --git a/tests/Eccube/Tests/Form/Type/Install/Step4TypeTest.php b/tests/Eccube/Tests/Form/Type/Install/Step4TypeTest.php index 040f8c9af53..e3e790c72e2 100644 --- a/tests/Eccube/Tests/Form/Type/Install/Step4TypeTest.php +++ b/tests/Eccube/Tests/Form/Type/Install/Step4TypeTest.php @@ -48,7 +48,7 @@ public function setUp() public function testInvalidData() { // Request に依存しているため WebTest で代替する - $this->markTestSkipped('Can not support of FormInterface::submit()'); + $this->markTestIncomplete('Can not support of FormInterface::submit()'); $this->form->submit($this->formData); $this->assertFalse($this->form->isValid()); diff --git a/tests/Eccube/Tests/Repository/AbstractRepositoryTestCase.php b/tests/Eccube/Tests/Repository/AbstractRepositoryTestCase.php deleted file mode 100644 index 5d953b636d2..00000000000 --- a/tests/Eccube/Tests/Repository/AbstractRepositoryTestCase.php +++ /dev/null @@ -1,43 +0,0 @@ -markTestIncomplete(get_class($this).' は未実装です'); - parent::setUp(); - } - - /** - * {@inheritdoc} - */ - public function createApplication() - { - $app = new Application(); - $app->initialize(); - $app['session.test'] = true; - $app['exception_handler']->disable(); - - $app->boot(); - - return $app; - } -} diff --git a/tests/Eccube/Tests/Service/EntityProxyServiceTest.php b/tests/Eccube/Tests/Service/EntityProxyServiceTest.php index 944977a7d8e..ffed2217416 100644 --- a/tests/Eccube/Tests/Service/EntityProxyServiceTest.php +++ b/tests/Eccube/Tests/Service/EntityProxyServiceTest.php @@ -87,7 +87,7 @@ public function testGenerate() public function testGenerateFromOriginalFile() { - $this->markTestSkipped(); + $this->markTestIncomplete(); $findSequence = static function (Tokens $tokens) { return $tokens->findSequence([ diff --git a/tests/Eccube/Tests/Service/MailServiceTest.php b/tests/Eccube/Tests/Service/MailServiceTest.php index e8131eae841..e2a99b47804 100644 --- a/tests/Eccube/Tests/Service/MailServiceTest.php +++ b/tests/Eccube/Tests/Service/MailServiceTest.php @@ -391,7 +391,7 @@ public function testSendPasswordResetCompleteMail() public function testConvertMessageISO() { // TODO https://github.com/EC-CUBE/ec-cube/issues/2402#issuecomment-362487022 - $this->markTestSkipped('実装確認中のためスキップ'); + $this->markTestIncomplete('実装確認中のためスキップ'); $config = $this->app['config']; $config['mail']['charset_iso_2022_jp'] = true; $this->app['config'] = $config; @@ -426,7 +426,7 @@ public function testConvertMessageISO() public function testConvertMessageUTF() { // TODO https://github.com/EC-CUBE/ec-cube/issues/2402#issuecomment-362487022 - $this->markTestSkipped('実装確認中のためスキップ'); + $this->markTestIncomplete('実装確認中のためスキップ'); $config = $this->app['config']; $config['mail']['charset_iso_2022_jp'] = false; @@ -460,7 +460,7 @@ public function testConvertMessageUTF() */ public function testSendShippingNotifyMail() { - $this->markTestSkipped('実装確認中のためスキップ'); + $this->markTestIncomplete('実装確認中のためスキップ'); $Order = $this->Order; /** @var Shipping $Shipping */ $Shipping = $Order->getShippings()->first(); diff --git a/tests/Eccube/Tests/Service/Payment/PaymentMethodTest.php b/tests/Eccube/Tests/Service/Payment/PaymentMethodTest.php index 7b4270d94d4..ff4b371c54e 100644 --- a/tests/Eccube/Tests/Service/Payment/PaymentMethodTest.php +++ b/tests/Eccube/Tests/Service/Payment/PaymentMethodTest.php @@ -19,7 +19,7 @@ class PaymentMethodTest extends EccubeTestCase { public function testConstructorInjection() { - $this->markTestSkipped(); + $this->markTestIncomplete(); $Customer = $this->createCustomer(); $Order = $this->createOrder($Customer); diff --git a/tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php b/tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php index 0ca7ab42a4c..a65cbfd48ae 100644 --- a/tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php +++ b/tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php @@ -165,8 +165,6 @@ public function testNotUpdateLastBuyDate() public function testOrderCustomerInfo() { - $this->markTestSkipped('顧客の購入回数と購入金額の実装が完了するまでスキップ'); - $this->markTestIncomplete('EditController is not implemented.'); $Customer = $this->createCustomer(); $Order = $this->createOrder($Customer); $Order->setOrderStatus($this->entityManager->find(OrderStatus::class, OrderStatus::NEW)); @@ -304,7 +302,7 @@ public function testOrderProcessingToFrontConfirm() $this->actual = $EditedOrder->getOrderStatus()->getId(); $this->verify(); - $this->markTestSkipped('フロントとのセッション管理の実装が完了するまでスキップ'); + $this->markTestIncomplete('フロントとのセッション管理の実装が完了するまでスキップ'); // フロント側から, product_class_id = 1 をカート投入 $client = $this->createClient(); $client->request( diff --git a/tests/Eccube/Tests/Web/Admin/Order/EditControllerWithMultipleTest.php b/tests/Eccube/Tests/Web/Admin/Order/EditControllerWithMultipleTest.php index 4b7c5607414..3476833e021 100644 --- a/tests/Eccube/Tests/Web/Admin/Order/EditControllerWithMultipleTest.php +++ b/tests/Eccube/Tests/Web/Admin/Order/EditControllerWithMultipleTest.php @@ -40,7 +40,7 @@ public function setUp() public function testRoutingAdminOrderNew() { - $this->markTestSkipped('新しい配送管理の実装が完了するまでスキップ'); + $this->markTestIncomplete('新しい配送管理の実装が完了するまでスキップ'); $this->client->request('GET', $this->app->url('admin_order_new')); $this->assertTrue($this->client->getResponse()->isSuccessful()); @@ -48,7 +48,7 @@ public function testRoutingAdminOrderNew() public function testRoutingAdminOrderNewPost() { - $this->markTestSkipped('新しい配送管理の実装が完了するまでスキップ'); + $this->markTestIncomplete('新しい配送管理の実装が完了するまでスキップ'); $Shippings = []; $Shippings[] = $this->createShipping($this->Product->getProductClasses()->toArray()); @@ -68,7 +68,7 @@ public function testRoutingAdminOrderNewPost() public function testRoutingAdminOrderEdit() { - $this->markTestSkipped('新しい配送管理の実装が完了するまでスキップ'); + $this->markTestIncomplete('新しい配送管理の実装が完了するまでスキップ'); $Customer = $this->createCustomer(); $Order = $this->createOrder($Customer); @@ -79,7 +79,7 @@ public function testRoutingAdminOrderEdit() public function testRoutingAdminOrderEditPost() { - $this->markTestSkipped('新しい配送管理の実装が完了するまでスキップ'); + $this->markTestIncomplete('新しい配送管理の実装が完了するまでスキップ'); $Shippings = []; $Shippings[] = $this->createShipping($this->Product->getProductClasses()->toArray()); @@ -189,7 +189,7 @@ public function testSearchProduct() */ public function testOrderProcessingToFrontConfirm() { - $this->markTestSkipped('新しい配送管理の実装が完了するまでスキップ'); + $this->markTestIncomplete('新しい配送管理の実装が完了するまでスキップ'); $Customer = $this->createCustomer(); $Order = $this->createOrder($Customer); @@ -283,7 +283,7 @@ public function testOrderProcessingToFrontConfirm() */ public function testOrderProcessingWithTax() { - $this->markTestSkipped('新しい配送管理の実装が完了するまでスキップ'); + $this->markTestIncomplete('新しい配送管理の実装が完了するまでスキップ'); $Shippings = []; $Shippings[] = $this->createShipping($this->Product->getProductClasses()->toArray()); @@ -338,7 +338,7 @@ public function testOrderProcessingWithTax() public function testOrderEditWithShippingItemDelete() { - $this->markTestSkipped('新しい配送管理の実装が完了するまでスキップ'); + $this->markTestIncomplete('新しい配送管理の実装が完了するまでスキップ'); $Shippings = []; $Shippings[] = $this->createShipping($this->Product->getProductClasses()->toArray()); @@ -398,7 +398,7 @@ public function testOrderEditWithShippingItemDelete() public function testOrderEditWithShippingDelete() { - $this->markTestSkipped('新しい配送管理の実装が完了するまでスキップ'); + $this->markTestIncomplete('新しい配送管理の実装が完了するまでスキップ'); $Shippings = []; $Shippings[] = $this->createShipping($this->Product->getProductClasses()->toArray()); diff --git a/tests/Eccube/Tests/Web/Admin/Order/OrderControllerTest.php b/tests/Eccube/Tests/Web/Admin/Order/OrderControllerTest.php index 85eb2c0b2c4..63fd86a8ed8 100644 --- a/tests/Eccube/Tests/Web/Admin/Order/OrderControllerTest.php +++ b/tests/Eccube/Tests/Web/Admin/Order/OrderControllerTest.php @@ -336,7 +336,7 @@ public function testSearchWithEmail() */ public function testBulkOrderStatus($orderStatusId) { - $this->markTestSkipped('使用していないルーティングのためスキップ.'); + $this->markTestIncomplete('使用していないルーティングのためスキップ.'); // case true $orderIds = []; /** @var Order[] $Orders */ diff --git a/tests/Eccube/Tests/Web/Mypage/MypageControllerTest.php b/tests/Eccube/Tests/Web/Mypage/MypageControllerTest.php index ee289b6dd50..0be64dcad13 100644 --- a/tests/Eccube/Tests/Web/Mypage/MypageControllerTest.php +++ b/tests/Eccube/Tests/Web/Mypage/MypageControllerTest.php @@ -108,8 +108,6 @@ public function testIndex() public function testHistory() { - $this->markTestIncomplete('新しい配送管理の実装が完了するまでスキップ'); - $Product = $this->createProduct(); $ProductClasses = $Product->getProductClasses(); // 後方互換のため最初の1つのみ渡す diff --git a/tests/Eccube/Tests/Web/ShoppingControllerTest.php b/tests/Eccube/Tests/Web/ShoppingControllerTest.php index 3f4f819915f..dc2d4877374 100644 --- a/tests/Eccube/Tests/Web/ShoppingControllerTest.php +++ b/tests/Eccube/Tests/Web/ShoppingControllerTest.php @@ -402,7 +402,7 @@ public function testShippingChangeWithPost() */ public function testShippingShippingPost() { - $this->markTestSkipped('新しい配送管理の実装が完了するまでスキップ'); + $this->markTestIncomplete('新しい配送管理の実装が完了するまでスキップ'); $faker = $this->getFaker(); $Customer = $this->logIn();