|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * Copyright 2024 SURFnet B.V. |
| 5 | + * |
| 6 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + * you may not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + */ |
| 18 | + |
| 19 | +namespace OpenConext\MonitorBundle\Tests\Value; |
| 20 | + |
| 21 | +use OpenConext\MonitorBundle\Value\BuildEnvVars; |
| 22 | +use OpenConext\MonitorBundle\Value\BuildInformationFactory; |
| 23 | +use OpenConext\MonitorBundle\Value\BuildPath; |
| 24 | +use PHPUnit\Framework\TestCase; |
| 25 | + |
| 26 | +class BuildInformationFactoryTest extends TestCase |
| 27 | +{ |
| 28 | + public function test_builds_based_on_env_vars() |
| 29 | + { |
| 30 | + $buildInformation = BuildInformationFactory::build( |
| 31 | + '1.0.0', |
| 32 | + 'e97bbfc39653cb5541d453e704c64a7fab4f5b1', |
| 33 | + '1900-01-01', |
| 34 | + 'My-Application-da39a3ee5e6b4b0d3255bfef95601890afd80709' |
| 35 | + ); |
| 36 | + $this->assertInstanceOf(BuildEnvVars::class, $buildInformation); |
| 37 | + } |
| 38 | + public function test_builds_based_on_env_vars_commit_date_optional() |
| 39 | + { |
| 40 | + $buildInformation = BuildInformationFactory::build( |
| 41 | + '1.0.0', |
| 42 | + 'e97bbfc39653cb5541d453e704c64a7fab4f5b1', |
| 43 | + null, |
| 44 | + 'My-Application-da39a3ee5e6b4b0d3255bfef95601890afd80709' |
| 45 | + ); |
| 46 | + $this->assertInstanceOf(BuildEnvVars::class, $buildInformation); |
| 47 | + } |
| 48 | + public function test_builds_on_path() |
| 49 | + { |
| 50 | + $buildInformation = BuildInformationFactory::build( |
| 51 | + null, |
| 52 | + null, |
| 53 | + null, |
| 54 | + 'My-Application-da39a3ee5e6b4b0d3255bfef95601890afd80709' |
| 55 | + ); |
| 56 | + $this->assertInstanceOf(BuildPath::class, $buildInformation); |
| 57 | + } |
| 58 | +} |
0 commit comments