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

Update docblocks. #13456

Merged
merged 3 commits into from Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Database/Type/DecimalType.php
Expand Up @@ -45,7 +45,7 @@ class DecimalType extends BaseType implements BatchCastingInterface
protected $_useLocaleParser = false;

/**
* Convert integer data into the database format.
* Convert decimal strings into the database format.
*
* @param mixed $value The value to convert.
* @param \Cake\Database\DriverInterface $driver The driver instance to convert with.
Expand Down Expand Up @@ -76,7 +76,7 @@ public function toDatabase($value, DriverInterface $driver)
}

/**
* Convert float values to PHP floats
* Convert numeric values to strings representing decimal.
*
* @param mixed $value The value to convert.
* @param \Cake\Database\DriverInterface $driver The driver instance to convert with.
Expand Down Expand Up @@ -111,7 +111,7 @@ public function manyToPHP(array $values, array $fields, DriverInterface $driver)
}

/**
* Get the correct PDO binding type for integer data.
* Get the correct PDO binding type for decimal data.
*
* @param mixed $value The value being bound.
* @param \Cake\Database\DriverInterface $driver The driver.
Expand All @@ -123,7 +123,7 @@ public function toStatement($value, DriverInterface $driver): int
}

/**
* Marshalls request data into PHP floats.
* Marshalls request data into decimal strings.
*
* @param mixed $value The value to convert.
* @return string|null Converted value.
Expand Down Expand Up @@ -173,8 +173,8 @@ public function useLocaleParser(bool $enable = true)
}

/**
* Converts a string into a float point after parsing it using the locale
* aware parser.
* Converts localized string into a decimal string after parsing it using
* the locale aware parser.
*
* @param string $value The value to parse and convert to an float.
* @return string
Expand Down
6 changes: 3 additions & 3 deletions src/TestSuite/TestCase.php
Expand Up @@ -753,12 +753,12 @@ protected function skipUnless($condition, $message = '')
* Mock a model, maintain fixtures and table association
*
* @param string $alias The model to get a mock for.
* @param array|null $methods The list of methods to mock
* @param array $methods The list of methods to mock
* @param array $options The config data for the mock's constructor.
* @throws \Cake\ORM\Exception\MissingTableClassException
* @return \Cake\ORM\Table|\PHPUnit\Framework\MockObject\MockObject
*/
public function getMockForModel(string $alias, ?array $methods = [], array $options = [])
public function getMockForModel(string $alias, array $methods = [], array $options = [])
{
$className = $this->_getTableClassName($alias, $options);
$connectionName = $className::defaultConnectionName();
Expand All @@ -772,7 +772,7 @@ public function getMockForModel(string $alias, ?array $methods = [], array $opti

/** @var \Cake\ORM\Table|\PHPUnit\Framework\MockObject\MockObject $mock */
$mock = $this->getMockBuilder($className)
->setMethods($methods)
->onlyMethods($methods)
->setConstructorArgs([$options])
->getMock();

Expand Down
21 changes: 4 additions & 17 deletions tests/TestCase/TestSuite/TestCaseTest.php
Expand Up @@ -359,12 +359,10 @@ public function testGetMockForModel()
->will($this->returnValue('mocked'));
$this->assertSame('mocked', $Posts->save($entity));
$this->assertSame('Cake\ORM\Entity', $Posts->getEntityClass());

$Posts = $this->getMockForModel('Posts', ['doSomething']);
$this->assertInstanceOf('Cake\Database\Connection', $Posts->getConnection());
$this->assertSame('test', $Posts->getConnection()->configName());

$Tags = $this->getMockForModel('Tags', ['doSomething']);
$Tags = $this->getMockForModel('Tags', ['save']);
$this->assertSame('TestApp\Model\Entity\Tag', $Tags->getEntityClass());
}

Expand Down Expand Up @@ -411,7 +409,7 @@ public function testGetMockForModelWithPlugin()
$this->assertTrue($TestPluginComment->save($entity));
$this->assertFalse($TestPluginComment->save($entity));

$TestPluginAuthors = $this->getMockForModel('TestPlugin.Authors', ['doSomething']);
$TestPluginAuthors = $this->getMockForModel('TestPlugin.Authors', ['save']);
$this->assertInstanceOf('TestPlugin\Model\Table\AuthorsTable', $TestPluginAuthors);
$this->assertSame('TestPlugin\Model\Entity\Author', $TestPluginAuthors->getEntityClass());
$this->clearPlugins();
Expand Down Expand Up @@ -453,17 +451,6 @@ public function testGetMockForModelTable()
$result = $this->getTableLocator()->get('Comments');
$this->assertInstanceOf(Table::class, $result);
$this->assertEmpty([], $allMethodsStubs->getAlias());

$allMethodsMocks = $this->getMockForModel(
'Table',
null,
['alias' => 'Comments', 'className' => Table::class]
);
$result = $this->getTableLocator()->get('Comments');
$this->assertInstanceOf(Table::class, $result);
$this->assertSame('Comments', $allMethodsMocks->getAlias());

$this->assertNotEquals($allMethodsStubs, $allMethodsMocks);
}

/**
Expand All @@ -475,10 +462,10 @@ public function testGetMockForModelSetTable()
{
static::setAppNamespace();

$I18n = $this->getMockForModel('I18n', ['doSomething']);
$I18n = $this->getMockForModel('I18n', ['save']);
$this->assertSame('custom_i18n_table', $I18n->getTable());

$Tags = $this->getMockForModel('Tags', ['doSomething']);
$Tags = $this->getMockForModel('Tags', ['save']);
$this->assertSame('tags', $Tags->getTable());
}
}