-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathcastor.php
More file actions
57 lines (47 loc) · 1.59 KB
/
castor.php
File metadata and controls
57 lines (47 loc) · 1.59 KB
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
<?php
/*
* This file is part of the jolicode/elastically library.
*
* (c) JoliCode <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Castor\Attribute\AsRawTokens;
use Castor\Attribute\AsTask;
use function Castor\run;
#[AsTask(description: 'Run test suite')]
function test(#[AsRawTokens] array $rawTokens = []): void
{
run('vendor/bin/simple-phpunit ' . implode(' ', $rawTokens));
}
#[AsTask(description: 'Start testing tools (Elasticsearch 7)')]
function start_7(): void
{
run('docker run --rm -d --name "elastically_es" -p 9999:9200 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.17.25');
}
#[AsTask(description: 'Start testing tools (Elasticsearch 8)')]
function start(): void
{
run('docker run --rm -d --name "elastically_es" -p 9999:9200 -e "discovery.type=single-node" -e "xpack.security.enabled=false" -e "action.destructive_requires_name=false" -it -m 1GB docker.elastic.co/elasticsearch/elasticsearch:8.16.0');
}
#[AsTask(description: 'Stop testing tools')]
function stop(): void
{
run('docker stop "elastically_es"');
}
#[AsTask(description: 'Start debug tools (Kibana)')]
function kibana(): void
{
run('docker run -e "ELASTICSEARCH_HOSTS=http://127.0.0.1:9999/" --network host docker.elastic.co/kibana/kibana:7.17.25');
}
#[AsTask(description: 'Fix PHP CS')]
function cs(): void
{
run('vendor/bin/php-cs-fixer fix --verbose');
}
#[AsTask(description: 'Run phpstan')]
function phpstan(): void
{
run('vendor/bin/phpstan analyse');
}