Completed
Pull Request — master (#16)
by Sergii
03:45
created

DrupalKernelPlaceholderBase::fileUnmanagedDelete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * @author Sergii Bondarenko, <[email protected]>
4
 */
5
6
use Behat\Behat\Hook\Scope\BeforeFeatureScope;
7
use Drupal\TqExtension\Context\TqContext;
8
9
// @codingStandardsIgnoreStart
10
interface DrupalKernelPlaceholderInterface
11
// @codingStandardsIgnoreEnd
12
{
13
    /**
14
     * Version-related implementation of @BeforeFeature hook for TqContext.
15
     *
16
     * @param BeforeFeatureScope $scope
17
     *
18
     * @see TqContext::beforeFeature()
19
     */
20
    public static function beforeFeature(BeforeFeatureScope $scope);
21
22
    public static function t($string, array $args = [], array $options = []);
23
24
    public static function arg();
25
26
    public static function formatString($string, array $args = []);
27
28
    public static function tokenReplace($text, array $data = [], array $options = []);
29
30
    public static function sitePath();
31
32
    public static function jsonEncode($data);
33
34
    public static function setCurrentUser($user);
35
36
    /**
37
     * Locate user ID by its name.
38
     *
39
     * @param string $username
40
     *
41
     * @return int
42
     */
43
    public static function getUidByName($username);
44
45
    /**
46
     * @param int $user_id
47
     */
48
    public static function deleteUser($user_id);
49
50
    /**
51
     * @param string $table
52
     * @param string $alias
53
     * @param array $options
54
     *
55
     * @return object
56
     */
57
    public static function selectQuery($table, $alias = null, array $options = []);
58
59
    /**
60
     * @param string $entityType
61
     * @param string $bundle
62
     *
63
     * @return array[]
64
     *   An associative array where key - machine-name of a field and
65
     *   value - an array with two keys: "label" and "required".
66
     */
67
    public static function getFieldDefinitions($entityType, $bundle);
68
69
    /**
70
     * @param string $entityType
71
     * @param int $id
72
     *
73
     * @return object
74
     */
75
    public static function entityLoad($entityType, $id);
76
77
    /**
78
     * @param object $entity
79
     * @param string $fieldName
80
     *
81
     * @return bool
82
     */
83
    public static function entityHasField($entity, $fieldName);
84
85
    /**
86
     * @param object $entity
87
     * @param string $fieldName
88
     *
89
     * @return mixed
90
     */
91
    public static function entityFieldValue($entity, $fieldName);
92
93
    /**
94
     * Switching the mail system.
95
     *
96
     * @param bool $useTesting
97
     *   Whether testing or standard mail system should be used.
98
     */
99
    public static function switchMailSystem($useTesting);
100
101
    /**
102
     * Get a list of emails, collected by testing mail system.
103
     *
104
     * @return array
105
     */
106
    public static function getEmailMessages();
107
108
    /**
109
     * Check existence of the content type by its machine name or title.
110
     *
111
     * @param string $contentType
112
     *   Machine name or title of the content type.
113
     *
114
     * @return string
115
     *   Machine name.
116
     */
117
    public static function getContentTypeName($contentType);
118
119
    /**
120
     * @param string $file
121
     *   Existing file from "src/JavaScript" without ".js" extension.
122
     * @param bool $delete
123
     *   Whether injection should be deleted.
124
     */
125
    public static function injectCustomJavascript($file, $delete = false);
126
}
127
128
// @codingStandardsIgnoreStart
129
abstract class DrupalKernelPlaceholderBase implements DrupalKernelPlaceholderInterface
130
// @codingStandardsIgnoreEnd
131
{
132
    public static function drupalGetFilename($type, $name, $filename = null)
133
    {
134
        return drupal_get_filename($type, $name, $filename);
135
    }
136
137
    public static function fileUnmanagedDelete($path)
138
    {
139
        return file_unmanaged_delete($path);
140
    }
141
142
    public static function fileUnmanagedCopy($source, $destination = null, $replace = FILE_EXISTS_RENAME)
143
    {
144
        return file_unmanaged_copy($source, $destination, $replace);
145
    }
146
}
147