Skip to content

Commit 9cb5d29

Browse files
committed
update
1 parent b33f929 commit 9cb5d29

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

.github/workflows/default.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Run tests
2+
3+
on:
4+
push:
5+
schedule:
6+
- cron: '0 0 * * *'
7+
8+
jobs:
9+
php-tests:
10+
runs-on: ${{ matrix.os }}
11+
12+
strategy:
13+
matrix:
14+
php: [7.4, 7.3, 7.2]
15+
laravel: [7.*, 6.*]
16+
dependency-version: [prefer-lowest, prefer-stable]
17+
os: [ubuntu-latest, windows-latest]
18+
include:
19+
- laravel: 8.*
20+
testbench: 6.*
21+
- laravel: 7.*
22+
testbench: 5.*
23+
- laravel: 6.*
24+
testbench: 4.*
25+
exclude:
26+
- laravel: 8.*
27+
php: 7.2
28+
29+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
30+
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v1
34+
35+
- name: Setup PHP
36+
uses: shivammathur/setup-php@v1
37+
with:
38+
php-version: ${{ matrix.php }}
39+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
40+
coverage: none
41+
42+
- name: Install dependencies
43+
run: |
44+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
45+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
46+
47+
- name: Execute tests
48+
run: ./vendor/bin/phpunit

src/Greet.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,25 @@
22

33
namespace TheUsual\Greet;
44

5-
class Greet{
5+
class Greet
6+
{
7+
8+
public static function hello($name = null)
9+
{
10+
$time = date("H");
11+
12+
if ($time < "12") {
13+
echo "Good morning";
14+
} else if ($time >= "12" && $time < "17") {
15+
echo "Good afternoon";
16+
} else if ($time >= "17" && $time < "19") {
17+
echo "Good evening";
18+
} else if ($time >= "19") {
19+
echo "Good night";
20+
}
21+
22+
if ($name != null) {
23+
echo ", " . $name;
24+
}
25+
}
626
}

0 commit comments

Comments
 (0)