Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
b67e1f86
Commit
b67e1f86
authored
Apr 09, 2010
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed testsuite after CLI refactorings, Removed Symfony YAML Autoloader Hack
parent
c98543c1
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
3 additions
and
364 deletions
+3
-364
AllTests.php
tests/Doctrine/Tests/Common/AllTests.php
+0
-1
AllTests.php
tests/Doctrine/Tests/Common/CLI/AllTests.php
+0
-34
CLIControllerTest.php
tests/Doctrine/Tests/Common/CLI/CLIControllerTest.php
+0
-115
ConfigurationTest.php
tests/Doctrine/Tests/Common/CLI/ConfigurationTest.php
+0
-23
OptionGroupTest.php
tests/Doctrine/Tests/Common/CLI/OptionGroupTest.php
+0
-123
OptionTest.php
tests/Doctrine/Tests/Common/CLI/OptionTest.php
+0
-40
StyleTest.php
tests/Doctrine/Tests/Common/CLI/StyleTest.php
+0
-19
TestInit.php
tests/Doctrine/Tests/TestInit.php
+3
-9
No files found.
tests/Doctrine/Tests/Common/AllTests.php
View file @
b67e1f86
...
...
@@ -29,7 +29,6 @@ class AllTests
$suite
->
addTest
(
Collections\AllTests
::
suite
());
$suite
->
addTest
(
Annotations\AllTests
::
suite
());
$suite
->
addTest
(
Cache\AllTests
::
suite
());
$suite
->
addTest
(
CLI\AllTests
::
suite
());
return
$suite
;
}
...
...
tests/Doctrine/Tests/Common/CLI/AllTests.php
deleted
100644 → 0
View file @
c98543c1
<?php
namespace
Doctrine\Tests\Common\CLI
;
if
(
!
defined
(
'PHPUnit_MAIN_METHOD'
))
{
define
(
'PHPUnit_MAIN_METHOD'
,
'Common_Cli_AllTests::main'
);
}
require_once
__DIR__
.
'/../../TestInit.php'
;
class
AllTests
{
public
static
function
main
()
{
\PHPUnit_TextUI_TestRunner
::
run
(
self
::
suite
());
}
public
static
function
suite
()
{
$suite
=
new
\Doctrine\Tests\DoctrineTestSuite
(
'Doctrine Common CLI Tests'
);
$suite
->
addTestSuite
(
'Doctrine\Tests\Common\CLI\ConfigurationTest'
);
$suite
->
addTestSuite
(
'Doctrine\Tests\Common\CLI\OptionTest'
);
$suite
->
addTestSuite
(
'Doctrine\Tests\Common\CLI\OptionGroupTest'
);
$suite
->
addTestSuite
(
'Doctrine\Tests\Common\CLI\StyleTest'
);
//$suite->addTestSuite('Doctrine\Tests\Common\CLI\CLIControllerTest');
return
$suite
;
}
}
if
(
PHPUnit_MAIN_METHOD
==
'Common_CLI_AllTests::main'
)
{
AllTests
::
main
();
}
\ No newline at end of file
tests/Doctrine/Tests/Common/CLI/CLIControllerTest.php
deleted
100644 → 0
View file @
c98543c1
<?php
namespace
Doctrine\Tests\Common\CLI
;
use
Doctrine\Tests\Mocks\TaskMock
;
use
Doctrine\Common\CLI\Configuration
;
use
Doctrine\Common\CLI\CliController
;
require_once
__DIR__
.
'/../../TestInit.php'
;
/**
* @author Nils Adermann <naderman@naderman.de>
*/
class
CLIControllerTest
extends
\Doctrine\Tests\DoctrineTestCase
{
private
$cli
;
/**
* Sets up a CLIController instance with a task referencing the TaskMock
* class. Instances of that class created by the CLIController can be
* inspected for correctness.
*/
function
setUp
()
{
$config
=
$this
->
getMock
(
'\Doctrine\Common\CLI\Configuration'
);
$printer
=
$this
->
getMockForAbstractClass
(
'\Doctrine\Common\CLI\Printers\AbstractPrinter'
);
$this
->
cli
=
new
CLIController
(
$config
,
$printer
);
TaskMock
::
$instances
=
array
();
$this
->
cli
->
addTask
(
'task-mock'
,
'\Doctrine\Tests\Mocks\TaskMock'
);
}
/**
* Data provider with a bunch of task-mock calls with different arguments
* and their expected parsed format.
*/
static
public
function
dataCLIControllerArguments
()
{
return
array
(
array
(
array
(
'doctrine'
,
'Core:task-mock'
,
'--bool'
),
array
(
'bool'
=>
true
),
'Bool option'
),
array
(
array
(
'doctrine'
,
'Core:task-mock'
,
'--option=value'
),
array
(
'option'
=>
'value'
),
'Option with string value'
),
array
(
array
(
'doctrine'
,
'Core:task-mock'
,
'--option=value, with additional, info'
),
array
(
'option'
=>
'value, with additional, info'
),
'Option with string value containing space and comma'
),
array
(
array
(
'doctrine'
,
'Core:task-mock'
,
'--option='
),
array
(
'option'
=>
array
()),
'Empty option value'
),
array
(
array
(
'doctrine'
,
'Core:task-mock'
,
'--option=value1,value2,value3'
),
array
(
'option'
=>
array
(
'value1'
,
'value2'
,
'value3'
)),
'Option with list of string values'
),
);
}
/**
* Checks whether the arguments coming from the data provider are correctly
* parsed by the CLIController and passed to the task to be run.
*
* @dataProvider dataCLIControllerArguments
* @param array $rawArgs
* @param array $parsedArgs
* @param string $message
*/
public
function
testArgumentParsing
(
$rawArgs
,
$parsedArgs
,
$message
)
{
$this
->
cli
->
run
(
$rawArgs
);
$this
->
assertEquals
(
count
(
TaskMock
::
$instances
),
1
);
$task
=
TaskMock
::
$instances
[
0
];
$this
->
assertEquals
(
$task
->
getArguments
(),
$parsedArgs
,
$message
);
}
/**
* Checks whether multiple tasks in one command are correctly run with
* their respective options.
*/
public
function
testMultipleTaskExecution
()
{
$this
->
cli
->
run
(
array
(
'doctrine'
,
'Core:task-mock'
,
'--option='
,
'Core:task-mock'
,
'--bool'
));
$this
->
assertEquals
(
count
(
TaskMock
::
$instances
),
2
);
$task0
=
TaskMock
::
$instances
[
0
];
$task1
=
TaskMock
::
$instances
[
1
];
$this
->
assertEquals
(
$task0
->
getRunCounter
(),
1
);
$this
->
assertEquals
(
$task1
->
getRunCounter
(),
1
);
$this
->
assertEquals
(
$task0
->
getArguments
(),
array
(
'option'
=>
array
()));
$this
->
assertEquals
(
$task1
->
getArguments
(),
array
(
'bool'
=>
true
));
}
}
tests/Doctrine/Tests/Common/CLI/ConfigurationTest.php
deleted
100644 → 0
View file @
c98543c1
<?php
namespace
Doctrine\Tests\Common\CLI
;
use
Doctrine\Common\CLI\Configuration
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
ConfigurationTest
extends
\Doctrine\Tests\DoctrineTestCase
{
public
function
testConfiguration
()
{
$config
=
new
Configuration
();
$config
->
setAttribute
(
'name'
,
'value'
);
$this
->
assertTrue
(
$config
->
hasAttribute
(
'name'
));
$this
->
assertEquals
(
'value'
,
$config
->
hasAttribute
(
'name'
));
$config
->
setAttribute
(
'name'
);
$this
->
assertFalse
(
$config
->
hasAttribute
(
'name'
));
}
}
\ No newline at end of file
tests/Doctrine/Tests/Common/CLI/OptionGroupTest.php
deleted
100644 → 0
View file @
c98543c1
<?php
namespace
Doctrine\Tests\Common\CLI
;
use
Doctrine\Common\CLI\Printers\NormalPrinter
,
Doctrine\Common\CLI\OptionGroup
,
Doctrine\Common\CLI\Option
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
OptionGroupTest
extends
\Doctrine\Tests\DoctrineTestCase
{
private
$_options
=
array
();
public
function
setUp
()
{
$this
->
_printer
=
new
NormalPrinter
();
$this
->
_options
[
0
]
=
new
Option
(
'name'
,
null
,
'First option description'
);
$this
->
_options
[
1
]
=
new
Option
(
'another-name'
,
'value'
,
'Second option description'
);
$this
->
_options
[
2
]
=
new
Option
(
'third-name'
,
array
(
'value1'
,
'value2'
),
'Third option description'
);
}
public
function
testCommonFunctionality
()
{
$optionGroup
=
new
OptionGroup
(
OptionGroup
::
CARDINALITY_0_N
,
$this
->
_options
);
$this
->
assertEquals
(
3
,
count
(
$optionGroup
->
getOptions
()));
$this
->
assertEquals
(
'--name First option description'
.
PHP_EOL
.
PHP_EOL
.
'--another-name=value Second option description'
.
PHP_EOL
.
PHP_EOL
.
'--third-name=value1,value2 Third option description'
.
PHP_EOL
.
PHP_EOL
,
$optionGroup
->
formatWithDescription
(
$this
->
_printer
)
);
$optionGroup
->
clear
();
$this
->
assertEquals
(
0
,
count
(
$optionGroup
->
getOptions
()));
$this
->
assertEquals
(
''
,
$optionGroup
->
formatPlain
(
$this
->
_printer
));
$this
->
assertEquals
(
'No available options'
.
PHP_EOL
.
PHP_EOL
,
$optionGroup
->
formatWithDescription
(
$this
->
_printer
)
);
$optionGroup
->
addOption
(
$this
->
_options
[
0
]);
$optionGroup
->
addOption
(
$this
->
_options
[
1
]);
$this
->
assertEquals
(
2
,
count
(
$optionGroup
->
getOptions
()));
}
public
function
testCardinality0toN
()
{
$optionGroup
=
new
OptionGroup
(
OptionGroup
::
CARDINALITY_0_N
,
$this
->
_options
);
$this
->
assertEquals
(
OptionGroup
::
CARDINALITY_0_N
,
$optionGroup
->
getCardinality
());
$this
->
assertEquals
(
'[--name] [--another-name=value] [--third-name=value1,value2]'
,
$optionGroup
->
formatPlain
(
$this
->
_printer
)
);
}
public
function
testCardinality0to1
()
{
$optionGroup
=
new
OptionGroup
(
OptionGroup
::
CARDINALITY_0_1
,
$this
->
_options
);
$this
->
assertEquals
(
OptionGroup
::
CARDINALITY_0_1
,
$optionGroup
->
getCardinality
());
$this
->
assertEquals
(
'[--name | --another-name=value | --third-name=value1,value2]'
,
$optionGroup
->
formatPlain
(
$this
->
_printer
)
);
}
public
function
testCardinality1to1
()
{
$optionGroup
=
new
OptionGroup
(
OptionGroup
::
CARDINALITY_1_1
,
$this
->
_options
);
$this
->
assertEquals
(
OptionGroup
::
CARDINALITY_1_1
,
$optionGroup
->
getCardinality
());
$this
->
assertEquals
(
'(--name | --another-name=value | --third-name=value1,value2)'
,
$optionGroup
->
formatPlain
(
$this
->
_printer
)
);
}
public
function
testCardinality1toN
()
{
$optionGroup
=
new
OptionGroup
(
OptionGroup
::
CARDINALITY_1_N
,
$this
->
_options
);
$this
->
assertEquals
(
OptionGroup
::
CARDINALITY_1_N
,
$optionGroup
->
getCardinality
());
$this
->
assertEquals
(
'(--name --another-name=value --third-name=value1,value2)'
,
$optionGroup
->
formatPlain
(
$this
->
_printer
)
);
}
public
function
testCardinalityNtoN
()
{
$optionGroup
=
new
OptionGroup
(
OptionGroup
::
CARDINALITY_N_N
,
$this
->
_options
);
$this
->
assertEquals
(
OptionGroup
::
CARDINALITY_N_N
,
$optionGroup
->
getCardinality
());
$this
->
assertEquals
(
'--name --another-name=value --third-name=value1,value2'
,
$optionGroup
->
formatPlain
(
$this
->
_printer
)
);
}
public
function
testCardinalityMtoN
()
{
$optionGroup
=
new
OptionGroup
(
OptionGroup
::
CARDINALITY_M_N
,
$this
->
_options
);
$this
->
assertEquals
(
OptionGroup
::
CARDINALITY_M_N
,
$optionGroup
->
getCardinality
());
$this
->
assertEquals
(
'--name --another-name=value --third-name=value1,value2'
,
$optionGroup
->
formatPlain
(
$this
->
_printer
)
);
}
}
\ No newline at end of file
tests/Doctrine/Tests/Common/CLI/OptionTest.php
deleted
100644 → 0
View file @
c98543c1
<?php
namespace
Doctrine\Tests\Common\CLI
;
use
Doctrine\Common\CLI\Option
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
OptionTest
extends
\Doctrine\Tests\DoctrineTestCase
{
public
function
testGetMethods
()
{
$option
=
new
Option
(
'name'
,
'value'
,
'Description'
);
$this
->
assertEquals
(
'name'
,
$option
->
getName
());
$this
->
assertEquals
(
'value'
,
$option
->
getDefaultValue
());
$this
->
assertEquals
(
'Description'
,
$option
->
getDescription
());
}
public
function
testStringCastWithDefaultValue
()
{
$option
=
new
Option
(
'name'
,
'value'
,
'Description'
);
$this
->
assertEquals
(
'--name=value'
,
(
string
)
$option
);
}
public
function
testStringCastWithoutDefaultValue
()
{
$option
=
new
Option
(
'name'
,
null
,
'Description'
);
$this
->
assertEquals
(
'--name'
,
(
string
)
$option
);
}
public
function
testStringCastWithArrayDefaultValue
()
{
$option
=
new
Option
(
'name'
,
array
(
'value1'
,
'value2'
),
'Description'
);
$this
->
assertEquals
(
'--name=value1,value2'
,
(
string
)
$option
);
}
}
\ No newline at end of file
tests/Doctrine/Tests/Common/CLI/StyleTest.php
deleted
100644 → 0
View file @
c98543c1
<?php
namespace
Doctrine\Tests\Common\CLI
;
use
Doctrine\Common\CLI\Style
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
StyleTest
extends
\Doctrine\Tests\DoctrineTestCase
{
public
function
testGetMethods
()
{
$style
=
new
Style
(
'BLACK'
,
'WHITE'
,
array
(
'BOLD'
=>
true
));
$this
->
assertEquals
(
'BLACK'
,
$style
->
getForeground
());
$this
->
assertEquals
(
'WHITE'
,
$style
->
getBackground
());
$this
->
assertEquals
(
array
(
'BOLD'
=>
true
),
$style
->
getOptions
());
}
}
\ No newline at end of file
tests/Doctrine/Tests/TestInit.php
View file @
b67e1f86
...
...
@@ -13,6 +13,9 @@ require_once __DIR__ . '/../../../lib/Doctrine/Common/ClassLoader.php';
$classLoader
=
new
\Doctrine\Common\ClassLoader
(
'Doctrine'
);
$classLoader
->
register
();
$classLoader
=
new
\Doctrine\Common\ClassLoader
(
'Symfony'
,
__DIR__
.
"/../../../lib/vendor"
);
$classLoader
->
register
();
if
(
!
file_exists
(
__DIR__
.
"/Proxies"
))
{
if
(
!
mkdir
(
__DIR__
.
"/Proxies"
))
{
throw
new
Exception
(
"Could not create "
.
__DIR__
.
"/Proxies Folder."
);
...
...
@@ -24,15 +27,6 @@ if (!file_exists(__DIR__."/ORM/Proxy/generated")) {
}
}
spl_autoload_register
(
function
(
$class
)
{
if
(
strpos
(
$class
,
'Symfony'
)
===
0
)
{
$file
=
str_replace
(
"
\\
"
,
"/"
,
$class
);
if
(
@
fopen
(
$class
,
"r"
))
{
require_once
(
$file
);
}
}
});
set_include_path
(
__DIR__
.
DIRECTORY_SEPARATOR
.
'..'
.
DIRECTORY_SEPARATOR
.
'..'
.
DIRECTORY_SEPARATOR
.
'..'
.
DIRECTORY_SEPARATOR
.
'lib'
.
PATH_SEPARATOR
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment