Completed
Push — 1.0 ( 290bb5...44dd9d )
by Kamil
21:01
created

NotificationAccessor::getMessageElements()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
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
declare(strict_types=1);
13
14
namespace Sylius\Behat\Service\Accessor;
15
16
use Behat\Mink\Exception\ElementNotFoundException;
17
use Behat\Mink\Session;
18
19
final class NotificationAccessor implements NotificationAccessorInterface
20
{
21
    /**
22
     * @var Session
23
     */
24
    private $session;
25
26
    public function __construct(Session $session)
27
    {
28
        $this->session = $session;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function getMessageElements(): array
35
    {
36
        $messageElements = $this->session->getPage()->findAll('css', '.sylius-flash-message');
37
38
        if (empty($messageElements)) {
39
            throw new ElementNotFoundException($this->session->getDriver(), 'message element', 'css', '.sylius-flash-message');
40
        }
41
42
        return $messageElements;
43
    }
44
}
45