GitHub
Tests: 12 • Commercial: 2 • Pet projects: 4 • Legacy: 4
Total: 22

.NET Framework

Test
2021

Project Request

ASP.NET MVC • C# • SQL Server
Idea of the project: if someone wants to order a project development, here you can send an application.
Test
2020

ProjectC

ASP.NET MVC • C# • JSON • jQuery
JSON data processing.
Test
2020

Vehicle Maintenance

ASP.NET MVC • VB.NET • JSON
Idea of the project: if someone wants to order a project development, here you can send an application.
Test
2019

Movie Navigator

ASP.NET MVC • VB.NET
Request information about movie from IMDB.
Test
2018

Customers Exchange

ASP.NET MVC • C# • SQL Server
Automated teller machine emulation.
Test
2016

ATM

ASP.NET MVC • C#
Automated teller machine emulation.

.NET Core

Pet project
2022

Mail Daemon

.NET 8 • Console • JSON
Utility to send mails with customizable settings.

Custom

Code
2024

Buns of code

.NET Framework • C# • JavaScript
Code snippets from my projects, ready to use; tiny tests; code examples.

PHP

Test
2024

Mediabox

PHP 8 • Laravel 11 • Vue.js • Composer • SQLite
Test project for media files management.
Test
2020

Loan Castle

PHP • MariaDB
Jums jāizstrādā kāda lielāk projekta prototips. Izstrādājot prototipu, paturiet prātā, ka projektam attīstoties, šo prototipu varētu vajadzēt pilnveidot.
Test
2020

Content Management

PHP • MySQL • AJAX
Создать простой сайт, где будет страница с формой для авторизации и страница для авторизованного пользователя.
Test
2019

Laravel

PHP • Laravel • Vue.js • Composer • SQLite
Izveidot aplikāciju, kura ik pēc noteikta intervāla (60 sekundes) veic ierakstu datubāzē izmantojot Laravel freimworka iebūvēto funkcionalitāti.
Test
2019

Phone Check

PHP • JavaScript • JSON • Docker
Implement application to detect country by phone number.

Frontend

Test
2021

Forex Wall

npm • React
For this exercise, what we need is a simple live wall for tracking currencies.

Business projects

Commercial
2008

Certification Center

.NET Framework 4.8 • ASP.NET Web Forms • C# • LINQ • SQL Server • ADO.NET • Dapper • JavaScript • jQuery • Git
Transport registration and certification services in Latvia, Customer Relationship Management.
Commercial
2000

Amerikas Auto

.NET Framework 4.8 • ASP.NET Web Forms • C# • LINQ • SQL Server • ADO.NET • Entity Framework • JavaScript • jQuery • Git
Car service and spare parts for all USA and European car models, Customer Relationship Management.

Pet projects

Pet project
2023

Geolocation Assistant

.NET 8 • ASP.NET Core • C# • Web API • JSON • Git
Website for determining geolocation by IP or geotagged photo.
Pet project
2008

Web Dynamics

.NET Framework 4.8 • ASP.NET Web Forms • C# • LINQ • Web API • JSON • SQL Server • Dapper • JavaScript • jQuery • SVG • Git
Software development blog. Articles, books, videos, content management.
Pet project
2000

Blackball

.NET Framework 4.8 • ASP.NET Web Forms • C# • LINQ • Web API • JSON • XML • SQL Server • Dapper • JavaScript • jQuery • SVG • Git
My entertainment portal created from scratch.

Good old times

Legacy
2000

DOS Clock

Turbo Pascal • Assembler
Digital clock.
Legacy
2000

BrainOut

Turbo Pascal • Assembler
Tank battle game.
Legacy
1999

Airport Administrator

Turbo Pascal
Курсовая работа в институте.
Legacy
1998

Atomizer

Turbo Pascal • Assembler
Atomizer, aka «Studio2D». Graphic raster editor. AGI is my own «Atomizer Generated Image» file format.

Laravel

2019 Test

