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

Let assertEquals change into assertSame #153

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 39 additions & 39 deletions tests/AbstractConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,40 +52,40 @@ public function testDefaultOptionsSetOnInstantiation()
'port' => 80,
]
);
$this->assertEquals('localhost', $config->get('host'));
$this->assertEquals(80, $config->get('port'));
$this->assertSame('localhost', $config->get('host'));
$this->assertSame(80, $config->get('port'));
}

/**
* @covers Noodlehaus\AbstractConfig::get()
*/
public function testGet()
{
$this->assertEquals('localhost', $this->config->get('host'));
$this->assertSame('localhost', $this->config->get('host'));
}

/**
* @covers Noodlehaus\AbstractConfig::get()
*/
public function testGetWithDefaultValue()
{
$this->assertEquals(128, $this->config->get('ttl', 128));
$this->assertSame(128, $this->config->get('ttl', 128));
}

/**
* @covers Noodlehaus\AbstractConfig::get()
*/
public function testGetNestedKey()
{
$this->assertEquals('configuration', $this->config->get('application.name'));
$this->assertSame('configuration', $this->config->get('application.name'));
}

/**
* @covers Noodlehaus\AbstractConfig::get()
*/
public function testGetNestedKeyWithDefaultValue()
{
$this->assertEquals(128, $this->config->get('application.ttl', 128));
$this->assertSame(128, $this->config->get('application.ttl', 128));
}

/**
Expand All @@ -110,7 +110,7 @@ public function testGetNonexistentNestedKey()
public function testGetReturnsArray()
{
$this->assertArrayHasKey('name', $this->config->get('application'));
$this->assertEquals('configuration', $this->config->get('application.name'));
$this->assertSame('configuration', $this->config->get('application.name'));
$this->assertCount(3, $this->config->get('application'));
}

Expand All @@ -120,7 +120,7 @@ public function testGetReturnsArray()
public function testSet()
{
$this->config->set('region', 'apac');
$this->assertEquals('apac', $this->config->get('region'));
$this->assertSame('apac', $this->config->get('region'));
}

/**
Expand All @@ -129,7 +129,7 @@ public function testSet()
public function testSetNestedKey()
{
$this->config->set('location.country', 'Singapore');
$this->assertEquals('Singapore', $this->config->get('location.country'));
$this->assertSame('Singapore', $this->config->get('location.country'));
}

/**
Expand All @@ -142,7 +142,7 @@ public function testSetArray()
'name' => 'mydatabase'
]);
$this->assertIsArray($this->config->get('database'));
$this->assertEquals('localhost', $this->config->get('database.host'));
$this->assertSame('localhost', $this->config->get('database.host'));
}

/**
Expand All @@ -160,7 +160,7 @@ public function testCacheWithNestedArray()
'host' => '127.0.0.1',
'name' => 'mydatabase'
];
$this->assertEquals($expected, $this->config->get('database'));
$this->assertSame($expected, $this->config->get('database'));

$this->config->set('config', [
'database' => [
Expand All @@ -178,13 +178,13 @@ public function testCacheWithNestedArray()
'name' => 'mydatabase'
]
];
$this->assertEquals($expected, $this->config->get('config'));
$this->assertSame($expected, $this->config->get('config'));

$expected = [
'host' => '127.0.0.1',
'name' => 'mydatabase'
];
$this->assertEquals($expected, $this->config->get('config.database'));
$this->assertSame($expected, $this->config->get('config.database'));
}

/**
Expand All @@ -207,8 +207,8 @@ public function testCacheWithNestedMiddleArray()
'host' => '127.0.0.1',
'name' => 'mynewdatabase'
]);
$this->assertEquals('127.0.0.1', $this->config->get('config.database.host'));
$this->assertEquals('mynewdatabase', $this->config->get('config.database.name'));
$this->assertSame('127.0.0.1', $this->config->get('config.database.host'));
$this->assertSame('mynewdatabase', $this->config->get('config.database.name'));
}

/**
Expand All @@ -221,7 +221,7 @@ public function testSetAndUnsetArray()
'name' => 'mydatabase'
]);
$this->assertIsArray($this->config->get('database'));
$this->assertEquals('localhost', $this->config->get('database.host'));
$this->assertSame('localhost', $this->config->get('database.host'));
$this->config->set('database.host', null);
$this->assertNull($this->config->get('database.host'));
$this->config->set('database', null);
Expand Down Expand Up @@ -278,7 +278,7 @@ public function testAll()
],
'user' => null,
];
$this->assertEquals($all, $this->config->all());
$this->assertSame($all, $this->config->all());
}

/**
Expand All @@ -296,23 +296,23 @@ public function testMerge()
$this->config->get('host');
$this->config->merge($remote);

$this->assertEquals('127.0.0.1', $this->config['host']);
$this->assertSame('127.0.0.1', $this->config['host']);
}

/**
* @covers Noodlehaus\AbstractConfig::offsetGet()
*/
public function testOffsetGet()
{
$this->assertEquals('localhost', $this->config['host']);
$this->assertSame('localhost', $this->config['host']);
}

