createMock(Tree::class); $this->server = new Server($tree); } #[\PHPUnit\Framework\Attributes\DataProvider('quotaProvider')] public function testQuota(int $quota, int $fileSize, bool $expectedResult): void { $fileInfo = $this->createMock(ITrashItem::class); $fileInfo->method('getSize') ->willReturn($fileSize); $trashNode = $this->createMock(ITrash::class); $trashNode->method('getFileInfo') ->willReturn($fileInfo); $restoreNode = $this->createMock(RestoreFolder::class); $this->server->tree->method('getNodeForPath') ->willReturn($trashNode, $restoreNode); $previewManager = $this->createMock(IPreview::class); $view = $this->createMock(View::class); $view->method('free_space') ->willReturn($quota); $plugin = new TrashbinPlugin($previewManager, $view); $plugin->initialize($this->server); $sourcePath = 'trashbin/test/trash/file1'; $destinationPath = 'trashbin/test/restore/file1'; $this->assertEquals($expectedResult, $plugin->beforeMove($sourcePath, $destinationPath)); } public static function quotaProvider(): array { return [ [ 1024, 512, true ], [ 512, 513, false ], [ FileInfo::SPACE_NOT_COMPUTED, 1024, true ], [ FileInfo::SPACE_UNKNOWN, 1024, true ], [ FileInfo::SPACE_UNLIMITED, 1024, true ] ]; } } n> Mirror of redmine code source: https://github.com/redmine/redminewww-data
summaryrefslogtreecommitdiffstats
path: root/app/controllers/journals_controller.rb
blob: ad6728e3717416ce498b04ab971b5568b913609e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105