Izveidot aplikāciju, kura ik pēc noteikta intervāla (60 sekundes) veic ierakstu datubāzē izmantojot Laravel freimworka iebūvēto funkcionalitāti.

PHP Laravel Vue.js Composer SQLite
Information
Source code
  app
  Http
  Auth
  css
  js
  js
  lang
  en
  sass
  app
  data
  logs
  Unit
  src
  src
  lib
  docs
  en
  src
  docs
  en
  lib
  src
  Cron
  Cron
  src
  filp
  src
  css
  js
  Util
  src
  ORM
  Spot
  test
  Core
  Text
  Type
  Xml
  Core
  Text
  Type
  Xml
  html
  src
  src
  src
  Auth
  make
  auth
  Bus
  Auth
  Bus
  Http
  Mail
  View
  Auth
  Bus
  Http
  Http
  Json
  Log
  Mail
  html
  text
  Jobs
  View
  src
  src
  Util
  docs
  Pass
  Pass
  Pass
  doc
  src
  Curl
  doc
  f001
  f002
  f003
  f004
  f005
  f006
  f007
  f008
  src
  Date
  Spl
  src
  Lang
  List
  doc
  lib
  Node
  Expr
  Cast
  Name
  Stmt
  test
  code
  expr
  uvs
  stmt
  loop
  expr
  stmt
  Node
  Stmt
  src
  opis
  src
  dist
  lib
  src
  xml
  xml
  src
  Unit
  src
  src
  Tags
  src
  src
  src
  Call
  Node
  Call
  Util
  src
  Node
  Html
  css
  js
  Xml
  HTML
  XML
  src
  src
  src
  src
  src
  Stub
  Hook
  Util
  Log
  PHP
  cli
  1149
  1216
  1265
  1330
  1335
  1337
  1348
  1351
  1374
  1437
  1468
  1471
  1472
  1570
  2085
  2137
  2145
  2158
  2366
  2380
  2382
  2435
  244
  2448
  2724
  2725
  2731
  2811
  2830
  2972
  3093
  3107
  3156
  322
  3364
  3379
  3380
  3396
  433
  445
  498
  503
  581
  74
  765
  797
  873
  Trac
  1021
  523
  578
  684
  783
  fail
  unit
  Util
  PHP
  psr
  src
  log
  Psr
  Log
  Test
  src
  psy
  src
  Sudo
  Util
  test
  Sudo
  Util
  box
  uuid
  src
  Time
  Node
  Time
  src
  src
  diff
  src
  out
  src
  src
  src
  src
  src
  src
  src
  src
  doc
  lib
  Mime
  Pop
  Auth
  Mime
  bug
  unit
  Mime
  Auth
  dkim
  Node
  Node
  psr4
  phpt
  .dot
  b
  a
  A
  B
  C
  copy
  A
  B
  C
  one
  b
  .dot
  a
  dir
  File
  Test
  File
  test
  Test
  Log
  Log
  mime
  Part
  test
  Part
  glob
  Test
  data
  dat
  res
  Util
  Util
  Test
  css
  js
  Test
  Test
  src
  src
  Css
  Rule
  src
  src
  .env
  null
