Skip to content

Commit

Permalink
仕様調整に伴いユニットテストを調整
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Sep 16, 2024
1 parent 6a8511d commit 4d8e6ef
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions plugins/baser-core/tests/TestCase/Service/ContentsServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use BaserCore\Test\Factory\ContentFactory;
use BaserCore\Test\Factory\PageFactory;
use BaserCore\Test\Factory\SearchIndexesFactory;
use BaserCore\Test\Factory\SiteFactory;
use BaserCore\Test\Scenario\ContentFoldersScenario;
use BaserCore\Test\Scenario\ContentsScenario;
use BaserCore\Test\Scenario\MailContentsScenario;
Expand All @@ -26,7 +25,6 @@
use BcBlog\Test\Factory\BlogContentFactory;
use Cake\Core\Configure;
use Cake\Datasource\Exception\RecordNotFoundException;
use Cake\ORM\TableRegistry;
use Cake\Routing\Router;
use BaserCore\TestSuite\BcTestCase;
use BaserCore\Service\ContentsService;
Expand Down Expand Up @@ -680,22 +678,20 @@ public function testMove()
['id' => 21]
])->persist();
// 移動元のエンティティ
$originEntity = $this->ContentsService->getIndex(['parent_id' => 1])->order('lft')->first();
$originEntity = $this->ContentsService->getIndex(['parent_id' => 1])->orderBy('lft')->first();
$origin = [
'id' => $originEntity->id,
'parentId' => $originEntity->parent_id
];
// target idが指定されてない場合 親要素内の最後に移動
$target1 = [
'id' => "",
'id' => "9",
'parentId' => "1",
'siteId' => "1",
];
$result = $this->ContentsService->move($origin, $target1);
$lastEntity = $this->ContentsService->getIndex(['parent_id' => 1])->order('lft')->all()->last();
$this->assertEquals($result->title, $originEntity->title);
$this->assertEquals($result->title, $lastEntity->title);
// targetIdが指定されてる場合
$this->ContentsService->move($origin, $target1);
$movedEntity = $this->ContentsService->get(4);
$this->assertEquals(14, $movedEntity->lft);
$this->assertEquals(15, $movedEntity->rght);
// 対象が同じ要素の2番目のエンティティなので、直前つまり最初に移動
$target2 = [
'id' => "10",
Expand Down

0 comments on commit 4d8e6ef

Please sign in to comment.