| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,16 +18,25 @@ class CacheHit | |||
| 18 | 18 | */ | |
| 19 | 19 | public $value; | |
| 20 | 20 | ||
| 21 | + /** | ||
| 22 | + * The tags that were assigned to the key. | ||
| 23 | + * | ||
| 24 | + * @var array | ||
| 25 | + */ | ||
| 26 | + public $tags; | ||
| 27 | + | ||
| 21 | 28 | /** | |
| 22 | 29 | * Create a new event instance. | |
| 23 | 30 | * | |
| 24 | 31 | * @param string $key | |
| 25 | 32 | * @param mixed $value | |
| 33 | + * @param array $tags | ||
| 26 | 34 | * @return void | |
| 27 | 35 | */ | |
| 28 | - public function __construct($key, $value) | ||
| 36 | + public function __construct($key, $value, array $tags = []) | ||
| 29 | 37 | { | |
| 30 | 38 | $this->key = $key; | |
| 39 | + $this->tags = $tags; | ||
| 31 | 40 | $this->value = $value; | |
| 32 | 41 | } | |
| 33 | 42 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,14 +11,23 @@ class CacheMissed | |||
| 11 | 11 | */ | |
| 12 | 12 | public $key; | |
| 13 | 13 | ||
| 14 | + /** | ||
| 15 | + * The tags that were assigned to the key. | ||
| 16 | + * | ||
| 17 | + * @var array | ||
| 18 | + */ | ||
| 19 | + public $tags; | ||
| 20 | + | ||
| 14 | 21 | /** | |
| 15 | 22 | * Create a new event instance. | |
| 16 | 23 | * | |
| 17 | 24 | * @param string $event | |
| 25 | + * @param array $tags | ||
| 18 | 26 | * @return void | |
| 19 | 27 | */ | |
| 20 | - public function __construct($key) | ||
| 28 | + public function __construct($key, array $tags = []) | ||
| 21 | 29 | { | |
| 22 | 30 | $this->key = $key; | |
| 31 | + $this->tags = $tags; | ||
| 23 | 32 | } | |
| 24 | 33 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,14 +11,23 @@ class KeyForgotten | |||
| 11 | 11 | */ | |
| 12 | 12 | public $key; | |
| 13 | 13 | ||
| 14 | + /** | ||
| 15 | + * The tags that were assigned to the key. | ||
| 16 | + * | ||
| 17 | + * @var array | ||
| 18 | + */ | ||
| 19 | + public $tags; | ||
| 20 | + | ||
| 14 | 21 | /** | |
| 15 | 22 | * Create a new event instance. | |
| 16 | 23 | * | |
| 17 | 24 | * @param string $key | |
| 25 | + * @param array $tags | ||
| 18 | 26 | * @return void | |
| 19 | 27 | */ | |
| 20 | - public function __construct($key) | ||
| 28 | + public function __construct($key, $tags = []) | ||
| 21 | 29 | { | |
| 22 | 30 | $this->key = $key; | |
| 31 | + $this->tags = $tags; | ||
| 23 | 32 | } | |
| 24 | 33 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,17 +25,26 @@ class KeyWritten | |||
| 25 | 25 | */ | |
| 26 | 26 | public $minutes; | |
| 27 | 27 | ||
| 28 | + /** | ||
| 29 | + * The tags that were assigned to the key. | ||
| 30 | + * | ||
| 31 | + * @var array | ||
| 32 | + */ | ||
| 33 | + public $tags; | ||
| 34 | + | ||
| 28 | 35 | /** | |
| 29 | 36 | * Create a new event instance. | |
| 30 | 37 | * | |
| 31 | 38 | * @param string $key | |
| 32 | 39 | * @param mixed $value | |
| 33 | 40 | * @param int $minutes | |
| 41 | + * @param array $tags | ||
| 34 | 42 | * @return void | |
| 35 | 43 | */ | |
| 36 | - public function __construct($key, $value, $minutes) | ||
| 44 | + public function __construct($key, $value, $minutes, $tags = []) | ||
| 37 | 45 | { | |
| 38 | 46 | $this->key = $key; | |
| 47 | + $this->tags = $tags; | ||
| 39 | 48 | $this->value = $value; | |
| 40 | 49 | $this->minutes = $minutes; | |
| 41 | 50 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -76,13 +76,29 @@ protected function fireCacheEvent($event, $payload) | |||
| 76 | 76 | ||
| 77 | 77 | switch ($event) { | |
| 78 | 78 | case 'hit': | |
| 79 | - return $this->events->fire(new Events\CacheHit($payload[0], $payload[1])); | ||
| 79 | + if (count($payload) == 2) { | ||
| 80 | + $payload[] = []; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + return $this->events->fire(new Events\CacheHit($payload[0], $payload[1], $payload[2])); | ||
| 80 | 84 | case 'missed': | |
| 81 | - return $this->events->fire(new Events\CacheMissed($payload[0])); | ||
| 85 | + if (count($payload) == 1) { | ||
| 86 | + $payload[] = []; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + return $this->events->fire(new Events\CacheMissed($payload[0], $payload[1])); | ||
| 82 | 90 | case 'delete': | |
| 83 | - return $this->events->fire(new Events\KeyForgotten($payload[0])); | ||
| 91 | + if (count($payload) == 1) { | ||
| 92 | + $payload[] = []; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + return $this->events->fire(new Events\KeyForgotten($payload[0], $payload[1])); | ||
| 84 | 96 | case 'write': | |
| 85 | - return $this->events->fire(new Events\KeyWritten($payload[0], $payload[1], $payload[2])); | ||
| 97 | + if (count($payload) == 3) { | ||
| 98 | + $payload[] = []; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + return $this->events->fire(new Events\KeyWritten($payload[0], $payload[1], $payload[2], $payload[3])); | ||
| 86 | 102 | } | |
| 87 | 103 | } | |
| 88 | 104 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -211,12 +211,14 @@ protected function callAfterCallbacks(Container $container) | |||
| 211 | 211 | */ | |
| 212 | 212 | public function buildCommand() | |
| 213 | 213 | { | |
| 214 | + $output = ProcessUtils::escapeArgument($this->output); | ||
| 215 | + | ||
| 214 | 216 | $redirect = $this->shouldAppendOutput ? ' >> ' : ' > '; | |
| 215 | 217 | ||
| 216 | 218 | if ($this->withoutOverlapping) { | |
| 217 | - $command = '(touch '.$this->mutexPath().'; '.$this->command.'; rm '.$this->mutexPath().')'.$redirect.$this->output.' 2>&1 &'; | ||
| 219 | + $command = '(touch '.$this->mutexPath().'; '.$this->command.'; rm '.$this->mutexPath().')'.$redirect.$output.' 2>&1 &'; | ||
| 218 | 220 | } else { | |
| 219 | - $command = $this->command.$redirect.$this->output.' 2>&1 &'; | ||
| 221 | + $command = $this->command.$redirect.$output.' 2>&1 &'; | ||
| 220 | 222 | } | |
| 221 | 223 | ||
| 222 | 224 | return $this->user ? 'sudo -u '.$this->user.' '.$command : $command; | |
@@ -659,7 +661,7 @@ public function skip(Closure $callback) | |||
| 659 | 661 | */ | |
| 660 | 662 | public function sendOutputTo($location, $append = false) | |
| 661 | 663 | { | |
| 662 | - $this->output = ProcessUtils::escapeArgument($location); | ||
| 664 | + $this->output = $location; | ||
| 663 | 665 | ||
| 664 | 666 | $this->shouldAppendOutput = $append; | |
| 665 | 667 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,10 @@ | |||
| 1 | 1 | <?php | |
| 2 | 2 | ||
| 3 | 3 | use Mockery as m; | |
| 4 | + use Illuminate\Cache\Events\CacheHit; | ||
| 5 | + use Illuminate\Cache\Events\KeyWritten; | ||
| 6 | + use Illuminate\Cache\Events\CacheMissed; | ||
| 7 | + use Illuminate\Cache\Events\KeyForgotten; | ||
| 4 | 8 | ||
| 5 | 9 | class CacheEventTest extends PHPUnit_Framework_TestCase | |
| 6 | 10 | { | |
@@ -14,17 +18,16 @@ public function testHasTriggersEvents() | |||
| 14 | 18 | $dispatcher = $this->getDispatcher(); | |
| 15 | 19 | $repository = $this->getRepository($dispatcher); | |
| 16 | 20 | ||
| 17 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheMissed')); | ||
| 21 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheMissed::class, ['key' => 'foo'])); | ||
| 18 | 22 | $this->assertFalse($repository->has('foo')); | |
| 19 | 23 | ||
| 20 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheHit')); | ||
| 24 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheHit::class, ['key' => 'baz', 'value' => 'qux'])); | ||
| 21 | 25 | $this->assertTrue($repository->has('baz')); | |
| 22 | 26 | ||
| 23 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheMissed')); | ||
| 24 | - $dispatcher->shouldReceive('fire')->never(); | ||
| 27 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheMissed::class, ['key' => 'foo', 'tags' => ['taylor']])); | ||
| 25 | 28 | $this->assertFalse($repository->tags('taylor')->has('foo')); | |
| 26 | 29 | ||
| 27 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheHit')); | ||
| 30 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheHit::class, ['key' => 'baz', 'value' => 'qux', 'tags' => ['taylor']])); | ||
| 28 | 31 | $this->assertTrue($repository->tags('taylor')->has('baz')); | |
| 29 | 32 | } | |
| 30 | 33 | ||
@@ -33,16 +36,16 @@ public function testGetTriggersEvents() | |||
| 33 | 36 | $dispatcher = $this->getDispatcher(); | |
| 34 | 37 | $repository = $this->getRepository($dispatcher); | |
| 35 | 38 | ||
| 36 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheMissed')); | ||
| 39 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheMissed::class, ['key' => 'foo'])); | ||
| 37 | 40 | $this->assertNull($repository->get('foo')); | |
| 38 | 41 | ||
| 39 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheHit')); | ||
| 42 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheHit::class, ['key' => 'baz', 'value' => 'qux'])); | ||
| 40 | 43 | $this->assertEquals('qux', $repository->get('baz')); | |
| 41 | 44 | ||
| 42 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheMissed')); | ||
| 45 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheMissed::class, ['key' => 'foo', 'tags' => ['taylor']])); | ||
| 43 | 46 | $this->assertNull($repository->tags('taylor')->get('foo')); | |
| 44 | 47 | ||
| 45 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheHit')); | ||
| 48 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheHit::class, ['key' => 'baz', 'value' => 'qux', 'tags' => ['taylor']])); | ||
| 46 | 49 | $this->assertEquals('qux', $repository->tags('taylor')->get('baz')); | |
| 47 | 50 | } | |
| 48 | 51 | ||
@@ -51,8 +54,8 @@ public function testPullTriggersEvents() | |||
| 51 | 54 | $dispatcher = $this->getDispatcher(); | |
| 52 | 55 | $repository = $this->getRepository($dispatcher); | |
| 53 | 56 | ||
| 54 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheHit')); | ||
| 55 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\KeyForgotten')); | ||
| 57 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheHit::class, ['key' => 'baz', 'value' => 'qux'])); | ||
| 58 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(KeyForgotten::class, ['key' => 'baz'])); | ||
| 56 | 59 | $this->assertEquals('qux', $repository->pull('baz')); | |
| 57 | 60 | } | |
| 58 | 61 | ||
@@ -61,8 +64,8 @@ public function testPullTriggersEventsUsingTags() | |||
| 61 | 64 | $dispatcher = $this->getDispatcher(); | |
| 62 | 65 | $repository = $this->getRepository($dispatcher); | |
| 63 | 66 | ||
| 64 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheHit')); | ||
| 65 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\KeyForgotten')); | ||
| 67 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheHit::class, ['key' => 'baz', 'value' => 'qux', 'tags' => ['taylor']])); | ||
| 68 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(KeyForgotten::class, ['key' => 'baz', 'tags' => ['taylor']])); | ||
| 66 | 69 | $this->assertEquals('qux', $repository->tags('taylor')->pull('baz')); | |
| 67 | 70 | } | |
| 68 | 71 | ||
@@ -71,10 +74,10 @@ public function testPutTriggersEvents() | |||
| 71 | 74 | $dispatcher = $this->getDispatcher(); | |
| 72 | 75 | $repository = $this->getRepository($dispatcher); | |
| 73 | 76 | ||
| 74 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\KeyWritten')); | ||
| 77 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(KeyWritten::class, ['key' => 'foo', 'value' => 'bar'])); | ||
| 75 | 78 | $repository->put('foo', 'bar', 99); | |
| 76 | 79 | ||
| 77 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\KeyWritten')); | ||
| 80 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(KeyWritten::class, ['key' => 'foo', 'value' => 'bar', 'tags' => ['taylor']])); | ||
| 78 | 81 | $repository->tags('taylor')->put('foo', 'bar', 99); | |
| 79 | 82 | } | |
| 80 | 83 | ||
@@ -83,12 +86,12 @@ public function testAddTriggersEvents() | |||
| 83 | 86 | $dispatcher = $this->getDispatcher(); | |
| 84 | 87 | $repository = $this->getRepository($dispatcher); | |
| 85 | 88 | ||
| 86 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheMissed')); | ||
| 87 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\KeyWritten')); | ||
| 89 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheMissed::class, ['key' => 'foo'])); | ||
| 90 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(KeyWritten::class, ['key' => 'foo', 'value' => 'bar'])); | ||
| 88 | 91 | $this->assertTrue($repository->add('foo', 'bar', 99)); | |
| 89 | 92 | ||
| 90 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheMissed')); | ||
| 91 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\KeyWritten')); | ||
| 93 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheMissed::class, ['key' => 'foo', 'tags' => ['taylor']])); | ||
| 94 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(KeyWritten::class, ['key' => 'foo', 'value' => 'bar', 'tags' => ['taylor']])); | ||
| 92 | 95 | $this->assertTrue($repository->tags('taylor')->add('foo', 'bar', 99)); | |
| 93 | 96 | } | |
| 94 | 97 | ||
@@ -97,10 +100,10 @@ public function testForeverTriggersEvents() | |||
| 97 | 100 | $dispatcher = $this->getDispatcher(); | |
| 98 | 101 | $repository = $this->getRepository($dispatcher); | |
| 99 | 102 | ||
| 100 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\KeyWritten')); | ||
| 103 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(KeyWritten::class, ['key' => 'foo', 'value' => 'bar'])); | ||
| 101 | 104 | $repository->forever('foo', 'bar'); | |
| 102 | 105 | ||
| 103 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\KeyWritten')); | ||
| 106 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(KeyWritten::class, ['key' => 'foo', 'value' => 'bar', 'tags' => ['taylor']])); | ||
| 104 | 107 | $repository->tags('taylor')->forever('foo', 'bar'); | |
| 105 | 108 | } | |
| 106 | 109 | ||
@@ -109,14 +112,14 @@ public function testRememberTriggersEvents() | |||
| 109 | 112 | $dispatcher = $this->getDispatcher(); | |
| 110 | 113 | $repository = $this->getRepository($dispatcher); | |
| 111 | 114 | ||
| 112 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheMissed')); | ||
| 113 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\KeyWritten')); | ||
| 115 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheMissed::class, ['key' => 'foo'])); | ||
| 116 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(KeyWritten::class, ['key' => 'foo', 'value' => 'bar'])); | ||
| 114 | 117 | $this->assertEquals('bar', $repository->remember('foo', 99, function () { | |
| 115 | 118 | return 'bar'; | |
| 116 | 119 | })); | |
| 117 | 120 | ||
| 118 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheMissed')); | ||
| 119 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\KeyWritten')); | ||
| 121 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheMissed::class, ['key' => 'foo', 'tags' => ['taylor']])); | ||
| 122 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(KeyWritten::class, ['key' => 'foo', 'value' => 'bar', 'tags' => ['taylor']])); | ||
| 120 | 123 | $this->assertEquals('bar', $repository->tags('taylor')->remember('foo', 99, function () { | |
| 121 | 124 | return 'bar'; | |
| 122 | 125 | })); | |
@@ -127,14 +130,14 @@ public function testRememberForeverTriggersEvents() | |||
| 127 | 130 | $dispatcher = $this->getDispatcher(); | |
| 128 | 131 | $repository = $this->getRepository($dispatcher); | |
| 129 | 132 | ||
| 130 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheMissed')); | ||
| 131 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\KeyWritten')); | ||
| 133 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheMissed::class, ['key' => 'foo'])); | ||
| 134 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(KeyWritten::class, ['key' => 'foo', 'value' => 'bar'])); | ||
| 132 | 135 | $this->assertEquals('bar', $repository->rememberForever('foo', function () { | |
| 133 | 136 | return 'bar'; | |
| 134 | 137 | })); | |
| 135 | 138 | ||
| 136 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheMissed')); | ||
| 137 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\KeyWritten')); | ||
| 139 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(CacheMissed::class, ['key' => 'foo', 'tags' => ['taylor']])); | ||
| 140 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(KeyWritten::class, ['key' => 'foo', 'value' => 'bar', 'tags' => ['taylor']])); | ||
| 138 | 141 | $this->assertEquals('bar', $repository->tags('taylor')->rememberForever('foo', function () { | |
| 139 | 142 | return 'bar'; | |
| 140 | 143 | })); | |
@@ -145,11 +148,28 @@ public function testForgetTriggersEvents() | |||
| 145 | 148 | $dispatcher = $this->getDispatcher(); | |
| 146 | 149 | $repository = $this->getRepository($dispatcher); | |
| 147 | 150 | ||
| 148 | - $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\KeyForgotten')); | ||
| 151 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(KeyForgotten::class, ['key' => 'baz'])); | ||
| 149 | 152 | $this->assertTrue($repository->forget('baz')); | |
| 150 | 153 | ||
| 151 | - // $dispatcher->shouldReceive('fire')->once()->with(m::type('Illuminate\Cache\Events\CacheMissed')); | ||
| 152 | - // $this->assertTrue($repository->tags('taylor')->forget('baz')); | ||
| 154 | + $dispatcher->shouldReceive('fire')->once()->with($this->assertEventMatches(KeyForgotten::class, ['key' => 'baz', 'tags' => ['taylor']])); | ||
| 155 | + $this->assertTrue($repository->tags('taylor')->forget('baz')); | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + protected function assertEventMatches($eventClass, $properties = []) | ||
| 159 | + { | ||
| 160 | + return m::on(function ($event) use ($eventClass, $properties) { | ||
| 161 | + if (! $event instanceof $eventClass) { | ||
| 162 | + return false; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + foreach ($properties as $name => $value) { | ||
| 166 | + if ($event->$name != $value) { | ||
| 167 | + return false; | ||
| 168 | + } | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + return true; | ||
| 172 | + }); | ||
| 153 | 173 | } | |
| 154 | 174 | ||
| 155 | 175 | protected function getDispatcher() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ public function testBuildCommand() | |||
| 9 | 9 | $event = new Event('php -i'); | |
| 10 | 10 | ||
| 11 | 11 | $defaultOutput = (DIRECTORY_SEPARATOR == '\\') ? 'NUL' : '/dev/null'; | |
| 12 | - $this->assertSame("php -i > {$defaultOutput} 2>&1 &", $event->buildCommand()); | ||
| 12 | + $this->assertSame("php -i > '{$defaultOutput}' 2>&1 &", $event->buildCommand()); | ||
| 13 | 13 | } | |
| 14 | 14 | ||
| 15 | 15 | public function testBuildCommandSendOutputTo() | |
@@ -32,4 +32,15 @@ public function testBuildCommandAppendOutput() | |||
| 32 | 32 | $event->appendOutputTo('/dev/null'); | |
| 33 | 33 | $this->assertSame("php -i >> '/dev/null' 2>&1 &", $event->buildCommand()); | |
| 34 | 34 | } | |
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * @expectedException LogicException | ||
| 38 | + */ | ||
| 39 | + public function testEmailOutputToThrowsExceptionIfOutputFileWasNotSpecified() | ||
| 40 | + { | ||
| 41 | + $event = new Event('php -i'); | ||
| 42 | + $event->emailOutputTo('foo@example.com'); | ||
| 43 | + | ||
| 44 | + $event->buildCommand(); | ||
| 45 | + } | ||
| 35 | 46 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments