Skip to content

Commit

Permalink
extend abstract class and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
peter279k committed Jan 12, 2017
1 parent 6de4ba4 commit e4117d2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
16 changes: 16 additions & 0 deletions tests/Constraint/AbstractConstraintInstance.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/*
* This file is part of composer/semver.
*
* (c) Composer <https://github.com/composer>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

namespace Composer\Semver\Constraint;

class AbstractConstraintInstance extends AbstractConstraint
{
}
12 changes: 4 additions & 8 deletions tests/Constraint/AbstractConstraintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@ class AbstractConstraintTest extends \PHPUnit_Framework_TestCase
public function testAbstractConstraintWithDeprecated()
{
$expectedString = 'pretty string';
$constraint = new \ReflectionClass('\Composer\Semver\Constraint\AbstractConstraint');
$setPrettyString = $constraint->getMethod('setPrettyString');
$setPrettyString->setAccessible(true);
$setPrettyString->invoke($constraint, 'pretty string');

$getPrettyString = $constraint->getMethod('getPrettyString');
$getPrettyString->setAccessible(true);
$result = $setPrettyString->invoke($constraint);
$constraint = new AbstractConstraintInstance();

$constraint->setPrettyString('pretty-string');
$result = $constraint->getPrettyString();

$this->assertSame($expectedString, $result);
}
Expand Down

0 comments on commit e4117d2

Please sign in to comment.