/**
* @covers Noodlehaus\AbstractConfig::offsetGet()
*/
public function testOffsetGetNestedKey()
{
$this->assertEquals('configuration', $this->config['application.name']);
$this->assertSame('configuration', $this->config['application.name']);
}

/**
Expand All @@ -337,7 +337,7 @@ public function testOffsetExistsReturnsFalseOnNonexistentKey()
public function testOffsetSet()
{
$this->config['newkey'] = 'newvalue';
$this->assertEquals('newvalue', $this->config['newkey']);
$this->assertSame('newvalue', $this->config['newkey']);
}

/**
Expand All @@ -356,17 +356,17 @@ public function testCurrent()
{
/* Reset to the beginning of the test config */
$this->config->rewind();
$this->assertEquals($this->config['host'], $this->config->current());
$this->assertSame($this->config['host'], $this->config->current());

/* Step through each of the other elements of the test config */
$this->config->next();
$this->assertEquals($this->config['port'], $this->config->current());
$this->assertSame($this->config['port'], $this->config->current());
$this->config->next();
$this->assertEquals($this->config['servers'], $this->config->current());
$this->assertSame($this->config['servers'], $this->config->current());
$this->config->next();
$this->assertEquals($this->config['application'], $this->config->current());
$this->assertSame($this->config['application'], $this->config->current());
$this->config->next();
$this->assertEquals($this->config['user'], $this->config->current());
$this->assertSame($this->config['user'], $this->config->current());

/* Step beyond the end and confirm the result */
$this->config->next();
Expand All @@ -380,17 +380,17 @@ public function testKey()
{
/* Reset to the beginning of the test config */
$this->config->rewind();
$this->assertEquals('host', $this->config->key());
$this->assertSame('host', $this->config->key());

/* Step through each of the other elements of the test config */
$this->config->next();
$this->assertEquals('port', $this->config->key());
$this->assertSame('port', $this->config->key());
$this->config->next();
$this->assertEquals('servers', $this->config->key());
$this->assertSame('servers', $this->config->key());
$this->config->next();
$this->assertEquals('application', $this->config->key());
$this->assertSame('application', $this->config->key());
$this->config->next();
$this->assertEquals('user', $this->config->key());
$this->assertSame('user', $this->config->key());

/* Step beyond the end and confirm the result */
$this->config->next();
Expand All @@ -406,10 +406,10 @@ public function testNext()
$this->config->rewind();

/* Step through each of the other elements of the test config */
$this->assertEquals($this->config['port'], $this->config->next());
$this->assertEquals($this->config['servers'], $this->config->next());
$this->assertEquals($this->config['application'], $this->config->next());
$this->assertEquals($this->config['user'], $this->config->next());
$this->assertSame($this->config['port'], $this->config->next());
$this->assertSame($this->config['servers'], $this->config->next());
$this->assertSame($this->config['application'], $this->config->next());
$this->assertSame($this->config['user'], $this->config->next());

/* Step beyond the end and confirm the result */
$this->assertFalse($this->config->next());
Expand All @@ -423,10 +423,10 @@ public function testRewind()
/* Rewind from somewhere out in the array */
$this->config->next();
$this->config->next();
$this->assertEquals($this->config['host'], $this->config->rewind());
$this->assertSame($this->config['host'], $this->config->rewind());

/* Rewind again from the beginning of the array */
$this->assertEquals($this->config['host'], $this->config->rewind());
$this->assertSame($this->config['host'], $this->config->rewind());
}