Root / vendor / symfony / console / Tests / Input / ArgvInputTest.php
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Input; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; class ArgvInputTest extends TestCase { public function testConstructor() { $_SERVER['argv'] = ['cli.php', 'foo']; $input = new ArgvInput(); $r = new \ReflectionObject($input); $p = $r->getProperty('tokens'); $p->setAccessible(true); $this->assertEquals(['foo'], $p->getValue($input), '__construct() automatically get its input from the argv server variable'); } public function testParseArguments() { $input = new ArgvInput(['cli.php', 'foo']); $input->bind(new InputDefinition([new InputArgument('name')])); $this->assertEquals(['name' => 'foo'], $input->getArguments(), '->parse() parses required arguments'); $input->bind(new InputDefinition([new InputArgument('name')])); $this->assertEquals(['name' => 'foo'], $input->getArguments(), '->parse() is stateless'); } /** * @dataProvider provideOptions */ public function testParseOptions($input, $options, $expectedOptions, $message) { $input = new ArgvInput($input); $input->bind(new InputDefinition($options)); $this->assertSame($expectedOptions, $input->getOptions(), $message); } public function provideOptions() { return [ [ ['cli.php', '--foo'], [new InputOption('foo')], ['foo' => true], '->parse() parses long options without a value', ], [ ['cli.php', '--foo=bar'], [new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)], ['foo' => 'bar'], '->parse() parses long options with a required value (with a = separator)', ], [ ['cli.php', '--foo', 'bar'], [new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)], ['foo' => 'bar'], '->parse() parses long options with a required value (with a space separator)', ], [ ['cli.php', '--foo='], [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)], ['foo' => ''], '->parse() parses long options with optional value which is empty (with a = separator) as empty string', ], [ ['cli.php', '--foo=', 'bar'], [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)], ['foo' => ''], '->parse() parses long options with optional value without value specified or an empty string (with a = separator) followed by an argument as empty string', ], [ ['cli.php', 'bar', '--foo'], [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)], ['foo' => null], '->parse() parses long options with optional value which is empty (with a = separator) preceded by an argument', ], [ ['cli.php', '--foo', '', 'bar'], [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)], ['foo' => ''], '->parse() parses long options with optional value which is empty as empty string even followed by an argument', ], [ ['cli.php', '--foo'], [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)], ['foo' => null], '->parse() parses long options with optional value specified with no separator and no value as null', ], [ ['cli.php', '-f'], [new InputOption('foo', 'f')], ['foo' => true], '->parse() parses short options without a value', ], [ ['cli.php', '-fbar'], [new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)], ['foo' => 'bar'], '->parse() parses short options with a required value (with no separator)', ], [ ['cli.php', '-f', 'bar'], [new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)], ['foo' => 'bar'], '->parse() parses short options with a required value (with a space separator)', ], [ ['cli.php', '-f', ''], [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)], ['foo' => ''], '->parse() parses short options with an optional empty value', ], [ ['cli.php', '-f', '', 'foo'], [new InputArgument('name'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)], ['foo' => ''], '->parse() parses short options with an optional empty value followed by an argument', ], [ ['cli.php', '-f', '', '-b'], [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b')], ['foo' => '', 'bar' => true], '->parse() parses short options with an optional empty value followed by an option', ], [ ['cli.php', '-f', '-b', 'foo'], [new InputArgument('name'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b')], ['foo' => null, 'bar' => true], '->parse() parses short options with an optional value which is not present', ], [ ['cli.php', '-fb'], [new InputOption('foo', 'f'), new InputOption('bar', 'b')], ['foo' => true, 'bar' => true], '->parse() parses short options when they are aggregated as a single one', ], [ ['cli.php', '-fb', 'bar'], [new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_REQUIRED)], ['foo' => true, 'bar' => 'bar'], '->parse() parses short options when they are aggregated as a single one and the last one has a required value', ], [ ['cli.php', '-fb', 'bar'], [new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)], ['foo' => true, 'bar' => 'bar'], '->parse() parses short options when they are aggregated as a single one and the last one has an optional value', ], [ ['cli.php', '-fbbar'], [new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)], ['foo' => true, 'bar' => 'bar'], '->parse() parses short options when they are aggregated as a single one and the last one has an optional value with no separator', ], [ ['cli.php', '-fbbar'], [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)], ['foo' => 'bbar', 'bar' => null], '->parse() parses short options when they are aggregated as a single one and one of them takes a value', ], ]; } /** * @dataProvider provideInvalidInput */ public function testInvalidInput($argv, $definition, $expectedExceptionMessage) { if (method_exists($this, 'expectException')) { $this->expectException('RuntimeException'); $this->expectExceptionMessage($expectedExceptionMessage); } else { $this->setExpectedException('RuntimeException', $expectedExceptionMessage); } $input = new ArgvInput($argv); $input->bind($definition); } public function provideInvalidInput() { return [ [ ['cli.php', '--foo'], new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)]), 'The "--foo" option requires a value.', ], [ ['cli.php', '-f'], new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)]), 'The "--foo" option requires a value.', ], [ ['cli.php', '-ffoo'], new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_NONE)]), 'The "-o" option does not exist.', ], [ ['cli.php', '--foo=bar'], new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_NONE)]), 'The "--foo" option does not accept a value.', ], [ ['cli.php', 'foo', 'bar'], new InputDefinition(), 'No arguments expected, got "foo".', ], [ ['cli.php', 'foo', 'bar'], new InputDefinition([new InputArgument('number')]), 'Too many arguments, expected arguments "number".', ], [ ['cli.php', 'foo', 'bar', 'zzz'], new InputDefinition([new InputArgument('number'), new InputArgument('county')]), 'Too many arguments, expected arguments "number" "county".', ], [ ['cli.php', '--foo'], new InputDefinition(), 'The "--foo" option does not exist.', ], [ ['cli.php', '-f'], new InputDefinition(), 'The "-f" option does not exist.', ], [ ['cli.php', '-1'], new InputDefinition([new InputArgument('number')]), 'The "-1" option does not exist.', ], [ ['cli.php', '-fЩ'], new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_NONE)]), 'The "-Щ" option does not exist.', ], ]; } public function testParseArrayArgument() { $input = new ArgvInput(['cli.php', 'foo', 'bar', 'baz', 'bat']); $input->bind(new InputDefinition([new InputArgument('name', InputArgument::IS_ARRAY)])); $this->assertEquals(['name' => ['foo', 'bar', 'baz', 'bat']], $input->getArguments(), '->parse() parses array arguments'); } public function testParseArrayOption() { $input = new ArgvInput(['cli.php', '--name=foo', '--name=bar', '--name=baz']); $input->bind(new InputDefinition([new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)])); $this->assertEquals(['name' => ['foo', 'bar', 'baz']], $input->getOptions(), '->parse() parses array options ("--option=value" syntax)'); $input = new ArgvInput(['cli.php', '--name', 'foo', '--name', 'bar', '--name', 'baz']); $input->bind(new InputDefinition([new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)])); $this->assertEquals(['name' => ['foo', 'bar', 'baz']], $input->getOptions(), '->parse() parses array options ("--option value" syntax)'); $input = new ArgvInput(['cli.php', '--name=foo', '--name=bar', '--name=']); $input->bind(new InputDefinition([new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)])); $this->assertSame(['name' => ['foo', 'bar', '']], $input->getOptions(), '->parse() parses empty array options as null ("--option=value" syntax)'); $input = new ArgvInput(['cli.php', '--name', 'foo', '--name', 'bar', '--name', '--anotherOption']); $input->bind(new InputDefinition([ new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY), new InputOption('anotherOption', null, InputOption::VALUE_NONE), ])); $this->assertSame(['name' => ['foo', 'bar', null], 'anotherOption' => true], $input->getOptions(), '->parse() parses empty array options ("--option value" syntax)'); } public function testParseNegativeNumberAfterDoubleDash() { $input = new ArgvInput(['cli.php', '--', '-1']); $input->bind(new InputDefinition([new InputArgument('number')])); $this->assertEquals(['number' => '-1'], $input->getArguments(), '->parse() parses arguments with leading dashes as arguments after having encountered a double-dash sequence'); $input = new ArgvInput(['cli.php', '-f', 'bar', '--', '-1']); $input->bind(new InputDefinition([new InputArgument('number'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)])); $this->assertEquals(['foo' => 'bar'], $input->getOptions(), '->parse() parses arguments with leading dashes as options before having encountered a double-dash sequence'); $this->assertEquals(['number' => '-1'], $input->getArguments(), '->parse() parses arguments with leading dashes as arguments after having encountered a double-dash sequence'); } public function testParseEmptyStringArgument() { $input = new ArgvInput(['cli.php', '-f', 'bar', '']); $input->bind(new InputDefinition([new InputArgument('empty'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)])); $this->assertEquals(['empty' => ''], $input->getArguments(), '->parse() parses empty string arguments'); } public function testGetFirstArgument() { $input = new ArgvInput(['cli.php', '-fbbar']); $this->assertNull($input->getFirstArgument(), '->getFirstArgument() returns null when there is no arguments'); $input = new ArgvInput(['cli.php', '-fbbar', 'foo']); $this->assertEquals('foo', $input->getFirstArgument(), '->getFirstArgument() returns the first argument from the raw input'); $input = new ArgvInput(['cli.php', '--foo', 'fooval', 'bar']); $input->bind(new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('arg')])); $this->assertSame('bar', $input->getFirstArgument()); $input = new ArgvInput(['cli.php', '-bf', 'fooval', 'argval']); $input->bind(new InputDefinition([new InputOption('bar', 'b', InputOption::VALUE_NONE), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('arg')])); $this->assertSame('argval', $input->getFirstArgument()); } public function testHasParameterOption() { $input = new ArgvInput(['cli.php', '-f', 'foo']); $this->assertTrue($input->hasParameterOption('-f'), '->hasParameterOption() returns true if the given short option is in the raw input'); $input = new ArgvInput(['cli.php', '-etest']); $this->assertTrue($input->hasParameterOption('-e'), '->hasParameterOption() returns true if the given short option is in the raw input'); $this->assertFalse($input->hasParameterOption('-s'), '->hasParameterOption() returns true if the given short option is in the raw input'); $input = new ArgvInput(['cli.php', '--foo', 'foo']); $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input'); $input = new ArgvInput(['cli.php', 'foo']); $this->assertFalse($input->hasParameterOption('--foo'), '->hasParameterOption() returns false if the given short option is not in the raw input'); $input = new ArgvInput(['cli.php', '--foo=bar']); $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given option with provided value is in the raw input'); } public function testHasParameterOptionOnlyOptions() { $input = new ArgvInput(['cli.php', '-f', 'foo']); $this->assertTrue($input->hasParameterOption('-f', true), '->hasParameterOption() returns true if the given short option is in the raw input'); $input = new ArgvInput(['cli.php', '--foo', '--', 'foo']); $this->assertTrue($input->hasParameterOption('--foo', true), '->hasParameterOption() returns true if the given long option is in the raw input'); $input = new ArgvInput(['cli.php', '--foo=bar', 'foo']); $this->assertTrue($input->hasParameterOption('--foo', true), '->hasParameterOption() returns true if the given long option with provided value is in the raw input'); $input = new ArgvInput(['cli.php', '--', '--foo']); $this->assertFalse($input->hasParameterOption('--foo', true), '->hasParameterOption() returns false if the given option is in the raw input but after an end of options signal'); } public function testHasParameterOptionEdgeCasesAndLimitations() { $input = new ArgvInput(['cli.php', '-fh']); // hasParameterOption does not know if the previous short option, -f, // takes a value or not. If -f takes a value, then -fh does NOT include // -h; Otherwise it does. Since we do not know which short options take // values, hasParameterOption does not support this use-case. $this->assertFalse($input->hasParameterOption('-h'), '->hasParameterOption() returns true if the given short option is in the raw input'); // hasParameterOption does detect that `-fh` contains `-f`, since // `-f` is the first short option in the set. $this->assertTrue($input->hasParameterOption('-f'), '->hasParameterOption() returns true if the given short option is in the raw input'); // The test below happens to pass, although it might make more sense // to disallow it, and require the use of // $input->hasParameterOption('-f') && $input->hasParameterOption('-h') // instead. $this->assertTrue($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input'); // In theory, if -fh is supported, then -hf should also work. // However, this is not supported. $this->assertFalse($input->hasParameterOption('-hf'), '->hasParameterOption() returns true if the given short option is in the raw input'); $input = new ArgvInput(['cli.php', '-f', '-h']); // If hasParameterOption('-fh') is supported for 'cli.php -fh', then // one might also expect that it should also be supported for // 'cli.php -f -h'. However, this is not supported. $this->assertFalse($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input'); } public function testNoWarningOnInvalidParameterOption() { $input = new ArgvInput(['cli.php', '-edev']); $this->assertTrue($input->hasParameterOption(['-e', ''])); // No warning thrown $this->assertFalse($input->hasParameterOption(['-m', ''])); $this->assertEquals('dev', $input->getParameterOption(['-e', ''])); // No warning thrown $this->assertFalse($input->getParameterOption(['-m', ''])); } public function testToString() { $input = new ArgvInput(['cli.php', '-f', 'foo']); $this->assertEquals('-f foo', (string) $input); $input = new ArgvInput(['cli.php', '-f', '--bar=foo', 'a b c d', "A\nB'C"]); $this->assertEquals('-f --bar=foo '.escapeshellarg('a b c d').' '.escapeshellarg("A\nB'C"), (string) $input); } /** * @dataProvider provideGetParameterOptionValues */ public function testGetParameterOptionEqualSign($argv, $key, $default, $onlyParams, $expected) { $input = new ArgvInput($argv); $this->assertEquals($expected, $input->getParameterOption($key, $default, $onlyParams), '->getParameterOption() returns the expected value'); } public function provideGetParameterOptionValues() { return [ [['app/console', 'foo:bar'], '-e', 'default', false, 'default'], [['app/console', 'foo:bar', '-e', 'dev'], '-e', 'default', false, 'dev'], [['app/console', 'foo:bar', '--env=dev'], '--env', 'default', false, 'dev'], [['app/console', 'foo:bar', '-e', 'dev'], ['-e', '--env'], 'default', false, 'dev'], [['app/console', 'foo:bar', '--env=dev'], ['-e', '--env'], 'default', false, 'dev'], [['app/console', 'foo:bar', '--env=dev', '--en=1'], ['--en'], 'default', false, '1'], [['app/console', 'foo:bar', '--env=dev', '', '--en=1'], ['--en'], 'default', false, '1'], [['app/console', 'foo:bar', '--env', 'val'], '--env', 'default', false, 'val'], [['app/console', 'foo:bar', '--env', 'val', '--dummy'], '--env', 'default', false, 'val'], [['app/console', 'foo:bar', '--', '--env=dev'], '--env', 'default', false, 'dev'], [['app/console', 'foo:bar', '--', '--env=dev'], '--env', 'default', true, 'default'], ]; } public function testParseSingleDashAsArgument() { $input = new ArgvInput(['cli.php', '-']); $input->bind(new InputDefinition([new InputArgument('file')])); $this->assertEquals(['file' => '-'], $input->getArguments(), '->parse() parses single dash as an argument'); } public function testParseOptionWithValueOptionalGivenEmptyAndRequiredArgument() { $input = new ArgvInput(['cli.php', '--foo=', 'bar']); $input->bind(new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)])); $this->assertEquals(['foo' => null], $input->getOptions(), '->parse() parses optional options with empty value as null'); $this->assertEquals(['name' => 'bar'], $input->getArguments(), '->parse() parses required arguments'); $input = new ArgvInput(['cli.php', '--foo=0', 'bar']); $input->bind(new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)])); $this->assertEquals(['foo' => '0'], $input->getOptions(), '->parse() parses optional options with empty value as null'); $this->assertEquals(['name' => 'bar'], $input->getArguments(), '->parse() parses required arguments'); } public function testParseOptionWithValueOptionalGivenEmptyAndOptionalArgument() { $input = new ArgvInput(['cli.php', '--foo=', 'bar']); $input->bind(new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::OPTIONAL)])); $this->assertEquals(['foo' => null], $input->getOptions(), '->parse() parses optional options with empty value as null'); $this->assertEquals(['name' => 'bar'], $input->getArguments(), '->parse() parses optional arguments'); $input = new ArgvInput(['cli.php', '--foo=0', 'bar']); $input->bind(new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::OPTIONAL)])); $this->assertEquals(['foo' => '0'], $input->getOptions(), '->parse() parses optional options with empty value as null'); $this->assertEquals(['name' => 'bar'], $input->getArguments(), '->parse() parses optional arguments'); } }