From 517f859d263448e6c91a64e163cd74c70a8008e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=BCbner?= Date: Fri, 28 Apr 2017 16:18:16 +0200 Subject: [PATCH] Add RelationMapper phpunit tests --- .../RelationMapper/RelationMapperTest.php | 56 +++++++++++++++++++ tests/Util/RelationMapper/fixtures/empty.yml | 0 .../RelationMapper/fixtures/resources.yml | 1 + 3 files changed, 57 insertions(+) create mode 100644 tests/Util/RelationMapper/RelationMapperTest.php create mode 100644 tests/Util/RelationMapper/fixtures/empty.yml create mode 100644 tests/Util/RelationMapper/fixtures/resources.yml diff --git a/tests/Util/RelationMapper/RelationMapperTest.php b/tests/Util/RelationMapper/RelationMapperTest.php new file mode 100644 index 0000000..ba9e48b --- /dev/null +++ b/tests/Util/RelationMapper/RelationMapperTest.php @@ -0,0 +1,56 @@ +assertEquals('bar', $mapper->find('foo','resources')); + } + +// public function testLoadDoesNothingIfEmpty() +// { +// $resource = __DIR__.'/fixtures/empty.yml'; +// $catalogue = Yaml::parse(file_get_contents($resource)); +// +// $this->assertEquals(array(), $catalogue); +// } +// +// /** +// * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException +// */ +// public function testLoadNonExistingResource() +// { +// $loader = new YamlFileLoader(); +// $resource = __DIR__.'/../fixtures/non-existing.yml'; +// $loader->load($resource, 'en', 'domain1'); +// } +// +// /** +// * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException +// */ +// public function testLoadThrowsAnExceptionIfFileNotLocal() +// { +// $loader = new YamlFileLoader(); +// $resource = 'http://example.com/resources.yml'; +// $loader->load($resource, 'en', 'domain1'); +// } +// +// /** +// * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException +// */ +// public function testLoadThrowsAnExceptionIfNotAnArray() +// { +// $loader = new YamlFileLoader(); +// $resource = __DIR__.'/../fixtures/non-valid.yml'; +// $loader->load($resource, 'en', 'domain1'); +// } +} \ No newline at end of file diff --git a/tests/Util/RelationMapper/fixtures/empty.yml b/tests/Util/RelationMapper/fixtures/empty.yml new file mode 100644 index 0000000..e69de29 diff --git a/tests/Util/RelationMapper/fixtures/resources.yml b/tests/Util/RelationMapper/fixtures/resources.yml new file mode 100644 index 0000000..20e9ff3 --- /dev/null +++ b/tests/Util/RelationMapper/fixtures/resources.yml @@ -0,0 +1 @@ +foo: bar