ReviewOS

also looking at this

meemalabs/laravel-meema

Fix test cases

#15
Merged glennmichael123 wants to merge fix-test-cases into main
4 files +63 -25
tests/FolderTest.phpmodified+22-8
Changes to tests/FolderTest.php
@@ -19,7 +19,9 @@ it('can fetch all folders', function () {
1919});
2020
2121it('can search a folder', function () {
22 $folder = Folder::find(1)->toArray();
22 $folders = Folder::get();
23
24 $folder = Folder::find($folders[0]['id'])->toArray();
2325
2426 $query = $folder['name'];
2527
@@ -30,7 +32,9 @@ it('can search a folder', function () {
3032});
3133
3234it('can fetch specific group of folders', function () {
33 $ids = [1, 2, 3];
35 $folders = Folder::get();
36
37 $ids = [$folders[0]['id'], $folders[1]['id'], $folders[2]['id']];
3438
3539 $folders = Folder::get($ids);
3640
@@ -39,9 +43,11 @@ it('can fetch specific group of folders', function () {
3943});
4044
4145it('can find a single folder', function () {
42 $id = 1;
46 $folders = Folder::get();
47
48 $id = $folders[0]['id'];
4349
44 $folders = Folder::find(1)->toArray();
50 $folders = Folder::find($id)->toArray();
4551
4652 $this->assertTrue(is_array($folders));
4753 $this->assertTrue(array_key_exists('id', $folders));
@@ -57,30 +63,38 @@ it('can create a folder', function () {
5763});
5864
5965it('can update a folder', function () {
66 $folders = Folder::get();
67
6068 $name = 'test folder';
6169
62 $folders = Folder::update(1, $name);
70 $folders = Folder::update($folders[0]['id'], $name);
6371
6472 $this->assertTrue(is_array($folders));
6573 $this->assertTrue($folders['name'] === $name);
6674});
6775
6876it('can archive a folder', function () {
69 $folders = Folder::archive(1);
77 $folders = Folder::get();
78
79 $folders = Folder::archive($folders[0]['id']);
7080
7181 $this->assertTrue(is_array($folders));
7282 $this->assertTrue((bool) $folders['is_archived']);
7383});
7484
7585it('can unarchive a folder', function () {
76 $folders = Folder::unarchive(1);
86 $folders = Folder::get();
87
88 $folders = Folder::unarchive($folders[0]['id']);
7789
7890 $this->assertTrue(is_array($folders));
7991 $this->assertFalse((bool) $folders['is_archived']);
8092});
8193
8294it('can duplicate a folder', function () {
83 $folders = Folder::find(1);
95 $folders = Folder::get();
96
97 $folders = Folder::find($folders[0]['id']);
8498
8599 $duplicated = $folders->duplicate();
86100