• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

conedevelopment / bazar / 20693753035

04 Jan 2026 01:38PM UTC coverage: 68.632% (+4.5%) from 64.117%
20693753035

Pull #236

github

web-flow
Merge 7a47622ff into f6c84deae
Pull Request #236: Discount Rules

257 of 314 new or added lines in 18 files covered. (81.85%)

105 existing lines in 40 files now uncovered.

1676 of 2442 relevant lines covered (68.63%)

25.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

15.0
/src/Fields/OrderStatus.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Cone\Bazar\Fields;
6

7
use Closure;
8
use Cone\Bazar\Models\Order;
9
use Cone\Root\Fields\Select;
10
use Illuminate\Database\Eloquent\Model;
11
use Illuminate\Http\Request;
12

13
class OrderStatus extends Select
14
{
15
    /**
16
     * Create a new field instance.
17
     */
18
    public function __construct(?string $label = null, Closure|string $modelAttribute = 'status')
101✔
19
    {
20
        parent::__construct($label ?: __('Status'), $modelAttribute);
101✔
21

22
        $this->options(Order::getStatuses());
101✔
23
    }
24

25
    /**
26
     * {@inheritdoc}
27
     */
UNCOV
28
    public function resolveFormat(Request $request, Model $model): ?string
×
29
    {
30
        $value = parent::resolveFormat($request, $model);
×
31

32
        if (is_null($value)) {
×
33
            return $value;
×
34
        }
35

36
        return sprintf(
×
37
            '<span class="status %s">%s</span>',
×
38
            $this->valueToClass($this->resolveValue($request, $model)),
×
39
            $value,
×
40
        );
×
41
    }
42

43
    /**
44
     * Convert the value to a class name.
45
     */
UNCOV
46
    public function valueToClass(string $value): string
×
47
    {
48
        return match ($value) {
×
49
            Order::PENDING, Order::ON_HOLD => 'status--warning',
×
50
            Order::CANCELLED, Order::FAILED => 'status--danger',
×
51
            Order::FULFILLED => 'status--success',
×
52
            Order::IN_PROGRESS => 'status--info',
×
53
            default => 'status--info',
×
54
        };
×
55
    }
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc