public function test_generateFileDataObject_returnsSingleMockMakerFileDataObject() { $file = $this->rootDir . 'tests/MockMaker/Entities/TestEntity.php'; $this->worker->getConfig()->addFilesToMock($file); $method = TestHelper::getAccessibleNonPublicMethod($this->worker, 'generateFileDataObject'); $actual = $method->invoke($this->worker, $file, $this->worker->getConfig()); $this->assertInstanceOf('MockMaker\\Model\\MockMakerFileData', $actual); }
public function test_getExcludeFiles_returnsCorrectFilesForRegex() { $method = TestHelper::getAccessibleNonPublicMethod($this->worker, 'getExcludeFiles'); $regex = '/Repository$/'; $actual = $method->invoke($this->worker, $this->testFilesArr, $regex); $expected = array('FakeEntityRepository.php', 'TestEntityRepository.php', 'CustomRepository.php', 'UserRepository.php', 'CustomerEntityRepository.php'); $this->assertEquals($expected, $actual); }
public function findRelativePathProvider() { $root = TestHelper::getRootDir(); return array(array($root, $root, ''), array($root, $root . 'tests/', 'tests/'), array($root, $root . 'tests/Entities/', 'tests/Entities/'), array($root, $root . 'tests/Entities/SubEntities/', 'tests/Entities/SubEntities/')); }
/** * Used for testing workflow. */ public function _test_workflow() { $actual = $this->mockMaker->mockTheseEntities($this->entitiesDir . 'TestEntity.php')->saveMockFilesIn($this->rootDir . '/tests/MockMaker/Mocks/Entities')->saveUnitTestsIn($this->unitTestsWriteDir)->createMocks(); //->verifySettings(); TestHelper::dbug($actual, __METHOD__, true); }
/** * @dataProvider determineWithBaseNamespaceProvider */ public function test_determineWithBaseNamespace_returnsProperNamespace($mockPath, $baseNamespace, $expected) { $method = TestHelper::getAccessibleNonPublicMethod($this->worker, 'determineWithBaseNamespace'); $actual = $method->invoke($this->worker, $mockPath, $baseNamespace); $this->assertEquals($expected, $actual); }
public function test_getImplementsClasses_returnsEmptyArrayIfNoInterfaces() { $reflection = new \ReflectionClass('MockMaker\\Entities\\SimpleEntity'); $method = TestHelper::getAccessibleNonPublicMethod($this->worker, 'getImplementsClasses'); $actual = $method->invoke($this->worker, $reflection); $this->assertEquals([], $actual); }