Skip to content

Commit 3c2a931

Browse files
committed
升级symfony依赖
1 parent 8f27dfb commit 3c2a931

18 files changed

+1156
-106
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
composer.lock
22
/vendor
33
.idea
4+
.phpunit.result.cache
45
/Tests/Event/Fixture/app/cache/*

Tests/Event/Fixture/TestKernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
class TestKernel extends Kernel implements PluginableHttpKernelInterface
1212
{
13-
public function getCacheDir()
13+
public function getCacheDir(): string
1414
{
1515
return dirname(__DIR__).'/app/cache';
1616
}
1717

18-
public function registerBundles()
18+
public function registerBundles(): iterable
1919
{
2020
$bundles = [
2121
new FrameworkBundle(),

Tests/Event/LazySubscribersTest.php

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ public function testGetEventMapWithoutService()
1818
$container->set('kernel', $kernel);
1919

2020
$lazySubscribers = $this->getMockBuilder('Codeages\PluginBundle\Event\LazySubscribers')
21-
->setMethods(['getEventMap'])
21+
->onlyMethods(['getEventMap'])
2222
->setConstructorArgs([$container])
2323
->getMockForAbstractClass();
2424
$lazySubscribers->method('getEventMap')
2525
->willReturn([]);
26+
$this->assertIsArray($lazySubscribers->getCallbacks('test'));
27+
$this->assertEmpty($lazySubscribers->getCallbacks('test'));
2628
}
2729

2830
public function testGetCallbacks()
@@ -45,40 +47,16 @@ public function testGetCallbacks()
4547
}
4648

4749
$test1 = [
48-
0 => [
49-
0 => 'test_two_event_subscribers',
50-
1 => 'onTest1',
51-
2 => 0,
52-
],
53-
1 => [
54-
0 => 'test_one_event_subscribers',
55-
1 => 'onTest1',
56-
2 => 0,
57-
],
50+
['test_one_event_subscribers', 'onTest1', 0],
51+
['test_two_event_subscribers', 'onTest1', 0],
5852
];
5953
$test2 = [
60-
0 => [
61-
0 => 'test_two_event_subscribers',
62-
1 => 'onTest2',
63-
2 => 0,
64-
],
65-
1 => [
66-
0 => 'test_one_event_subscribers',
67-
1 => 'onTest2',
68-
2 => -100,
69-
],
54+
['test_two_event_subscribers', 'onTest2', 0],
55+
['test_one_event_subscribers', 'onTest2', -100],
7056
];
7157
$test3 = [
72-
0 => [
73-
0 => 'test_one_event_subscribers',
74-
1 => 'onTest3',
75-
2 => 100,
76-
],
77-
1 => [
78-
0 => 'test_two_event_subscribers',
79-
1 => 'onTest3',
80-
2 => 0,
81-
],
58+
['test_one_event_subscribers', 'onTest3', 100],
59+
['test_two_event_subscribers', 'onTest3', 0],
8260
];
8361

8462
$test1Callbacks = $lazySubscribers->getCallbacks('test1');
@@ -99,7 +77,7 @@ private function mockKernel()
9977
{
10078
$testKernel = $this->getMockBuilder('Codeages\PluginBundle\Tests\Event\Fixture\TestKernel')
10179
->setConstructorArgs(['test', false])
102-
->setMethods(['getCacheDir'])
80+
->onlyMethods(['getCacheDir'])
10381
->getMockForAbstractClass();
10482

10583
$testKernel->method('getCacheDir')

Tests/Loader/Fixture/TestKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class TestKernel extends Kernel implements PluginableHttpKernelInterface
1212
{
13-
public function registerBundles()
13+
public function registerBundles(): iterable
1414
{
1515
$bundles = [
1616
new FrameworkBundle(),

Tests/Loader/ThemeTwigLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ThemeTwigLoaderTest extends WebTestCase
1010
public function testRenderThemeDirTwigFile()
1111
{
1212
$loader = $this->getMockBuilder('Codeages\PluginBundle\Loader\ThemeTwigLoader')
13-
->setMethods(['getCustomFile'])
13+
->onlyMethods(['getCustomFile'])
1414
->setConstructorArgs([$this->mockKernel()])
1515
->getMockForAbstractClass();
1616

Tests/System/PluginInstallTest.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

Tests/System/Slot/SlotInjectionCollectorTest.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,37 @@
33
namespace Codeages\PluginBundle\Tests\System\Slot;
44

55
use Codeages\PluginBundle\System\Slot\SlotInjectionCollector;
6+
use PHPUnit\Framework\TestCase;
67

7-
class SlotInjectionCollectorTest extends \PHPUnit_Framework_TestCase
8+
class SlotInjectionCollectorTest extends TestCase
89
{
910
public function testIndex()
1011
{
1112
$cacheDir = sys_get_temp_dir();
12-
1313
$this->removeCache($cacheDir);
1414

1515
$files = [
1616
__DIR__.'/Fixtures/slot_1.yml',
1717
__DIR__.'/Fixtures/slot_2.yml',
1818
__DIR__.'/Fixtures/slot_3.yml',
1919
];
20-
2120
$collector = new SlotInjectionCollector($files, $cacheDir, true);
2221

2322
$injections = require $cacheDir.'/slot.php';
23+
$this->assertCount(3, $injections);
24+
$this->assertNotEmpty($injections['example.position_1']);
25+
$this->assertCount(4, $injections['example.position_1']);
26+
$this->assertEquals('Codeages\PluginBundle\Tests\System\ExamplePositionSlot2', $injections['example.position_1'][0]);
2427
}
2528

26-
public function removeCache($cachDir)
29+
protected function removeCache($cacheDir)
2730
{
28-
if (file_exists($cachDir.'/slot.php')) {
29-
unlink($cachDir.'/slot.php');
31+
if (file_exists($cacheDir.'/slot.php')) {
32+
unlink($cacheDir.'/slot.php');
3033
}
3134

32-
if (file_exists($cachDir.'/slot.php.meta')) {
33-
unlink($cachDir.'/slot.php.meta');
35+
if (file_exists($cacheDir.'/slot.php.meta')) {
36+
unlink($cacheDir.'/slot.php.meta');
3437
}
3538
}
3639
}

bin/biz

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
/**
5+
* Proxy PHP file generated by Composer
6+
*
7+
* This file includes the referenced bin path (../vendor/codeages/biz-framework/bin/biz)
8+
* using a stream wrapper to prevent the shebang from being output on PHP<8
9+
*
10+
* @generated
11+
*/
12+
13+
namespace Composer;
14+
15+
$GLOBALS['_composer_bin_dir'] = __DIR__;
16+
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/vendor/autoload.php';
17+
18+
if (PHP_VERSION_ID < 80000) {
19+
if (!class_exists('Composer\BinProxyWrapper')) {
20+
/**
21+
* @internal
22+
*/
23+
final class BinProxyWrapper
24+
{
25+
private $handle;
26+
private $position;
27+
private $realpath;
28+
29+
public function stream_open($path, $mode, $options, &$opened_path)
30+
{
31+
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
32+
$opened_path = substr($path, 17);
33+
$this->realpath = realpath($opened_path) ?: $opened_path;
34+
$opened_path = $this->realpath;
35+
$this->handle = fopen($this->realpath, $mode);
36+
$this->position = 0;
37+
38+
return (bool) $this->handle;
39+
}
40+
41+
public function stream_read($count)
42+
{
43+
$data = fread($this->handle, $count);
44+
45+
if ($this->position === 0) {
46+
$data = preg_replace('{^#!.*\r?\n}', '', $data);
47+
}
48+
49+
$this->position += strlen($data);
50+
51+
return $data;
52+
}
53+
54+
public function stream_cast($castAs)
55+
{
56+
return $this->handle;
57+
}
58+
59+
public function stream_close()
60+
{
61+
fclose($this->handle);
62+
}
63+
64+
public function stream_lock($operation)
65+
{
66+
return $operation ? flock($this->handle, $operation) : true;
67+
}
68+
69+
public function stream_seek($offset, $whence)
70+
{
71+
if (0 === fseek($this->handle, $offset, $whence)) {
72+
$this->position = ftell($this->handle);
73+
return true;
74+
}
75+
76+
return false;
77+
}
78+
79+
public function stream_tell()
80+
{
81+
return $this->position;
82+
}
83+
84+
public function stream_eof()
85+
{
86+
return feof($this->handle);
87+
}
88+
89+
public function stream_stat()
90+
{
91+
return array();
92+
}
93+
94+
public function stream_set_option($option, $arg1, $arg2)
95+
{
96+
return true;
97+
}
98+
99+
public function url_stat($path, $flags)
100+
{
101+
$path = substr($path, 17);
102+
if (file_exists($path)) {
103+
return stat($path);
104+
}
105+
106+
return false;
107+
}
108+
}
109+
}
110+
111+
if (
112+
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
113+
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
114+
) {
115+
return include("phpvfscomposer://" . __DIR__ . '/..'.'/vendor/codeages/biz-framework/bin/biz');
116+
}
117+
}
118+
119+
return include __DIR__ . '/..'.'/vendor/codeages/biz-framework/bin/biz';

0 commit comments

Comments
 (0)