Completed
Push — dev/plugin-misc ( 2bf309...774d40 )
by Kiyotaka
05:58
created

test_install_enable_disable_remove_local()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
use Codeception\Util\FileSystem;
15
use Codeception\Util\Fixtures;
16
use Doctrine\ORM\EntityManager;
17
use Eccube\Common\EccubeConfig;
18
use Eccube\Entity\Plugin;
19
use Eccube\Repository\PluginRepository;
20
use Page\Admin\PluginLocalInstallPage;
21
use Page\Admin\PluginManagePage;
22
use Page\Admin\PluginSearchPage;
23
24
class EA10PluginCest
25
{
26
    /** @var EntityManager */
27
    private $em;
28
29
    /** @var \Doctrine\DBAL\Connection */
30
    private $conn;
31
32
    /** @var PluginRepository */
33
    private $pluginRepository;
34
35
    /** @var EccubeConfig */
36
    private $config;
37
38 View Code Duplication
    public function _before(\AcceptanceTester $I)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
    {
40
        $I->loginAsAdmin();
41
42
        $this->em = Fixtures::get('entityManager');
43
        $this->conn = $this->em->getConnection();
44
        $this->pluginRepository = $this->em->getRepository(Plugin::class);
45
        $this->config = Fixtures::get('config');
46
        FileSystem::doEmptyDir('repos');
47
    }
48
49
    public function test_install_enable_disable_remove_store(\AcceptanceTester $I)
50
    {
51
        Horizon_Store::start($I)
52
            ->インストール()
53
            ->有効化()
54
            ->無効化()
55
            ->削除();
56
    }
57
58
    public function test_install_enable_disable_remove_local(\AcceptanceTester $I)
59
    {
60
        Horizon_Store::start($I)
61
            ->インストール()
62
            ->有効化()
63
            ->無効化()
64
            ->削除();
65
    }
66
67
    public function test_install_enable_disable_enable_disable_remove_store(\AcceptanceTester $I)
68
    {
69
        Horizon_Store::start($I)
70
            ->インストール()
71
            ->有効化()
72
            ->無効化()
73
            ->有効化()
74
            ->無効化()
75
            ->削除();
76
    }
77
78
    public function test_install_enable_disable_enable_disable_remove_local(\AcceptanceTester $I)
79
    {
80
        Horizon_Local::start($I)
81
            ->インストール()
82
            ->有効化()
83
            ->無効化()
84
            ->有効化()
85
            ->無効化()
86
            ->削除();
87
    }
88
89
    public function test_install_remove_local(\AcceptanceTester $I)
90
    {
91
        Horizon_Local::start($I)
92
            ->インストール()
93
            ->削除();
94
    }
95
96
    public function test_install_remove_store(\AcceptanceTester $I)
97
    {
98
        Horizon_Store::start($I)
99
            ->インストール()
100
            ->削除();
101
    }
102
103
    public function test_install_update_remove_store(\AcceptanceTester $I)
104
    {
105
        Horizon_Store::start($I)
106
            ->インストール()
107
            ->アップデート()
108
            ->削除();
109
    }
110
111
112
113
    public function test_install_update_remove_local(\AcceptanceTester $I)
114
    {
115
        Horizon_Local::start($I)
116
            ->インストール()
117
            ->アップデート()
118
            ->削除();
119
    }
120
121
    public function test_install_enable_disable_update_enable_disable_remove_local(\AcceptanceTester $I)
122
    {
123
        Horizon_Local::start($I)
124
            ->インストール()
125
            ->有効化()
126
            ->無効化()
127
            ->アップデート()
128
            ->有効化()
129
            ->無効化()
130
            ->削除();
131
    }
132
133
    public function test_install_enable_disable_update_enable_disable_remove_store(\AcceptanceTester $I)
134
    {
135
        Horizon_Store::start($I)
136
            ->インストール()
137
            ->有効化()
138
            ->無効化()
139
            ->アップデート()
140
            ->有効化()
141
            ->無効化()
142
            ->削除();
143
    }
144
145
    public function test_install_enable_update_disable_remove_store(\AcceptanceTester $I)
146
    {
147
        Horizon_Store::start($I)
148
            ->インストール()
149
            ->有効化()
150
            ->アップデート()
151
            ->無効化()
152
            ->削除();
153
    }
154
155
    public function test_install_enable_update_disable_remove_local(\AcceptanceTester $I)
156
    {
157
        Horizon_Local::start($I)
158
            ->インストール()
159
            ->有効化()
160
            ->アップデート()
161
            ->無効化()
162
            ->削除();
163
    }
164
165
    public function test_install_update_enable_disable_remove_local(\AcceptanceTester $I)
166
    {
167
        Horizon_Local::start($I)
168
            ->インストール()
169
            ->アップデート()
170
            ->有効化()
171
            ->無効化()
172
            ->削除();
173
    }
174
175
    public function test_install_update_enable_disable_remove_store(\AcceptanceTester $I)
176
    {
177
        Horizon_Store::start($I)
178
            ->インストール()
179
            ->アップデート()
180
            ->有効化()
181
            ->無効化()
182
            ->削除();
183
    }
184
185
    public function test_install_enable_enable(\AcceptanceTester $I)
186
    {
187
        Horizon_Store::start($I)
188
            ->インストール()
189
            ->新しいタブで開く()
190
            ->有効化()
191
            ->前のタブに戻る()
192
            ->既に有効なものを有効化();
193
    }
194
195
    public function test_install_disable_disable(\AcceptanceTester $I)
196
    {
197
        Horizon_Store::start($I)
198
            ->インストール()
199
            ->有効化()
200
            ->新しいタブで開く()
201
            ->無効化()
202
            ->前のタブに戻る()
203
            ->既に無効なものを無効化();
204
    }
205
206
    public function test_install_assets_local(\AcceptanceTester $I)
207
    {
208
        $this->publishPlugin('Assets-1.0.0.tgz');
209
210
        $assetsPath = $this->config['plugin_html_realdir'].'/Assets/assets/assets.js';
211
        $updatedPath = $this->config['plugin_html_realdir'].'/Assets/assets/updated.js';
212
213
        $I->assertFileNotExists($assetsPath);
214
        $I->assertFileNotExists($updatedPath);
215
216
        $ManagePage = PluginLocalInstallPage::go($I)->アップロード('plugins/Assets-1.0.0.tgz');
217
        $I->assertFileExists($assetsPath);
218
        $I->assertFileNotExists($updatedPath);
219
220
        $ManagePage->独自プラグイン_有効化('Assets');
221
        $I->assertFileExists($assetsPath);
222
        $I->assertFileNotExists($updatedPath);
223
224
        $ManagePage->独自プラグイン_無効化('Assets');
225
        $I->assertFileExists($assetsPath);
226
        $I->assertFileNotExists($updatedPath);
227
228
        $ManagePage->独自プラグイン_アップデート('Assets', 'plugins/Assets-1.0.1.tgz');
229
        $I->assertFileExists($assetsPath);
230
        $I->assertFileExists($updatedPath);
231
232
        $ManagePage->独自プラグイン_削除('Assets');
233
        $I->assertFileNotExists($assetsPath);
234
        $I->assertFileNotExists($updatedPath);
235
    }
236
237
    public function test_install_assets_store(\AcceptanceTester $I)
238
    {
239
        // 最初のバージョンを作成
240
        $this->publishPlugin('Assets-1.0.0.tgz');
241
242
        $assetsPath = $this->config['plugin_html_realdir'].'/Assets/assets/assets.js';
243
        $updatedPath = $this->config['plugin_html_realdir'].'/Assets/assets/updated.js';
244
        $I->assertFileNotExists($assetsPath);
245
        $I->assertFileNotExists($updatedPath);
246
247
        $ManagePage = PluginSearchPage::go($I)
248
            ->入手する('Assets')
249
            ->インストール();
250
        $I->assertFileNotExists($assetsPath);
251
        $I->assertFileNotExists($updatedPath);
252
253
        $ManagePage->ストアプラグイン_有効化('Assets');
254
        $I->assertFileExists($assetsPath);
255
        $I->assertFileNotExists($updatedPath);
256
257
        $ManagePage->ストアプラグイン_無効化('Assets');
258
        $I->assertFileExists($assetsPath);
259
        $I->assertFileNotExists($updatedPath);
260
261
        // 新しいバージョンを作成
262
        $this->publishPlugin('Assets-1.0.1.tgz');
263
264
        $I->reloadPage();
265
        $ManagePage->ストアプラグイン_アップデート('Assets')->アップデート();
266
        $I->assertFileExists($assetsPath);
267
        $I->assertFileExists($updatedPath);
268
269
        $ManagePage->ストアプラグイン_削除('Assets');
270
        $I->assertFileNotExists($assetsPath);
271
        $I->assertFileNotExists($updatedPath);
272
    }
273
274 View Code Duplication
    public function test_extend_same_table_store(\AcceptanceTester $I)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
275
    {
276
        $Horizon = Horizon_Store::start($I);
277
        $Boomerang = Boomerang_Store::start($I);
278
279
        $Horizon->インストール()->有効化();
280
        $Boomerang->インストール()->有効化();
281
282
        $Horizon->検証()->無効化()->削除();
283
        $Boomerang->検証()->無効化()->削除();
284
    }
285
286 View Code Duplication
    public function test_extend_same_table_local(\AcceptanceTester $I)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
287
    {
288
        $Horizon = Horizon_Local::start($I);
289
        $Boomerang = Boomerang_Local::start($I);
290
291
        $Horizon->インストール()->有効化();
292
        $Boomerang->インストール()->有効化();
293
294
        $Horizon->検証()->無効化()->削除();
295
        $Boomerang->検証()->無効化()->削除();
296
    }
297
298 View Code Duplication
    public function test_extend_same_table_crossed_local(\AcceptanceTester $I)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
299
    {
300
        $Horizon = Horizon_Local::start($I);
301
        $Boomerang = Boomerang_Local::start($I);
302
303
        $Horizon->インストール()->有効化()->無効化();
304
        $Boomerang->インストール()->有効化();
305
306
        $Horizon->検証()->削除();
307
        $Boomerang->検証()->無効化()->削除();
308
    }
309
310
    private function publishPlugin($fileName)
311
    {
312
        copy(codecept_data_dir().'/'.'plugins/'.$fileName, codecept_root_dir().'/repos/'.$fileName);
313
    }
314
}
315
316
abstract class Abstract_Plugin
317
{
318
    /** @var AcceptanceTester */
319
    protected $I;
320
321
    /** @var EntityManager */
322
    protected $em;
323
324
    /** @var \Doctrine\DBAL\Connection */
325
    protected $conn;
326
327
    /** @var PluginRepository */
328
    protected $pluginRepository;
329
330
    /** @var EccubeConfig */
331
    protected $config;
332
333
    protected $initialized = false;
334
335
    protected $enabled = false;
336
337
    protected $removed = false;
338
339
    protected $table;
340
341
    protected $column;
342
343
    protected $traitTarget;
344
345
    protected $trait;
346
347 View Code Duplication
    public function __construct(\AcceptanceTester $I)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
348
    {
349
        $this->I = $I;
350
        $this->em = Fixtures::get('entityManager');
351
        $this->conn = $this->em->getConnection();
352
        $this->pluginRepository = $this->em->getRepository(Plugin::class);
353
        $this->config = Fixtures::get('config');
354
    }
355
356 View Code Duplication
    public function tableExists()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
357
    {
358
        if ($this->table) {
359
            $exists = $this->conn->executeQuery("SELECT count(*) AS count FROM information_schema.columns WHERE table_name = '".$this->table."';")->fetch()['count'] > 0;
360
            $this->I->assertTrue($exists, 'テーブルがあるはず '.$this->table);
361
        }
362
    }
363
364 View Code Duplication
    public function tableNotExists()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
365
    {
366
        if ($this->table) {
367
            $exists = $this->conn->executeQuery("SELECT count(*) AS count FROM information_schema.columns WHERE table_name = '".$this->table."';")->fetch()['count'] > 0;
368
            $this->I->assertFalse($exists, 'テーブルがないはず '.$this->table);
369
        }
370
    }
371
372 View Code Duplication
    public function columnExists()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
373
    {
374
        if ($this->column) {
375
            list($tableName, $columnName) = explode('.', $this->column);
376
            $exists = $this->conn->executeQuery("SELECT count(*) AS count FROM information_schema.columns WHERE table_name = '${tableName}' AND column_name = '${columnName}';")->fetch()['count'] == 1;
377
            $this->I->assertTrue($exists, 'カラムがあるはず '.$this->column);
378
        }
379
    }
380
381 View Code Duplication
    public function columnNotExists()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
382
    {
383
        if ($this->column) {
384
            list($tableName, $columnName) = explode('.', $this->column);
385
            $exists = $this->conn->executeQuery("SELECT count(*) AS count FROM information_schema.columns WHERE table_name = '${tableName}' AND column_name = '${columnName}';")->fetch()['count'] == 1;
386
            $this->I->assertFalse($exists, 'カラムがないはず '.$this->column);
387
        }
388
    }
389
390
    public function traitExists()
391
    {
392
        if ($this->trait) {
393
            $this->I->assertContains($this->trait, file_get_contents($this->config['kernel.project_dir'].'/app/proxy/entity/'.$this->traitTarget.'.php'), 'Traitがあるはず');
394
        }
395
    }
396
397
    public function traitNotExists()
398
    {
399
        if ($this->trait) {
400
            $file = $this->config['kernel.project_dir'].'/app/proxy/entity/'.$this->traitTarget.'.php';
401
            if (file_exists($file)) {
402
                $this->I->assertNotContains($this->trait, file_get_contents($file), 'Traitがないはず');
403
            } else {
404
                $this->I->assertTrue(true, 'Traitがないはず');
405
            }
406
        }
407
    }
408
409
    public function 新しいタブで開く()
410
    {
411
        $this->I->executeJS("window.open(location.href, 'other')");
412
        $this->I->switchToWindow('other');
413
        return $this;
414
    }
415
416
    public function 前のタブに戻る()
417
    {
418
        $this->I->switchToPreviousTab();
419
        return $this;
420
    }
421
422
    public function 検証()
423
    {
424
        if ($this->initialized) {
425
            $this->tableExists();
426
            $this->columnExists();
427
        } else {
428
            $this->tableNotExists();
429
            $this->columnNotExists();
430
        }
431
432
        if ($this->enabled) {
433
            $this->traitExists();
434
        } else {
435
            $this->traitNotExists();
436
        }
437
438
        return $this;
439
    }
440
}
441
442
class Store_Plugin extends Abstract_Plugin
443
{
444
    /** @var PluginManagePage */
445
    private $ManagePage;
446
447
    /** @var Plugin */
448
    private $Plugin;
449
450
    private $code;
451
452
    public function __construct(AcceptanceTester $I, $code)
453
    {
454
        parent::__construct($I);
455
        $this->code = $code;
456
        $this->publishPlugin($this->code.'-1.0.0.tgz');
457
    }
458
459
    public function インストール()
460
    {
461
        /*
462
         * インストール
463
         */
464
        $this->ManagePage = PluginSearchPage::go($this->I)
465
            ->入手する($this->code)
466
            ->インストール();
467
468
        $this->検証();
469
470
        $this->Plugin = $this->pluginRepository->findByCode($this->code);
471
        $this->I->assertFalse($this->Plugin->isInitialized(), '初期化されていない');
472
        $this->I->assertFalse($this->Plugin->isEnabled(), '有効化されていない');
473
474
        return $this;
475
    }
476
477 View Code Duplication
    public function 有効化()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
478
    {
479
        $this->ManagePage->ストアプラグイン_有効化($this->code);
480
481
        $this->initialized = true;
482
        $this->enabled = true;
483
484
        $this->検証();
485
486
        $this->em->refresh($this->Plugin);
487
        $this->I->assertTrue($this->Plugin->isInitialized(), '初期化されている');
488
        $this->I->assertTrue($this->Plugin->isEnabled(), '有効化されている');
489
        return $this;
490
    }
491
492
    public function 既に有効なものを有効化()
493
    {
494
        $this->ManagePage->ストアプラグイン_有効化($this->code, '既に有効です。');
495
496
        $this->initialized = true;
497
        $this->enabled = true;
498
499
        $this->検証();
500
501
        $this->em->refresh($this->Plugin);
502
        $this->I->assertTrue($this->Plugin->isInitialized(), '初期化されている');
503
        $this->I->assertTrue($this->Plugin->isEnabled(), '有効化されている');
504
505
506
        return $this;
507
    }
508
509
    public function 無効化()
510
    {
511
        $this->ManagePage->ストアプラグイン_無効化($this->code);
512
513
        $this->enabled = false;
514
515
        $this->検証();
516
517
        $this->em->refresh($this->Plugin);
518
        $this->I->assertTrue($this->Plugin->isInitialized(), '初期化されている');
519
        $this->I->assertFalse($this->Plugin->isEnabled(), '無効化されている');
520
521
        return $this;
522
    }
523
524
    public function 既に無効なものを無効化()
525
    {
526
        $this->ManagePage->ストアプラグイン_無効化($this->code, '既に無効です。');
527
528
        $this->enabled = false;
529
530
        $this->検証();
531
532
        $this->em->refresh($this->Plugin);
533
        $this->I->assertTrue($this->Plugin->isInitialized(), '初期化されている');
534
        $this->I->assertFalse($this->Plugin->isEnabled(), '無効化されている');
535
536
        return $this;
537
    }
538
539 View Code Duplication
    public function 削除()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
540
    {
541
        $this->ManagePage->ストアプラグイン_削除($this->code);
542
543
        $this->initialized = false;
544
        $this->enabled = false;
545
546
        $this->検証();
547
548
        $this->em->refresh($this->Plugin);
549
        $this->Plugin = $this->pluginRepository->findByCode($this->code);
550
        $this->I->assertNull($this->Plugin, '削除されている');
551
552
        return $this;
553
    }
554
555
    public function アップデート()
556
    {
557
        $this->publishPlugin($this->code.'-1.0.1.tgz');
558
559
        $this->I->reloadPage();
560
        $this->ManagePage->ストアプラグイン_アップデート($this->code)->アップデート();
561
562
        $this->initialized = true;
563
564
        $this->検証();
565
566
        $this->em->refresh($this->Plugin);
567
        $this->I->assertEquals($this->initialized, $this->Plugin->isInitialized(), '初期化');
568
        $this->I->assertEquals($this->enabled, $this->Plugin->isEnabled(), '有効/無効');
569
570
        return $this;
571
    }
572
573
    private function publishPlugin($fileName)
574
    {
575
        $published = copy(codecept_data_dir().'/'.'plugins/'.$fileName, codecept_root_dir().'/repos/'.$fileName);
576
        $this->I->assertTrue($published, "公開できた ${fileName}");
577
        $output = [];
578
        exec("ls -ltra repos/", $output);
579
        echo implode(PHP_EOL, $output).PHP_EOL;
580
    }
581
}
582
583
class Local_Plugin extends Abstract_Plugin
584
{
585
    /** @var PluginManagePage */
586
    private $ManagePage;
587
588
    /** @var Plugin */
589
    private $Plugin;
590
591
    /** @var string */
592
    private $code;
593
594
    public function __construct(AcceptanceTester $I, $code)
595
    {
596
        parent::__construct($I);
597
        $this->code = $code;
598
    }
599
600
    public function インストール()
601
    {
602
        $this->ManagePage = PluginLocalInstallPage::go($this->I)
603
            ->アップロード('plugins/'.$this->code.'-1.0.0.tgz');
604
605
        $this->initialized = true;
606
607
        $this->I->see('プラグインをインストールしました。', PluginManagePage::完了メーッセージ);
608
609
        $this->検証();
610
611
        $this->Plugin = $this->pluginRepository->findByCode($this->code);
612
        $this->I->assertTrue($this->Plugin->isInitialized(), '初期化されていない');
613
        $this->I->assertFalse($this->Plugin->isEnabled(), '有効化されていない');
614
615
        return $this;
616
    }
617
618
    public function 有効化()
619
    {
620
        $this->ManagePage->独自プラグイン_有効化($this->code);
621
622
        $this->enabled = true;
623
624
        $this->検証();
625
626
        $this->em->refresh($this->Plugin);
627
        $this->I->assertTrue($this->Plugin->isInitialized(), '初期化されている');
628
        $this->I->assertTrue($this->Plugin->isEnabled(), '有効化されている');
629
        return $this;
630
    }
631
632
    public function 無効化()
633
    {
634
        $this->ManagePage->独自プラグイン_無効化($this->code);
635
636
        $this->enabled = false;
637
638
        $this->検証();
639
640
        $this->em->refresh($this->Plugin);
641
        $this->I->assertTrue($this->Plugin->isInitialized(), '初期化されている');
642
        $this->I->assertFalse($this->Plugin->isEnabled(), '無効化されている');
643
644
        return $this;
645
    }
646
647 View Code Duplication
    public function 削除()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
648
    {
649
        $this->ManagePage->独自プラグイン_削除($this->code);
650
651
        $this->initialized = false;
652
        $this->enabled = false;
653
654
        $this->I->see('プラグインを削除しました。', PluginManagePage::完了メーッセージ);
655
656
        $this->検証();
657
658
        $this->em->refresh($this->Plugin);
659
        $this->Plugin = $this->pluginRepository->findByCode($this->code);
660
        $this->I->assertNull($this->Plugin, '削除されている');
661
662
        return $this;
663
    }
664
665
    public function アップデート()
666
    {
667
        $this->ManagePage->独自プラグイン_アップデート($this->code, 'plugins/'.$this->code.'-1.0.1.tgz');
668
669
        $this->検証();
670
671
        $this->em->refresh($this->Plugin);
672
        $this->I->assertTrue($this->Plugin->isInitialized(), '初期化されている');
673
        $this->I->assertEquals($this->enabled, $this->Plugin->isEnabled(), '有効/無効');
674
675
        return $this;
676
    }
677
}
678
679 View Code Duplication
class Horizon_Local extends Local_Plugin
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
680
{
681
    public function __construct(AcceptanceTester $I)
682
    {
683
        parent::__construct($I, 'Horizon');
684
        $this->table = 'dtb_dash';
685
        $this->column = 'dtb_cart.is_horizon';
686
        $this->trait = '\Plugin\Horizon\Entity\CartTrait';
687
        $this->traitTarget = 'Cart';
688
    }
689
690
    public static function start(AcceptanceTester $I)
691
    {
692
        return new self($I);
693
    }
694
}
695
696 View Code Duplication
class Horizon_Store extends Store_Plugin
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
697
{
698
    public function __construct(AcceptanceTester $I)
699
    {
700
        parent::__construct($I, 'Horizon');
701
        $this->table = 'dtb_dash';
702
        $this->column = 'dtb_cart.is_horizon';
703
        $this->trait = '\Plugin\Horizon\Entity\CartTrait';
704
        $this->traitTarget = 'Cart';
705
    }
706
707
    public static function start(AcceptanceTester $I)
708
    {
709
        return new self($I);
710
    }
711
}
712
713 View Code Duplication
class Boomerang_Store extends Store_Plugin
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
714
{
715
    public function __construct(AcceptanceTester $I)
716
    {
717
        parent::__construct($I, 'Boomerang');
718
        $this->column = 'dtb_cart.is_boomerang';
719
        $this->trait = '\Plugin\Boomerang\Entity\CartTrait';
720
        $this->traitTarget = 'Cart';
721
    }
722
723
    public static function start(AcceptanceTester $I)
724
    {
725
        return new self($I);
726
    }
727
}
728
729 View Code Duplication
class Boomerang_Local extends Local_Plugin
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
730
{
731
    public function __construct(AcceptanceTester $I)
732
    {
733
        parent::__construct($I, 'Boomerang');
734
        $this->column = 'dtb_cart.is_boomerang';
735
        $this->trait = '\Plugin\Boomerang\Entity\CartTrait';
736
        $this->traitTarget = 'Cart';
737
    }
738
739
    public static function start(AcceptanceTester $I)
740
    {
741
        return new self($I);
742
    }
743
}