File tree Expand file tree Collapse file tree 3 files changed +68
-2
lines changed Expand file tree Collapse file tree 3 files changed +68
-2
lines changed Original file line number Diff line number Diff line change 1+ name : PHP Tests
2+
3+ on :
4+ push :
5+ branches : [ "master" ]
6+
7+ permissions :
8+ contents : read
9+
10+ jobs :
11+ run :
12+ runs-on : ${{ matrix.operating-system }}
13+
14+ strategy :
15+ matrix :
16+ operating-system : [ ubuntu-latest ]
17+ php-version : [ '8.1', '8.2' ]
18+
19+ name : PHP ${{ matrix.php-version }} test on ${{ matrix.operating-system }}
20+
21+ steps :
22+ - name : Checkout Code
23+ uses : actions/checkout@v3
24+
25+ - name : Install PHP
26+ id : php
27+ uses : shivammathur/setup-php@v2
28+ env :
29+ runner : self-hosted
30+ with :
31+ php-version : ${{ matrix.php-version }}
32+
33+ - name : Check PHP version
34+ run : php -v
35+
36+ - name : Cache Composer packages
37+ id : composer-cache
38+ uses : actions/cache@v3
39+ with :
40+ path : vendor
41+ key : ${{ runner.os }}-${{ matrix.operating-system }}-php-${{ steps.php.outputs.php-version }}-composer-${{ hashFiles('**/composer.json') }}
42+ restore-keys : |
43+ ${{ runner.os }}-${{ matrix.operating-system }}-php-${{ steps.php.outputs.php-version }}
44+
45+ - if : steps.composer-cache.outputs.cache-hit != 'true'
46+ name : Install Composer dependencies
47+ run : composer install --prefer-dist --no-progress
48+
49+ - name : PHPUnit Tests
50+ run : vendor/bin/phpunit --coverage-clover ./tests/coverage.xml
51+
52+ - name : Upload coverage reports to Codecov
53+ uses : codecov/codecov-action@v3
54+ with :
55+ token : ${{ secrets.CODECOV_TOKEN }}
56+ files : ./tests/coverage.xml
57+ flags : os-${{ matrix.operating-system }}_php-${{ matrix.php-version }}
58+ verbose : true
Original file line number Diff line number Diff line change @@ -90,10 +90,16 @@ public function testDestructor(): void
9090
9191 $ file = require Util::CACHE_STATES_FILE ;
9292
93- $ key = 'CODE_TRANSFORMER_APP_DIR \\tests \\Stubs \\ClassesToTransform \\StringClass.php ' ;
93+ print_r ($ file );
94+
95+ $ key = 'CODE_TRANSFORMER_APP_DIR\tests\Stubs\ClassesToTransform\StringClass.php ' ;
96+ $ key = str_replace ('\\' , DIRECTORY_SEPARATOR , $ key );
9497 $ this ->assertArrayHasKey ($ key , $ file );
98+
99+ $ cachedFilePath = 'CODE_TRANSFORMER_APP_DIR\tests\cache\transformed\tests\Stubs\ClassesToTransform\StringClass.php ' ;
100+ $ cachedFilePath = str_replace ('\\' , DIRECTORY_SEPARATOR , $ cachedFilePath );
95101 $ this ->assertArrayHasKey ('cachedFilePath ' , $ file [$ key ]);
96- $ this ->assertEquals (' CODE_TRANSFORMER_APP_DIR\tests\cache\transformed\tests\Stubs\ClassesToTransform\StringClass.php ' , $ file [$ key ]['cachedFilePath ' ]);
102+ $ this ->assertEquals ($ cachedFilePath , $ file [$ key ]['cachedFilePath ' ]);
97103 $ this ->assertArrayHasKey ('transformedTime ' , $ file [$ key ]);
98104 $ this ->assertIsInt ($ file [$ key ]['transformedTime ' ]);
99105 $ this ->assertArrayHasKey ('transformerFilePaths ' , $ file [$ key ]);
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ public function transform(Code $code): void
3232 "'Hello from Code Transformer!' " ,
3333 );
3434
35+
36+
3537 $ code ->append ('$iAmAppended = true; ' );
3638 }
3739 }
You can’t perform that action at this time.
0 commit comments