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

misantron / dbunit / 4562384438

pending completion
4562384438

push

github

Aleksandr Ivanov
Fix build status badge display

635 of 1200 relevant lines covered (52.92%)

5.65 hits per line

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

31.25
/src/Operation/Composite.php
1
<?php
2

3
/*
4
 * This file is part of DbUnit.
5
 *
6
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
namespace PHPUnit\DbUnit\Operation;
13

14
use PHPUnit\DbUnit\Database\Connection;
15
use PHPUnit\DbUnit\DataSet\IDataSet;
16
use PHPUnit\DbUnit\Exception\InvalidArgumentException;
17

18
/**
19
 * This class facilitates combining database operations. To create a composite
20
 * operation pass an array of classes that implement
21
 * PHPUnit\DbUnit\Operation\Operation and they will be
22
 * executed in that order against all data sets.
23
 */
24
class Composite implements Operation
25
{
26
    /**
27
     * @var Operation[]
28
     */
29
    protected $operations = [];
30

31
    /**
32
     * @param Operation[] $operations
33
     */
34
    public function __construct(array $operations)
35
    {
36
        foreach ($operations as $operation) {
14✔
37
            if (!$operation instanceof Operation) {
14✔
38
                throw new InvalidArgumentException(
×
39
                    'Only database operation instances can be passed to a composite database operation.'
×
40
                );
×
41
            }
42
            $this->operations[] = $operation;
14✔
43
        }
44
    }
45

46
    public function execute(Connection $connection, IDataSet $dataSet): void
47
    {
48
        try {
49
            foreach ($this->operations as $operation) {
14✔
50
                $operation->execute($connection, $dataSet);
14✔
51
            }
52
        } catch (Exception $e) {
×
53
            throw new Exception(
×
54
                "COMPOSITE[{$e->getOperation()}]",
×
55
                $e->getQuery(),
×
56
                $e->getArgs(),
×
57
                $e->getTable(),
×
58
                $e->getError()
×
59
            );
×
60
        }
61
    }
62
}
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