comparison vendor/phar-io/manifest/tests/values/BundledComponentCollectionTest.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents
children
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
1 <?php
2 /*
3 * This file is part of PharIo\Manifest.
4 *
5 * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10
11 namespace PharIo\Manifest;
12
13 use PharIo\Version\Version;
14 use PHPUnit\Framework\TestCase;
15
16 /**
17 * @covers \PharIo\Manifest\BundledComponentCollection
18 * @covers \PharIo\Manifest\BundledComponentCollectionIterator
19 *
20 * @uses \PharIo\Manifest\BundledComponent
21 * @uses \PharIo\Version\Version
22 */
23 class BundledComponentCollectionTest extends TestCase {
24 /**
25 * @var BundledComponentCollection
26 */
27 private $collection;
28
29 /**
30 * @var BundledComponent
31 */
32 private $item;
33
34 protected function setUp() {
35 $this->collection = new BundledComponentCollection;
36 $this->item = new BundledComponent('phpunit/php-code-coverage', new Version('4.0.2'));
37 }
38
39 public function testCanBeCreated() {
40 $this->assertInstanceOf(BundledComponentCollection::class, $this->collection);
41 }
42
43 public function testCanBeCounted() {
44 $this->collection->add($this->item);
45
46 $this->assertCount(1, $this->collection);
47 }
48
49 public function testCanBeIterated() {
50 $this->collection->add($this->createMock(BundledComponent::class));
51 $this->collection->add($this->item);
52
53 $this->assertContains($this->item, $this->collection);
54 }
55
56 public function testKeyPositionCanBeRetreived() {
57 $this->collection->add($this->item);
58 foreach($this->collection as $key => $item) {
59 $this->assertEquals(0, $key);
60 }
61 }
62
63 }