/**
Expand Down Expand Up @@ -482,8 +482,8 @@ public function testIterator()
$idxConfig = 0;

foreach ($this->config as $configKey => $configValue) {
$this->assertEquals($expectedKeys[$idxConfig], $configKey);
$this->assertEquals($expectedValues[$idxConfig], $configValue);
$this->assertSame($expectedKeys[$idxConfig], $configKey);
$this->assertSame($expectedValues[$idxConfig], $configValue);
$idxConfig++;
}
}
Expand Down
20 changes: 10 additions & 10 deletions tests/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function testConstructWithArray()
$expected = 'localhost';
$actual = $config->get('host');

$this->assertEquals($expected, $actual);
$this->assertSame($expected, $actual);
}

/**
Expand All @@ -101,7 +101,7 @@ public function testConstructWithArrayWithNonexistentFile()
$expected = 'localhost';
$actual = $config->get('host');

$this->assertEquals($expected, $actual);
$this->assertSame($expected, $actual);
}

/**
Expand All @@ -119,7 +119,7 @@ public function testConstructWithArrayWithOptionalFile()
$expected = 'localhost';
$actual = $config->get('host');

$this->assertEquals($expected, $actual);
$this->assertSame($expected, $actual);
}

/**
Expand All @@ -137,7 +137,7 @@ public function testConstructWithArrayWithOptionalNonexistentFile()
$expected = 'localhost';
$actual = $config->get('host');

$this->assertEquals($expected, $actual);
$this->assertSame($expected, $actual);
}

/**
Expand All @@ -154,7 +154,7 @@ public function testConstructWithDirectory()
$expected = 'localhost';
$actual = $config->get('host');

$this->assertEquals($expected, $actual);
$this->assertSame($expected, $actual);
}

/**
Expand All @@ -171,7 +171,7 @@ public function testConstructWithYml()
$expected = 'localhost';
$actual = $config->get('host');

$this->assertEquals($expected, $actual);
$this->assertSame($expected, $actual);
}

/**
Expand All @@ -188,7 +188,7 @@ public function testConstructWithYmlDist()
$expected = 'localhost';
$actual = $config->get('host');

$this->assertEquals($expected, $actual);
$this->assertSame($expected, $actual);
}

/**
Expand All @@ -205,7 +205,7 @@ public function testConstructWithEmptyYml()
$expected = [];
$actual = $config->all();

$this->assertEquals($expected, $actual);
$this->assertSame($expected, $actual);
}

/**
Expand All @@ -221,7 +221,7 @@ public function testConstructWithFileParser()
$expected = 'localhost';
$actual = $config->get('host');

$this->assertEquals($expected, $actual);
$this->assertSame($expected, $actual);
}

/**
Expand All @@ -236,7 +236,7 @@ public function testConstructWithStringParser()
$expected = 'localhost';
$actual = $config->get('host');

$this->assertEquals($expected, $actual);
$this->assertSame($expected, $actual);
}

/**
Expand Down
22 changes: 11 additions & 11 deletions tests/Parser/IniTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testGetSupportedExtensions()
{
$expected = ['ini'];
$actual = $this->ini->getSupportedExtensions();
$this->assertEquals($expected, $actual);
$this->assertSame($expected, $actual);
}

/**
Expand Down Expand Up @@ -75,11 +75,11 @@ public function testLoadIni()
$file = $this->ini->parseFile(__DIR__ . '/../mocks/pass/config.ini');
$string = $this->ini->parseString(file_get_contents(__DIR__ . '/../mocks/pass/config.ini'));

$this->assertEquals('localhost', $file['host']);
$this->assertEquals('80', $file['port']);
$this->assertSame('localhost', $file['host']);
$this->assertSame('80', $file['port']);

/*$this->assertEquals('localhost', $string['host']);
$this->assertEquals('80', $string['port']);*/
/*$this->assertSame('localhost', $string['host']);
$this->assertSame(80, $string['port']);*/
}

/**
Expand All @@ -95,12 +95,12 @@ public function testLoadIniWithDottedName()

$expected = ['host1', 'host2', 'host3'];

$this->assertEquals($expected, $file['network']['group']['servers']);
$this->assertEquals('localhost', $file['network']['http']['host']);
$this->assertEquals('80', $file['network']['http']['port']);
$this->assertSame($expected, $file['network']['group']['servers']);
$this->assertSame('localhost', $file['network']['http']['host']);
$this->assertSame('80', $file['network']['http']['port']);

$this->assertEquals($expected, $string['network']['group']['servers']);
$this->assertEquals('localhost', $string['network']['http']['host']);
$this->assertEquals('80', $string['network']['http']['port']);
$this->assertSame($expected, $string['network']['group']['servers']);
$this->assertSame('localhost', $string['network']['http']['host']);
$this->assertSame('80', $string['network']['http']['port']);
}
}
Loading