ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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;
26use PHPUnit\Framework\MockObject\Stub;
27
29{
30 public function testConstruct(): void
31 {
33 $language = $this->createStub(Language::class);
34 $this->assertInstanceOf(IsExecutableTransformation::class, new IsExecutableTransformation($language));
35 }
36
37 public function testFailingAccept(): void
38 {
40 $language = $this->createStub(Language::class);
41 $transformation = new IsExecutableTransformation($language);
42
43 $this->assertFalse($transformation->accepts('I hope this string is no valid path...'));
44 }
45
46 public function testSuccessfulAccept(): void
47 {
48 if (!is_file('/bin/sh')) {
49 $this->markTestSkipped('Shell /bin/sh is not available.');
50 return;
51 }
53 $language = $this->createStub(Language::class);
54 $transformation = new IsExecutableTransformation($language);
55
56 $this->assertTrue($transformation->accepts('/bin/sh'));
57 }
58}
Validates that the given string is a valid and executable file path.