ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
IsExecutableTransformationTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Tests\Refinery;
22
24use PHPUnit\Framework\TestCase;
26
28{
29 public function testConstruct(): void
30 {
31 $language = $this->getMockBuilder(Language::class)->disableOriginalConstructor()->getMock();
32 $this->assertInstanceOf(IsExecutableTransformation::class, new IsExecutableTransformation($language));
33 }
34
35 public function testFailingAccept(): void
36 {
37 $language = $this->getMockBuilder(Language::class)->disableOriginalConstructor()->getMock();
38 $transformation = new IsExecutableTransformation($language);
39
40 $this->assertFalse($transformation->accepts('I hope this string is no valid path...'));
41 }
42
43 public function testSuccessfulAccept(): void
44 {
45 if (!is_file('/bin/sh')) {
46 $this->markTestSkipped('Shell /bin/sh is not available.');
47 return;
48 }
49 $language = $this->getMockBuilder(Language::class)->disableOriginalConstructor()->getMock();
50 $transformation = new IsExecutableTransformation($language);
51
52 $this->assertTrue($transformation->accepts('/bin/sh'));
53 }
54}
Validates that the given string is a valid and executable file path.