1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace Fgm\ComposerCheck\Tests;
- use Fgm\ComposerCheck\LockLoader;
- /**
- * Class TestLoader allows faking the composer.lock file contents.
- */
- class TestLoader extends LockLoader {
- public function __construct(string $directory) {
- }
- public function setData($data) {
- $this->contents['packages'] = $data['packages'];
- $this->contents['packages-dev'] = $data['packages-dev'];
- $this->contents['platform'] = $data['platform'];
- }
- }
- /**
- * Class LockLoaderTest
- *
- * @coversDefaultClass Fgm\ComposerCheck\LockLoader
- */
- class LockLoaderTest extends \PHPUnit_Framework_TestCase {
- /**
- * @return array $lock
- * An array of simplified versions of lock data.
- */
- public function lockParsingProvider() {
- return [
- [[
- 'packages' => [
- 'r1' => 'R1',
- ],
- 'packages-dev' => [
- 'd1' => 'D1',
- ],
- 'platform' => [
- 'p1' => 'P1',
- ],
- ]],
- ];
- }
- /**
- * @dataProvider lockParsingProvider
- */
- public function testLockParsing($lockData) {
- $loader = new TestLoader("");
- $loader->setData($lockData);
- $loader->parse();
- $actualRun = $loader->getRun();
- $actualDev = $loader->getDev();
-
- }
- }
|