Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase code coverage #98

Merged
merged 4 commits into from
Dec 6, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="Doctrine Collections Test Suite">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\Tests\Common\Collections;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Tests\LazyArrayCollection;

/**
* Tests for {@see \Doctrine\Common\Collections\AbstractLazyCollection}
*
* @covers \Doctrine\Common\Collections\AbstractLazyCollection
*/
class AbstractLazyCollectionTest extends BaseArrayCollectionTest
{

protected function _buildCollection(array $elements = array())
{
return new LazyArrayCollection(new ArrayCollection($elements));
}

public function testLazyCollection()
{
$collection = $this->_buildCollection(array('a', 'b', 'c'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you switch to short arrays when you move around these files?


$this->assertFalse($collection->isInitialized());
$this->assertCount(3, $collection);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@

namespace Doctrine\Tests\Common\Collections;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Tests\LazyArrayCollection;

class AbstractLazyCollectionTest extends \PHPUnit_Framework_TestCase
/**
* Tests for {@see \Doctrine\Common\Collections\AbstractLazyCollection}
*
* @covers \Doctrine\Common\Collections\AbstractLazyCollection
*/
class LazyCollectionTest extends BaseCollectionTest
{
public function testLazyCollection()
protected function setUp()
{
$collection = new LazyArrayCollection();

$this->assertFalse($collection->isInitialized());
$this->assertCount(3, $collection);

$collection->add('bar');
$this->assertTrue($collection->isInitialized());
$this->assertCount(4, $collection);
$this->collection = new LazyArrayCollection(new ArrayCollection());
}
}
Loading